:root {
  --bg: #0d1014;
  --card: rgba(22, 26, 32, .86);
  --card-border: rgba(255, 255, 255, .09);
  --field: #1b2027;
  --text: #eef0f3;
  --muted: #9aa3ad;
  --gold: #f5b83d;
  --gold-2: #ffcf5c;
  --err: #ff7a6e;
  --warn: #f5b83d;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); background: var(--bg); min-height: 100vh;
  background-image:
    radial-gradient(1200px 500px at 85% -10%, rgba(120, 100, 70, .22), transparent 60%),
    radial-gradient(900px 600px at 0% 110%, rgba(245, 184, 61, .12), transparent 60%),
    linear-gradient(180deg, #11151a, #0b0d10);
  background-attachment: fixed;
}
em { color: var(--gold); font-style: normal; }
code { background: var(--field); padding: .1em .4em; border-radius: 5px; font-size: .92em; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1360px; margin: 0 auto; padding: 18px 24px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--gold); text-decoration: none; font-size: 24px; font-weight: 600; }
.brand span { color: var(--text); }
nav { display: flex; gap: 36px; }
nav a { color: var(--muted); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); border-color: var(--gold); }

main { max-width: 1360px; margin: 0 auto; padding: 0 24px 40px; }
.hero { text-align: center; padding: 46px 0 36px; }
.hero h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); font-weight: 700; letter-spacing: -.01em; }
.hero p { margin: 14px 0 0; color: var(--muted); font-size: 19px; }

.grid { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr); gap: 20px 0; align-items: start; }
.left { display: grid; gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 20px 22px; backdrop-filter: blur(6px);
}
.card h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.card h2 svg { color: var(--gold); }
.swap { align-self: start; margin: 100px 16px 0; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--card-border); background: var(--card); color: var(--text); }

.row { display: flex; gap: 14px; }
input[type=text], select, input[type=number] {
  background: var(--field); color: var(--text); border: 1px solid var(--card-border); border-radius: 10px;
  padding: 0 16px; height: 52px; font: inherit; min-width: 0;
}
input[type=text] { flex: 1; font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 17px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.hint.small { margin-top: 10px; font-size: 13px; }
.hint.err { color: var(--err); }
.hint b { color: var(--text); font-weight: 500; }
.inline { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 14px; }
.inline select { height: 38px; padding: 0 10px; }
.notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.notes li::before { content: "ℹ"; margin-right: 8px; }
.notes li.note-warn { color: var(--warn); }
.notes li.note-warn::before { content: "⚠"; }
.out { margin-top: 18px; display: grid; gap: 8px; }
.out label { color: var(--muted); font-size: 14px; }
.copyfield { display: flex; gap: 10px; }
.copyfield input { flex: 1; height: 50px; font-size: 16px; color: var(--gold-2); cursor: pointer; border-color: rgba(245, 184, 61, .35); }
.copyfield input:hover { border-color: var(--gold); }
.copyfield .btn { height: 50px; padding: 0 20px; }
.copyfield.done input { border-color: #4fd16a; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: 52px; padding: 0 26px;
  border: 1px solid var(--card-border); border-radius: 10px; background: var(--field); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1405; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }

.scene {
  position: relative; height: 245px; border-radius: 10px; overflow: hidden;
  background: #8b7653 url("assets/scene.webp") center / cover no-repeat;
}
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.rows { display: grid; gap: 10px; }
.srow { display: grid; grid-template-columns: 96px 92px 1fr; align-items: center; gap: 12px; }
.srow label { color: var(--text); font-size: 15px; }
.srow select { grid-column: 2 / -1; height: 44px; }
.srow input[type=number] { height: 42px; width: 92px; font-family: ui-monospace, Consolas, monospace; font-size: 16px; padding: 0 12px; -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; outline-offset: 6px;
  background: linear-gradient(90deg, var(--fill, var(--gold)) var(--p, 0%), rgba(255, 255, 255, .08) var(--p, 0%));
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 3px rgba(0, 0, 0, .25); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; cursor: pointer; }
.srow.red { --fill: #ee4b4b; } .srow.green { --fill: #4fd16a; } .srow.blue { --fill: #4b84ee; } .srow.alpha { --fill: #aab2bd; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; color: var(--muted); font-size: 14px; }
.toggles label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggles input { accent-color: var(--gold); width: 16px; height: 16px; }

.bar { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 22px 26px; }
.actions { display: flex; gap: 16px; flex-wrap: wrap; }
.actions .btn { height: 58px; min-width: 190px; }
.live { display: flex; align-items: center; gap: 18px; padding-left: 28px; border-left: 1px solid var(--card-border); }
.live small { display: block; color: var(--muted); margin-top: 6px; font-size: 13px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: #3a414b; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.info { max-width: 860px; margin: 0 auto; padding: 24px; color: var(--muted); line-height: 1.6; }
.info h2 { color: var(--text); font-size: 22px; }
details { border-top: 1px solid var(--card-border); padding: 12px 0; }
summary { cursor: pointer; color: var(--text); font-weight: 500; }
details p { margin: 8px 0 0; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; gap: 20px; }
  .swap { display: none; }
  .live { border-left: 0; padding-left: 0; }
}
@media (max-width: 560px) {
  .top { flex-direction: column; align-items: flex-start; }
  nav { gap: 22px; }
  .row { flex-direction: column; }
  .srow { grid-template-columns: 76px 76px 1fr; gap: 8px; }
  .srow input[type=number] { width: 76px; }
  .actions .btn { flex: 1 1 100%; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.info ol { padding-left: 22px; } .info li { margin: 6px 0; }
.foot { max-width: 860px; margin: 0 auto; padding: 8px 24px 40px; color: var(--muted); font-size: 13px; text-align: center; }
