:root {
  --ink: #13202b;
  --muted: #5b6b78;
  --line: rgba(19, 32, 43, 0.12);
  --paper: #f3f6f8;
  --panel: rgba(255, 255, 255, 0.78);
  --accent: #0b6e7a;
  --accent-deep: #084e57;
  --steel: #8aa0ae;
  --glow: #9fd7df;
  --ok: #1565c0;
  --ok-bg: #e3f0ff;
  --no: #5c6570;
  --no-bg: #eef0f2;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(12, 28, 38, 0.12);
  --font-display: "Instrument Sans", "IBM Plex Sans KR", sans-serif;
  --font-body: "IBM Plex Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(159, 215, 223, 0.55), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(11, 110, 122, 0.18), transparent 55%),
    linear-gradient(180deg, #e8eef2 0%, var(--paper) 45%, #e4ebf0 100%);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 1rem 1.5rem;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(14px);
  overflow: auto;
}

.sidebar-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.35rem 0.4rem;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.sidebar-brand p {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.mark {
  width: 2rem; height: 2rem; border-radius: 0.65rem;
  background: #a50034;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28);
  position: relative;
}
.mark::after {
  content: "T";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: Verdana, Geneva, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1;
}

.tree { display: grid; gap: 0.25rem; }
.tree details { border-radius: 10px; }
.tree summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
}
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before {
  content: "▸";
  display: inline-block;
  width: 1rem;
  color: var(--accent);
  transition: transform 0.15s ease;
}
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary:hover, .tree button:hover { background: rgba(11,110,122,0.08); }
.tree .children { display: grid; gap: 0.15rem; padding: 0.15rem 0 0.35rem 0.85rem; }
.tree button {
  appearance: none; border: 0; background: transparent; text-align: left;
  padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer;
  color: var(--ink); font: inherit; font-size: 0.86rem;
}
.tree button.active {
  background: rgba(11,110,122,0.14);
  color: var(--accent-deep);
  font-weight: 600;
}
.sidebar-note {
  margin-top: 1.5rem;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.main { padding: 1.5rem 1.5rem 3rem; max-width: 980px; }

.hero {
  padding: 1.2rem 0 1.6rem;
  animation: rise 0.55s ease both;
}
.brand {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: -0.045em;
  line-height: 1;
  background: linear-gradient(120deg, var(--ink) 20%, var(--accent) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.lede {
  margin: 0.85rem 0 1.25rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  max-width: 640px;
}
.search input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font: inherit;
  font-size: 1rem;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
  outline: none;
}
.search input:focus {
  border-color: rgba(11,110,122,0.45);
  box-shadow: 0 0 0 4px rgba(11,110,122,0.12), var(--shadow);
}
.search button {
  border: 0;
  border-radius: 999px;
  padding: 0 1.35rem;
  background: linear-gradient(160deg, #1390a0, var(--accent-deep));
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(8,78,87,0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.search button:hover { transform: translateY(-1px); filter: brightness(1.05); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.chips button {
  appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,0.7);
  border-radius: 999px; padding: 0.35rem 0.75rem; font: inherit; font-size: 0.82rem;
  color: var(--muted); cursor: pointer;
}
.chips button:hover { border-color: rgba(11,110,122,0.35); color: var(--accent-deep); }

.panel {
  scroll-margin-top: 1rem;
  margin-top: 1.1rem;
  padding: 1.25rem 1.3rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}
.panel[hidden] { display: none !important; }
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
  word-break: keep-all;
}
.summary { margin: 0.7rem 0 1rem; color: var(--muted); line-height: 1.55; }

.affiliate {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1.15rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(165, 0, 52, 0.22);
  background: linear-gradient(180deg, rgba(165, 0, 52, 0.08), rgba(255, 255, 255, 0.65));
}
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: linear-gradient(160deg, #c2185b, #a50034);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 22px rgba(165, 0, 52, 0.28);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    background 0.18s ease;
}
.cta::after {
  content: "→";
  display: inline-block;
  transition: transform 0.18s ease;
}
.cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 14px 28px rgba(165, 0, 52, 0.38);
  background: linear-gradient(160deg, #d81b60, #8e0030);
}
.cta:hover::after {
  transform: translateX(4px);
}
.cta:active {
  transform: translateY(0);
  filter: brightness(1.02);
  box-shadow: 0 8px 16px rgba(165, 0, 52, 0.24);
}
.ftc {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

.tokens {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.token {
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11,110,122,0.08), rgba(255,255,255,0.55));
  border: 1px solid rgba(11,110,122,0.14);
}
.token .code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
}
.token .label { margin-top: 0.2rem; font-weight: 600; font-size: 0.92rem; }
.token .desc { margin-top: 0.25rem; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.spec { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.spec th, .spec td { padding: 0.7rem 0.85rem; text-align: left; border-bottom: 1px solid var(--line); }
.spec th { width: 38%; background: rgba(11,110,122,0.06); font-weight: 600; }
.spec tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.badge.yes {
  color: var(--ok);
  background: var(--ok-bg);
  box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.28);
}
.badge.no {
  color: var(--no);
  background: var(--no-bg);
  box-shadow: inset 0 0 0 1px rgba(92, 101, 112, 0.22);
}

.feature-list {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 1rem 0 0; padding: 0; list-style: none;
}
.feature-list li {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(19,32,43,0.06);
  font-size: 0.82rem;
  font-weight: 500;
}

.cards { display: grid; gap: 0.7rem; margin-top: 0.85rem; }
.card-btn {
  appearance: none; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 0.95rem 1rem; background: rgba(255,255,255,0.65);
  font: inherit; color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card-btn:hover {
  border-color: rgba(11,110,122,0.35);
  transform: translateY(-1px);
}
.card-btn .row {
  display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline;
}
.card-btn strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.card-btn .meta { color: var(--muted); font-size: 0.82rem; }
.card-btn p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }

.empty { text-align: left; }
.empty p { color: var(--muted); margin: 0.5rem 0 0; }


.panel.decode.flash {
  animation: result-flash 0.7s ease;
}
@keyframes result-flash {
  0% { box-shadow: 0 0 0 0 rgba(11, 110, 122, 0.35), var(--shadow); }
  40% { box-shadow: 0 0 0 6px rgba(11, 110, 122, 0.18), var(--shadow); }
  100% { box-shadow: 0 18px 50px rgba(12, 28, 38, 0.12); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


.topbar {
  display: none;
}

.menu-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(12, 28, 38, 0.08);
}
.menu-toggle:hover { border-color: rgba(11,110,122,0.35); }
.burger {
  display: grid;
  gap: 5px;
  width: 1.15rem;
}
.burger i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.menu-close {
  display: none;
  appearance: none;
  border: 0;
  background: transparent;
  margin-left: auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.menu-close:hover { background: rgba(11,110,122,0.08); color: var(--ink); }

.backdrop {
  display: none;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }

  .main { position: relative; }
  .topbar {
    display: block;
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    z-index: 5;
    margin: 0;
  }
  .hero {
    padding-right: 3.4rem; /* space for floating menu button */
  }

  .menu-close { display: inline-flex; align-items: center; justify-content: center; }

  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(10, 22, 30, 0.42);
    border: 0;
    padding: 0;
    cursor: pointer;
  }
  .backdrop[hidden] { display: none !important; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: min(86vw, 300px);
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: rgba(255,255,255,0.96);
    box-shadow: 16px 0 40px rgba(12, 28, 38, 0.18);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    pointer-events: none;
  }
  body.menu-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
  }
  body.menu-open { overflow: hidden; }

  .sidebar-brand { padding-right: 0.1rem; }

  .main { padding: 0.85rem 1rem 2.5rem; }
  .hero { padding-top: 0.35rem; }
  .brand { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .panel.decode h2 { font-size: 1.15rem; }
  .affiliate { padding: 0.85rem; }
  .cta { min-height: 3.1rem; font-size: 0.98rem; }
  .search { grid-template-columns: 1fr; }
  .search button { min-height: 3rem; }
}
