/* cdBurner — "optical mastering lab" dark theme with holographic CD-spectrum accents. */
:root {
  --bg: #08080d; --bg-elev: #0e0e17; --bg-card: #13131f; --bg-card-hover: #181826;
  --ink: #f3efe4; --muted: #9a9ab2; --muted-dim: #6a6a82;
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.18);
  --cyan: #22d3ee; --violet: #a855f7; --magenta: #ec4899; --amber: #fbbf24; --mint: #34d399; --danger: #ff5d6c;
  --spectrum: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta), var(--amber), var(--mint));
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font-body); color: var(--ink); min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(168,85,247,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34,211,238,.08), transparent 55%), var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
.grain { position: fixed; inset: 0; z-index: 9000; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.mono { font-family: var(--font-mono); }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between;
  padding: 1rem clamp(1rem,4vw,3rem); background: rgba(8,8,13,.72); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); }
.brand-disc { width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--violet), var(--magenta), var(--amber), var(--mint), var(--cyan));
  box-shadow: inset 0 0 0 5px var(--bg), 0 0 14px rgba(168,85,247,.5); animation: spin 6s linear infinite; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: .04em; }
.brand-name span { color: var(--muted); }
.agent-chip { display: flex; align-items: center; gap: .5rem; font-family: var(--font-mono); font-size: .78rem;
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.agent-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-dim); }
.agent-chip[data-state="off"] .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.agent-chip[data-state="on"] { color: var(--mint); border-color: rgba(52,211,153,.4); }
.agent-chip[data-state="on"] .dot { background: var(--mint); box-shadow: 0 0 8px var(--mint); animation: pulse 1.6s ease-in-out infinite; }

/* layout — full-width shell: [ ad rail ] [ app ] [ ad rail ], with a leaderboard below */
.shell { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr) minmax(0, 280px);
  gap: clamp(1rem, 2vw, 2.2rem); width: 100%; max-width: 2400px; margin: 0 auto;
  padding: clamp(1.2rem,3vw,2.5rem) clamp(1rem,3vw,2.5rem); align-items: start; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 420px; gap: clamp(1.5rem,3vw,3rem); align-items: start; }

.ad-rail { position: sticky; top: 88px; align-self: start; }
.ad-rail .ad-slot { min-height: 600px; }
.ad-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255,255,255,.014);
  color: var(--muted-dim); font-family: var(--font-mono); }
.ad-slot .ad-tag { font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; }
.ad-slot .ad-size { font-size: .68rem; opacity: .6; }
.ad-leaderboard { width: 100%; max-width: 1920px; margin: 0 auto; padding: 0 clamp(1rem,3vw,2.5rem); }
.ad-leaderboard .ad-slot { min-height: 110px; }
.hero { margin-bottom: 1.8rem; }
.kicker { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--cyan); margin: 0 0 .7rem; }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem,4.5vw,3.2rem); line-height: .96; margin: 0 0 .8rem; }
.lede { color: var(--muted); font-size: 1.02rem; max-width: 50ch; margin: 0; line-height: 1.55; }
.hint { color: var(--muted); font-size: .86rem; line-height: 1.5; }

/* buttons */
.ghost-btn { font-family: var(--font-body); font-weight: 600; font-size: .9rem; color: var(--ink); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: .55rem 1.1rem; cursor: pointer; transition: .2s; }
.ghost-btn:hover { border-color: var(--ink); background: rgba(255,255,255,.04); }
.ghost-btn.sm { padding: .35rem .8rem; font-size: .82rem; }
.link-btn { background: none; border: none; color: var(--cyan); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.primary-btn { display: inline-block; text-align: center; text-decoration: none; font-family: var(--font-display); font-weight: 700;
  font-size: 1.05rem; letter-spacing: .05em; text-transform: uppercase; color: #0a0a12; border: none; border-radius: 999px;
  padding: .8rem 1.7rem; cursor: pointer; background: var(--spectrum); background-size: 220% 100%;
  box-shadow: 0 10px 34px rgba(168,85,247,.28); transition: background-position .5s, transform .12s, filter .2s; }
.primary-btn:hover { background-position: 100% 0; transform: translateY(-1px); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn.big { width: 100%; padding: 1rem; font-size: 1.2rem; margin-top: 1rem; }
.primary-btn:disabled { filter: grayscale(.8) brightness(.6); cursor: not-allowed; box-shadow: none; }

/* agent panel (disconnected) */
.agent-panel { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 20px; padding: 1.8rem; }
.agent-panel-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.4rem; }
.ap-icon { font-size: 1.8rem; color: var(--cyan); line-height: 1; }
.agent-panel h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; margin: 0 0 .4rem; }
.steps { color: var(--muted); margin: 1.4rem 0 1rem; padding-left: 1.2rem; line-height: 2; font-size: .92rem; }
.steps code:not(.addr) { font-family: var(--font-mono); font-size: .82rem; color: var(--ink); background: rgba(255,255,255,.05); border: 1px solid var(--line); padding: .1rem .45rem; border-radius: 7px; }

/* shared "address" chip — the agent endpoint, rendered identically in the setup steps and the footer */
.addr { display: inline-flex; align-items: center; gap: .45em; font-family: var(--font-mono); font-size: .82rem;
  color: var(--ink); background: rgba(255,255,255,.05); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: .14em .6em; white-space: nowrap; }
.addr::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--spectrum); box-shadow: 0 0 7px rgba(168,85,247,.55); }
/* the endpoint dot lights up (spectrum) once the agent connects; dim until then */
body[data-connected="0"] .addr::before { background: var(--muted-dim); box-shadow: none; }
.steps a { color: var(--cyan); }
.ap-note { font-size: .72rem; color: var(--muted-dim); letter-spacing: .04em; }

/* burn UI */
/* Spread the controls horizontally: Drive spans the top, Source + Options sit side by side. */
.burn-ui { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1.2rem 1.4rem; align-items: start; }
.burn-ui > .card:first-child,
.burn-ui > #burnError,
.burn-ui > #burnBtn,
.burn-ui > #isoBtn { grid-column: 1 / -1; }
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; padding: 1.3rem 1.4rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin: 0; letter-spacing: .02em; }

.drive-list { display: flex; flex-direction: column; gap: .6rem; }
.drive-card { display: flex; align-items: center; gap: .9rem; text-align: left; cursor: pointer; width: 100%;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; color: var(--ink); transition: .2s; }
.drive-card:hover { background: var(--bg-card-hover); }
.drive-card.is-selected { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.drive-card .d-letter { font-family: var(--font-mono); font-size: 1.1rem; color: var(--cyan); min-width: 2.5em; }
.drive-card .d-name { font-weight: 600; }
.drive-card .d-sub { font-size: .78rem; color: var(--muted); }
.empty-note { color: var(--muted); font-size: .9rem; padding: .4rem 0; }

.media-status { margin-top: 1rem; padding: .85rem 1rem; border-radius: 12px; font-size: .9rem; border: 1px solid var(--line); }
.media-status.blank { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.06); }
.media-status.warn { border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.06); color: var(--amber); }
.media-status b { font-family: var(--font-mono); }

.head-actions { display: flex; gap: .5rem; }
.disc-actions { display: flex; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.disc-details { margin-top: .9rem; }
.disc-details summary { cursor: pointer; color: var(--muted-dim); font-size: .8rem; }
.disc-details summary:hover { color: var(--ink); }
.disc-details dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: .8rem 0 .2rem; font-size: .82rem; }
.disc-details dt { color: var(--muted); }
.disc-details dd { margin: 0; font-family: var(--font-mono); color: var(--ink); }

.source-buttons { display: grid; grid-template-columns: repeat(2,1fr); gap: .7rem; }
.source-btn { display: flex; flex-direction: column; gap: .2rem; cursor: pointer; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 12px; padding: 1rem; color: var(--ink); transition: .2s; }
.source-btn:hover { background: var(--bg-card-hover); transform: translateY(-2px); }
.source-btn.is-active { border-color: var(--cyan); }
.source-btn b { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.source-btn span { font-size: .76rem; color: var(--muted); }
.source-info { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.source-info ul { margin: .4rem 0 0; padding-left: 1.1rem; font-family: var(--font-mono); font-size: .8rem; color: var(--ink); max-height: 8em; overflow: auto; }
.source-info .total { color: var(--cyan); font-family: var(--font-mono); }
.source-info .over { color: var(--danger); }
#sourceCard.drag-over { outline: 2px dashed var(--cyan); outline-offset: 4px; }
.drop-hint { color: var(--muted-dim); font-size: .76rem; margin: .7rem 0 0; }
.src-head { font-size: .9rem; color: var(--muted); margin-bottom: .55rem; }
.src-head .total { color: var(--cyan); font-family: var(--font-mono); }
.src-note { color: var(--muted-dim); font-size: .78rem; }
.compile-list { list-style: none; margin: 0; padding: 0; max-height: 12em; overflow: auto; display: flex; flex-direction: column; gap: .25rem; }
.compile-list li { display: flex; align-items: center; gap: .5rem; font-family: var(--font-mono); font-size: .78rem; background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .55rem; }
.compile-list .ci-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.compile-list .ci-size { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.compile-list .ci-btn { background: none; border: none; color: var(--muted-dim); cursor: pointer; font-size: .9rem; padding: 0 .15rem; line-height: 1; }
.compile-list .ci-btn:hover { color: var(--ink); }
.capacity { margin-top: 1rem; }
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.cap-target { background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-family: var(--font-mono); font-size: .76rem; padding: .25rem .4rem; }
.cap-bar { height: 9px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.cap-fill { height: 100%; width: 0; background: var(--spectrum); transition: width .3s ease; }
.cap-fill.over { background: var(--danger); }

.history { margin-top: 1.3rem; }
.history summary { cursor: pointer; color: var(--muted-dim); font-size: .8rem; }
.history summary:hover { color: var(--ink); }
.history-list { list-style: none; margin: .7rem 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 14em; overflow: auto; }
.history-list li { display: flex; align-items: center; gap: .5rem; font-size: .76rem; color: var(--muted); }
.history-list .h-res { width: 1.1em; text-align: center; }
.history-list li.h-done .h-res { color: var(--mint); }
.history-list li.h-error .h-res { color: var(--danger); }
.history-list li.h-canceled .h-res { color: var(--amber); }
.history-list .h-name { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list .h-meta { color: var(--muted-dim); font-family: var(--font-mono); font-size: .68rem; white-space: nowrap; }
.history-actions { display: flex; gap: .5rem; }

.field { display: flex; flex-direction: column; gap: .4rem; font-size: .82rem; color: var(--muted); margin-top: 1rem; }
.text-input { width: 100%; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .9rem; color: var(--ink); font-family: var(--font-body); font-size: .95rem; }
.text-input:focus { outline: none; border-color: var(--cyan); }
select.text-input { font-family: var(--font-mono); }
.check { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; font-size: .9rem; color: var(--muted); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--cyan); }
.form-error { color: var(--danger); font-size: .9rem; margin: .4rem 0 0; }
#isoBtn { width: 100%; margin-top: .7rem; }
#printBtn { width: 100%; margin-top: 1rem; }
#nextCopyBtn { width: 100%; margin-top: 1.2rem; }
.manual-pick { display: flex; gap: .5rem; margin-top: .8rem; }
.manual-pick .text-input { flex: 1; font-family: var(--font-mono); font-size: .82rem; }
.manual-pick .ghost-btn { white-space: nowrap; }
.pick-error { color: var(--danger); font-size: .82rem; margin: .6rem 0 0; }
.advanced { margin-top: .9rem; }
.advanced summary { cursor: pointer; color: var(--muted-dim); font-size: .8rem; }
.advanced summary:hover { color: var(--ink); }
.advanced .manual-pick { margin-top: .7rem; margin-bottom: .2rem; }

/* right stage */
.stage { position: sticky; top: 90px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 22px; padding: 1.8rem; }
.disc-stage { position: relative; width: 280px; height: 280px; margin: 0 auto 1.4rem; }
.disc-stage .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 5; }
.ring-fill { fill: none; stroke: url(#ringGrad); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.disc { position: absolute; inset: 40px; border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.05) 0 1px, transparent 1px 2.6px),
    conic-gradient(from 0deg, var(--cyan), var(--violet), var(--magenta), var(--amber), var(--mint), var(--cyan));
  box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 0 32px rgba(0,0,0,.5); animation: spin 9s linear infinite; }
.disc::after { content: ""; position: absolute; inset: 33%; border-radius: 50%;
  background: radial-gradient(circle, var(--bg) 0 36%, rgba(255,255,255,.14) 36% 43%, var(--bg-elev) 43%); box-shadow: inset 0 0 10px rgba(0,0,0,.7); }
.disc-shine { position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: screen; pointer-events: none;
  background: conic-gradient(from 210deg, transparent 0 16%, rgba(255,255,255,.42) 24%, transparent 33% 100%); animation: spin 9s linear infinite reverse; }
.disc.is-burning, .disc.is-burning + .disc-shine { animation-duration: 1.3s; }
.disc-label { position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%); display: flex; flex-direction: column;
  align-items: center; gap: .1rem; text-align: center; width: 58%; pointer-events: none; z-index: 2; }
.disc-media { font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.disc-text { font-family: var(--font-mono); font-size: .6rem; color: var(--muted); max-height: 2.4em; overflow: hidden; }
.ring-pct { position: absolute; top: 57%; left: 50%; transform: translate(-50%,-50%); font-family: var(--font-mono);
  font-size: 1.5rem; font-weight: 700; z-index: 3; }

.stage-phase { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin: 0 0 .3rem; }
.stage-message { color: var(--muted); font-size: .82rem; margin: 0 0 1rem; min-height: 1.1em; }
.log-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.log-list li { font-family: var(--font-mono); font-size: .76rem; color: var(--muted-dim); display: flex; gap: .5rem; }
.log-list li::before { content: "›"; color: var(--cyan); }
.log-list li.done::before { content: "✓"; color: var(--mint); }

.result-box { margin-top: 1.2rem; border-radius: 14px; padding: 1rem 1.2rem; font-size: .9rem; }
.result-box .result-title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; margin: 0 0 .4rem; }
.result-box.ok { border: 1px solid rgba(52,211,153,.4); background: rgba(52,211,153,.06); }
.result-box.err { border: 1px solid rgba(255,93,108,.4); background: rgba(255,93,108,.06); color: var(--danger); }
#newBurnBtn { margin-top: 1.2rem; width: 100%; }
.ghost-btn.danger { border-color: rgba(255,93,108,.4); color: var(--danger); }
.ghost-btn.danger:hover { border-color: var(--danger); background: rgba(255,93,108,.08); }
#cancelBtn { margin-top: 1.2rem; width: 100%; }

.footer { display: flex; justify-content: space-between; align-items: center; max-width: 1920px; margin: 1.5rem auto 1.5rem;
  padding: 1.4rem clamp(1rem,3vw,2.5rem) 0; border-top: 1px solid var(--line); color: var(--muted-dim); font-size: .8rem; }
.foot-agent { display: inline-flex; align-items: center; gap: .55rem; }
.foot-agent-label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-dim); }
.foot-dl { color: var(--cyan); text-decoration: none; font-size: .82rem; font-weight: 600; }
.foot-dl:hover { text-decoration: underline; }

/* update bar — only shown once a version check confirms a newer agent (JS clears [hidden]) */
.update-bar[hidden] { display: none; }
.update-bar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  max-width: 1180px; margin: .9rem auto 0; padding: .7rem 1.1rem;
  border: 1px solid rgba(168,85,247,.4); border-radius: 12px;
  background: linear-gradient(90deg, rgba(34,211,238,.10), rgba(168,85,247,.12)); }
.update-bar .ub-dot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--spectrum); color: #0a0a12; font-weight: 700; font-size: .8rem; }
.update-bar .ub-text { color: var(--ink); font-size: .9rem; flex: 1 1 auto; }
.update-bar .ub-btn { font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #0a0a12; border: none; border-radius: 999px; padding: .45rem 1.1rem; cursor: pointer;
  background: var(--spectrum); background-size: 220% 100%; transition: background-position .5s, transform .12s; }
.update-bar .ub-btn:hover { background-position: 100% 0; transform: translateY(-1px); }
.update-bar .ub-btn:disabled { opacity: .55; cursor: default; transform: none; }
.update-bar .ub-status { color: var(--muted); font-size: .8rem; flex-basis: 100%; }

/* download fallback (ZIP / GitHub / chrome://downloads tip) */
.dl-fallback { font-size: .82rem; color: var(--muted); line-height: 1.55; margin: .7rem 0 0; }
.dl-fallback a { color: var(--cyan); }
.dl-fallback code { font-family: var(--font-mono); font-size: .9em; background: rgba(255,255,255,.06); padding: .05rem .3rem; border-radius: 4px; }

/* state visibility */
body[data-connected="0"] .burn-ui { display: none; }
body[data-connected="1"] .agent-panel { display: none; }
body[data-burning="1"] .burn-ui { opacity: .4; pointer-events: none; }
body[data-burning="1"] .ring-pct { display: block !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .disc,.disc-shine,.brand-disc { animation: none; } * { transition-duration: .01ms !important; } }
/* Hide the side ad rails when there isn't room for skyscrapers + the app. */
@media (max-width: 1200px) { .shell { grid-template-columns: 1fr; max-width: 1280px; } .ad-rail { display: none; } }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } .stage { position: static; order: -1; } .source-buttons { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .burn-ui { grid-template-columns: 1fr; } }
