:root {
  --bg: #0f1720;
  --card: #17212b;
  --card-2: #1d2935;
  --border: #2b3948;
  --text: #e5edf5;
  --muted: #aab7c4;
  --accent: #6fb3ff;
  --accent-2: #cfe6ff;
  --danger: #ffb4b4;
  --success: #b8e6b8;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #0b1218 0%, #111b24 100%);
  color: var(--text);
}

.page {
  width: min(980px, calc(100% - 2rem));
  margin: 2rem auto 3rem;
}

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.hero { margin-bottom: 1rem; }
.tool-card { margin-bottom: 1rem; }
.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  margin: 0 0 0.25rem;
}

h1, h2, h3 { margin-top: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 0.5rem; }
.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 0.9rem;
}

.scope-note {
  background: rgba(111, 179, 255, 0.1);
  border: 1px solid rgba(111, 179, 255, 0.25);
  color: var(--accent-2);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}

.label {
  display: block;
  font-weight: 650;
  margin-bottom: 0.55rem;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0d151c;
  color: var(--text);
  font-size: 1rem;
}

input:focus, button:focus {
  outline: 2px solid rgba(111, 179, 255, 0.55);
  outline-offset: 2px;
}

button {
  border: 1px solid rgba(111, 179, 255, 0.4);
  background: rgba(111, 179, 255, 0.12);
  color: var(--text);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
}

button:hover { background: rgba(111, 179, 255, 0.2); }

.helper-text {
  color: var(--muted);
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}

code {
  background: rgba(255,255,255,0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
}

.example-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1rem;
}

.example-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.example-chip {
  padding: 0.5rem 0.75rem;
  font-size: 0.92rem;
  border-radius: 999px;
}

.result {
  border: 1px solid var(--border);
  background: #0d151c;
  border-radius: 16px;
  padding: 1rem;
  min-height: 120px;
}

.result.empty {
  color: var(--muted);
  display: flex;
  align-items: center;
}

.result.error {
  border-color: rgba(255, 180, 180, 0.3);
  color: var(--danger);
}

.result h2 {
  margin-bottom: 0.3rem;
}

.result .subtitle {
  color: var(--muted);
  margin-bottom: 1rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.info-box {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 0.85rem;
}

.info-box .k {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.25rem;
}

.info-box .v {
  font-weight: 650;
  line-height: 1.4;
}

.breakdown {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.breakdown li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.breakdown strong {
  color: var(--accent-2);
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.notes-grid p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.5;
}

.small-note {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.tag {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(111, 179, 255, 0.12);
  border: 1px solid rgba(111, 179, 255, 0.25);
  color: var(--accent-2);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .page { width: min(100% - 1rem, 980px); margin-top: 1rem; }
  .input-row { grid-template-columns: 1fr; }
  button#decodeBtn { width: 100%; }
}
