/* Decoder — the nameplate input and the color-coded model ribbon are the signature elements. */
:root {
  --s0: #ffc34b; --s1: #e10600; --s2: #2f6f9f; --s3: #1c1c1c; --s4: #2e8b57;
  --s5: #8a4fbf; --s6: #d9731a; --s7: #0f8f8f; --s8: #6b6b6b; --s9: #b0306f;
}

/* Stamped metal nameplate */
.plate { position: relative; padding: 22px 22px 18px; border-radius: 14px; border: 2px solid #9c9c96;
  background: linear-gradient(135deg, #f4f4f1 0%, #d8d8d3 38%, #eeeeea 52%, #c9c9c3 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0,0,0,.08); color: #1c1c1c; }
@media (prefers-color-scheme: dark) { .plate { background: linear-gradient(135deg, #3a3a37 0%, #2a2a28 40%, #34342f 55%, #242422 100%); border-color: #55554f; color: #f1f1ee; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); } }
.plate label { font-size: 0.82rem; letter-spacing: 0.02em; opacity: .8; }
.rivet { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #8d8d87 60%, #5d5d58); }
.rivet.tl { top: 9px; left: 9px; } .rivet.tr { top: 9px; right: 9px; } .rivet.bl { bottom: 9px; left: 9px; } .rivet.br { bottom: 9px; right: 9px; }
.plate-row { display: flex; gap: 8px; }
.plate input#model { flex: 1; min-width: 0; font: 800 clamp(1.3rem, 5vw, 1.9rem)/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,.55); border: 2px solid rgba(0,0,0,.25); border-radius: 10px; padding: 14px; color: #1c1c1c; min-height: 62px; }
@media (prefers-color-scheme: dark) { .plate input#model { background: rgba(0,0,0,.35); color: #fff; border-color: rgba(255,255,255,.2); } }
.plate .btn-cta { min-width: 112px; font-size: 1.05rem; }
.plate .clear { min-width: 46px; padding: 0; }
.examples { margin-top: 12px; align-items: center; }
.examples .chip { font-family: var(--display); font-weight: 700; letter-spacing: .02em; background: rgba(255,255,255,.6); }
@media (prefers-color-scheme: dark) { .examples .chip { background: rgba(255,255,255,.08); color: #f1f1ee; border-color: rgba(255,255,255,.18); } }
@media (max-width: 520px) { .plate-row { flex-wrap: wrap; } .plate input#model { flex: 1 1 100%; } .plate .btn-cta { flex: 1; } }

/* Empty state */
.empty { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: center; }
.empty p { margin: 0; color: var(--ink-2); }
.ribbon-demo { width: 100%; height: auto; }
@media (max-width: 640px) { .empty { grid-template-columns: 1fr; } }

/* Result: ribbon */
.result-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 14px; }
.result-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: .03em; word-break: break-all; }
.result-head .fam { color: var(--muted); font-weight: 600; }
.ribbon { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.seg { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; animation: segIn .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--n) * 60ms); }
.seg b { display: block; min-width: 40px; padding: 9px 11px; border-radius: 9px; font: 800 1.35rem/1 var(--display); letter-spacing: .04em; color: #fff; background: var(--c); text-align: center; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.seg b.light { color: #1c1c1c; }
.seg span { font-size: 0.72rem; color: var(--muted); font-weight: 600; max-width: 84px; text-align: center; line-height: 1.15; }
.seg.plain b { background: transparent; color: var(--muted); box-shadow: none; padding: 9px 2px; min-width: 0; }
.seg:focus-visible b, .seg.active b { outline: 3px solid var(--ink); outline-offset: 2px; }
@keyframes segIn { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

/* Spec visuals */
.visuals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.vis { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-rows: auto 1fr auto; align-items: center; gap: 6px; text-align: center; }
.vis h3 { font-size: 0.82rem; color: var(--muted); font-weight: 700; display: flex; gap: 6px; align-items: center; justify-content: center; }
.vis svg.art { width: 100%; max-width: 150px; height: auto; margin: 0 auto; }
.vis .big { font: 800 1.15rem var(--display); }
.vis .sub { font-size: 0.8rem; color: var(--muted); }
.gear-spin { transform-origin: 60px 60px; animation: spin 1.4s cubic-bezier(.2,.7,.2,1) both; }
.gear-spin.ccw { animation-name: spinBack; }
@keyframes spin { from { transform: rotate(-60deg); } to { transform: rotate(0); } }
@keyframes spinBack { from { transform: rotate(60deg); } to { transform: rotate(0); } }
@media (max-width: 640px) { .visuals { grid-template-columns: 1fr 1fr; } .visuals .vis:first-child { grid-column: 1 / -1; } }

/* Family spec bars */
.specbars { display: grid; gap: 10px; align-content: start; text-align: left; margin-top: 4px; }
.specbar { font-size: 0.78rem; }
.specbar .lab { display: flex; justify-content: space-between; color: var(--muted); }
.specbar .lab b { color: var(--ink); font-weight: 700; }
.specbar .track { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 3px; }
.specbar .fill { height: 100%; background: var(--brand-strong); border-radius: inherit; }

/* Breakdown */
.breakdown { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.breakdown th, .breakdown td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.breakdown thead th { border-top: 0; font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.breakdown tbody th { font-weight: 700; width: 28%; font-family: var(--display); font-size: 0.88rem; }
.breakdown .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; vertical-align: 0; }
.breakdown td.code { font: 800 1rem var(--display); white-space: nowrap; letter-spacing: .03em; }
.breakdown tr.warn td:last-child { color: #8a5300; }
.breakdown tr.hl { background: var(--brand-tint); }
@media (prefers-color-scheme: dark) { .breakdown tr.warn td:last-child { color: #ffcf7a; } }
.flags { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions .btn-cta { flex: 1 1 260px; }

/* Compare */
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp .panel h3 { font: 800 1.15rem var(--display); letter-spacing: .03em; margin-bottom: 8px; word-break: break-all; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.cmp-table th, .cmp-table td { padding: 9px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.cmp-table thead th { border-top: 0; color: var(--muted); font-size: .78rem; }
.cmp-table tr.diff { background: color-mix(in srgb, var(--cta) 9%, var(--surface)); }
.cmp-table tr.diff th::after { content: "differs"; margin-left: 8px; font-size: .7rem; font-weight: 700; color: var(--cta); }
.cmp-table td b { font-family: var(--display); }
@media (max-width: 640px) { .cmp { grid-template-columns: 1fr; } }

/* Guide */
.starter-diagram { width: 100%; height: auto; max-height: 260px; }
.starter-diagram .np { animation: pulse 2.4s ease-in-out 2; }
@keyframes pulse { 50% { stroke-width: 7; } }
.tips { padding-left: 20px; color: var(--ink-2); }
.tips li { margin: 6px 0; }
.gloss dt { font-weight: 700; font-family: var(--display); margin-top: 12px; }
.gloss dd { margin: 3px 0 0; color: var(--ink-2); }
