/* PqJwtPlayground — "cipher terminal" aesthetic.
   Deep ink background, phosphor-green + amber accents, monospace display.
   To God be the glory — 1 Corinthians 10:31. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap');

:root {
    --ink:        #0a0e0d;
    --ink-2:      #0f1614;
    --panel:      #111b18;
    --panel-2:    #14211d;
    --line:       #1f322c;
    --text:       #d7e4de;
    --dim:        #6f8a80;
    --phos:       #4ef0a8;   /* phosphor green */
    --phos-dim:   #2bbd80;
    --amber:      #f0b24e;
    --red:        #ff6b6b;
    --shadow:     0 18px 50px rgba(0,0,0,.55);
    --code-bg:    #050a08;   /* token/JSON/code blocks — kept dark in both themes */
    --chip-bg:    #0c1512;   /* chips, prop cards, kbd, inline code */
    --track-bg:   #06100c;   /* size-bar track */
    --body-bg:
        radial-gradient(1200px 600px at 80% -10%, #11201b 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 110%, #161f12 0%, transparent 55%),
        var(--ink);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--body-bg);
    color: var(--text);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* subtle scanline texture */
body::before {
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px);
    mix-blend-mode: overlay;
}

.shell { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 28px 22px 60px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.glyph { color: var(--phos); font-size: 22px; text-shadow: 0 0 14px rgba(78,240,168,.6); }
.brandtext { font-family: 'Space Mono', monospace; letter-spacing: .14em; font-size: 13px; color: var(--dim); }
.brandtext strong { color: var(--text); }
.badge {
    font-size: 11px; letter-spacing: .08em; color: var(--amber);
    border: 1px solid #3a2f12; background: #1a1407; padding: 5px 10px; border-radius: 999px;
}

.warnbar {
    border: 1px solid #3a2f12; background: linear-gradient(180deg, #1c1606, #140f04);
    color: #e9cd92; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; margin-bottom: 22px;
}
.warnbar code { color: var(--amber); background: #241a07; padding: 1px 6px; border-radius: 5px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line); border-radius: 16px; padding: 20px;
    box-shadow: var(--shadow); animation: rise .5s ease both;
}
.card.span2 { grid-column: 1 / -1; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

h2 { margin: 0 0 16px; font-family: 'Space Mono', monospace; font-size: 16px; letter-spacing: .03em; display: flex; align-items: baseline; gap: 10px; }
.num { color: var(--phos); font-size: 12px; border: 1px solid var(--phos-dim); border-radius: 6px; padding: 2px 7px; }
h3 { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 16px 0 6px; }

label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 12px; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); white-space: nowrap; }
.check input { width: auto; }

input, textarea {
    width: 100%; margin-top: 5px; background: var(--ink-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
    font-family: inherit; font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--phos-dim); box-shadow: 0 0 0 3px rgba(78,240,168,.12); }
textarea { resize: vertical; }

button { font-family: 'Space Mono', monospace; cursor: pointer; border-radius: 9px; padding: 10px 16px; font-size: 13px; letter-spacing: .03em; transition: transform .12s, filter .15s, background .15s; }
button:active { transform: translateY(1px); }
button.primary { background: var(--phos); color: #04140c; border: none; font-weight: 700; box-shadow: 0 0 22px rgba(78,240,168,.25); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--phos); border: 1px solid var(--phos-dim); margin-top: 12px; }
button.ghost:hover { background: rgba(78,240,168,.08); }

.output { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 16px; }
.tokenhead { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.chip { background: var(--chip-bg); border: 1px solid var(--line); color: var(--phos); border-radius: 999px; padding: 2px 9px; font-size: 11px; }
pre.token { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 11.5px; color: var(--phos); white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto; }
pre.json { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 11.5px; color: #bfe9d4; white-space: pre-wrap; word-break: break-word; }
pre.small { font-size: 10.5px; max-height: 150px; overflow: auto; }
.mono { color: var(--dim); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.hint { color: var(--dim); font-size: 12px; margin: 0 0 12px; }
.hint.small { font-size: 11px; margin-top: 8px; }
.err { color: var(--red); font-size: 12.5px; }

.result { margin-top: 16px; border-radius: 12px; padding: 14px; border: 1px solid var(--line); }
.result.ok { background: linear-gradient(180deg, #08160f, #0a1d13); border-color: var(--phos-dim); }
.result.bad { background: linear-gradient(180deg, #190a0a, #1d0d0d); border-color: #5a2a2a; }
.resulthead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.status { font-family: 'Space Mono', monospace; font-weight: 700; letter-spacing: .12em; }
.result.ok .status { color: var(--phos); }
.result.bad .status { color: var(--red); }
.msg { color: #ffb4b4; font-size: 12.5px; margin: 6px 0 0; }

table.claims { width: 100%; border-collapse: collapse; margin-top: 4px; }
table.claims td { padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
table.claims td:first-child { color: var(--dim); width: 70px; }

.sizebar { margin-top: 16px; }
.bar { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 12px; }
.bar .lbl { width: 64px; color: var(--dim); }
.bar .track { flex: 1; height: 16px; background: var(--track-bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar .fill { display: block; height: 100%; border-radius: 5px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.fill.c1 { background: #2b6e57; }
.fill.c2 { background: #3a8f6d; }
.fill.c3 { background: linear-gradient(90deg, var(--phos-dim), var(--phos)); }
.bar .val { width: 64px; text-align: right; color: var(--text); }

.kid { margin-left: 14px; color: var(--dim); font-size: 12px; }
.kid code { color: var(--amber); }

.footnote { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11.5px; text-align: center; }
.footnote em { color: var(--phos-dim); font-style: italic; }
.screenreader { position: absolute; left: -9999px; }

@media (max-width: 820px) {
    .grid { grid-template-columns: 1fr; }
    .cols { grid-template-columns: 1fr; }
    .row { flex-direction: column; gap: 0; }
}

/* ── custom-claim editor ───────────────────────────────────────────── */
.claims-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 4px 0 14px; }
.claims-edit legend { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 0 6px; }
.claim-row { display: flex; gap: 8px; margin-bottom: 8px; }
.claim-row .cn { flex: 0 0 38%; }
.claim-row .cv { flex: 1; }
.claim-row input { margin-top: 0; }
button.mini { flex: 0 0 auto; background: transparent; border: 1px solid var(--line); color: var(--dim); border-radius: 8px; padding: 0 12px; font-size: 16px; line-height: 1; }
button.mini:hover { color: var(--red); border-color: #5a2a2a; }
button.mini-add { padding: 6px 12px; font-size: 12px; }

/* ── why-rejected panel ────────────────────────────────────────────── */
.why { margin-top: 6px; }
.why h3 { color: var(--red); margin-top: 4px; }
.why-what { font-family: 'Space Mono', monospace; font-weight: 700; color: #ffd0d0; margin: 2px 0 6px; font-size: 14px; }
.why-why { color: #f0c9c9; font-size: 12.5px; margin: 0 0 10px; line-height: 1.55; }
.why details { border-top: 1px solid #3a2020; padding-top: 8px; }
.why summary { cursor: pointer; color: var(--dim); font-size: 11.5px; letter-spacing: .05em; }
.why .raw { display: block; margin-top: 8px; color: #c89a9a; font-size: 11.5px; background: #160c0c; border: 1px solid #3a2020; border-radius: 8px; padding: 8px 10px; }

/* ── security-properties grid ──────────────────────────────────────── */
.props { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.prop { background: var(--chip-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; position: relative; }
.prop strong { display: block; margin: 4px 0 4px 18px; font-size: 13px; }
.prop p { margin: 0 0 0 18px; color: var(--dim); font-size: 12px; line-height: 1.5; }
.prop .ok-dot, .prop .warn-dot { position: absolute; top: 15px; left: 14px; width: 9px; height: 9px; border-radius: 50%; }
.prop .ok-dot { background: var(--phos); box-shadow: 0 0 10px rgba(78,240,168,.6); }
.prop.warn { border-color: #3a2f12; background: #150f04; }
.prop .warn-dot { background: var(--amber); box-shadow: 0 0 10px rgba(240,178,78,.5); }

@media (max-width: 820px) {
    .props { grid-template-columns: 1fr; }
    .claim-row { flex-wrap: wrap; }
    .claim-row .cn, .claim-row .cv { flex: 1 1 100%; }
    .token, pre.json { font-size: 11px; }
}

/* claims editor: empty state + keyboard hint */
.empty-state { color: var(--dim); font-size: 12px; margin: 2px 0 10px; line-height: 1.5; }
.empty-state code { color: var(--phos); background: var(--chip-bg); padding: 1px 6px; border-radius: 5px; }
kbd { font-family: 'IBM Plex Mono', monospace; font-size: 11px; background: var(--chip-bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text); }

/* ── topbar right cluster + theme toggle ───────────────────────────── */
.topright { display: flex; align-items: center; gap: 12px; }
.themebtn {
    background: var(--chip-bg); color: var(--phos); border: 1px solid var(--line);
    border-radius: 999px; width: 34px; height: 34px; padding: 0; font-size: 15px;
    line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.themebtn:hover { border-color: var(--phos-dim); filter: brightness(1.1); }

/* ── copy buttons ──────────────────────────────────────────────────── */
.copybtn {
    background: transparent; color: var(--phos); border: 1px solid var(--phos-dim);
    border-radius: 7px; padding: 4px 10px; font-size: 11px; letter-spacing: .04em;
}
.copybtn:hover { background: rgba(78,240,168,.08); }
.copybtn.copied { color: #04140c; background: var(--phos); border-color: var(--phos); }
.tokenhead .copybtn { margin-left: auto; }
.keyhead { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; }
.keyhead h3 { margin: 0; }
.keyhead .copybtn { margin-left: auto; }

/* ── "validate in C#" snippet ──────────────────────────────────────── */
.snippet { margin-top: 14px; }
.snippet summary { cursor: pointer; color: var(--phos); font-size: 12px; letter-spacing: .04em; }
.snippet[open] summary { margin-bottom: 8px; }
.snip-wrap { position: relative; }
.snip-wrap .copybtn { position: absolute; top: 8px; right: 8px; z-index: 2; }
pre.code {
    background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 12px 12px 14px; font-size: 11.5px; color: #cfe9da;
    white-space: pre; overflow: auto; max-height: 360px; line-height: 1.5;
}

/* ── "break it" panel ──────────────────────────────────────────────── */
.attacks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
.attack {
    text-align: left; background: var(--chip-bg); color: var(--text);
    border: 1px solid #3a2f12; border-radius: 12px; padding: 11px 13px;
    display: flex; flex-direction: column; gap: 3px; font-family: inherit;
}
.attack:hover { border-color: var(--amber); background: #150f04; }
.attack .at-title { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 12.5px; color: var(--amber); }
.attack .at-hint { color: var(--dim); font-size: 11.5px; line-height: 1.45; }
.attack:disabled { opacity: .45; cursor: not-allowed; }
.attack-did {
    margin: 12px 0 8px; padding: 10px 12px; border-radius: 10px;
    background: #150f04; border: 1px solid #3a2f12; color: #e9cd92; font-size: 12.5px;
}
.attack-did .lead { color: var(--amber); font-weight: 700; font-family: 'Space Mono', monospace; }
@media (max-width: 820px) { .attacks { grid-template-columns: 1fr; } }

/* ── build buttons row + share ─────────────────────────────────────── */
.buildbtns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.buildbtns .ghost { margin-top: 0; }

/* ── comparison table ──────────────────────────────────────────────── */
.cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 6px; }
table.cmp { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 12.5px; }
table.cmp th, table.cmp td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cmp thead th { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--text); border-bottom: 1px solid var(--phos-dim); }
table.cmp tbody th[scope="row"] { font-weight: 600; color: var(--text); width: 22%; }
table.cmp .sub { display: block; color: var(--dim); font-size: 10.5px; font-weight: 400; letter-spacing: .02em; margin-top: 2px; }
table.cmp col, table.cmp .me { background: rgba(78,240,168,.05); }
table.cmp thead th.me { color: var(--phos); border-bottom-color: var(--phos); }
table.cmp td.yes { color: #bfe9d4; }
table.cmp td.no { color: #f2b8b8; }
table.cmp td.warn { color: #eccd92; }
table.cmp td.yes::before { content: "✓ "; color: var(--phos); }
table.cmp td.no::before { content: "✗ "; color: var(--red); }
table.cmp td.warn::before { content: "▲ "; color: var(--amber); font-size: 10px; }

/* ── responsive / mobile polish ────────────────────────────────────── */
@media (max-width: 600px) {
    .shell { padding: 18px 14px 48px; }
    .topbar { flex-wrap: wrap; gap: 10px; }
    .topright { width: 100%; justify-content: space-between; }
    .card { padding: 16px; border-radius: 13px; }
    h2 { font-size: 15px; }
    .buildbtns { flex-direction: column; align-items: stretch; }
    .buildbtns button { width: 100%; }
}

/* ── light theme ───────────────────────────────────────────────────── */
html[data-theme="light"] {
    --ink:      #eef3f0;
    --ink-2:    #ffffff;
    --panel:    #ffffff;
    --panel-2:  #f5f9f7;
    --line:     #d3e0d9;
    --text:     #122019;
    --dim:      #5a6f67;
    --phos:     #0c8a57;
    --phos-dim: #0a7a4d;
    --amber:    #9a6712;
    --red:      #c23b3b;
    --shadow:   0 16px 40px rgba(24,50,38,.12);
    /* Code/token blocks stay dark — a deliberate "editor" surface, like GitHub. */
    --code-bg:  #0c1714;
    --chip-bg:  #eaf3ee;
    --track-bg: #e3ede8;
    --body-bg:
        radial-gradient(1100px 560px at 82% -12%, #e2efe8 0%, transparent 60%),
        radial-gradient(820px 460px at -8% 112%, #e8efdf 0%, transparent 55%),
        var(--ink);
}
html[data-theme="light"] body::before { display: none; } /* drop the scanline on light */
html[data-theme="light"] .glyph { text-shadow: none; }
html[data-theme="light"] button.primary { box-shadow: 0 0 0 transparent; }
/* On light, the token/JSON blocks sit on a dark surface, so keep their bright ink. */
html[data-theme="light"] pre.json { color: #bfe9d4; }
/* Comparison-table cell colours need darker ink to read on the white card. */
html[data-theme="light"] table.cmp td.yes { color: #0b7a4d; }
html[data-theme="light"] table.cmp td.no { color: #b3332f; }
html[data-theme="light"] table.cmp td.warn { color: #8a5e10; }
html[data-theme="light"] table.cmp .me { background: rgba(12,138,87,.07); }
