/* Kotobay www — Win95 bevels × terminal dark side.
   Dark mode: void black-red desktop, crimson accents, lifted charcoal panels. */

:root {
  --bg: #d8d5ce;
  --text: #1b1b1b;
  --dim: #5c5a55;
  --accent: #9e1828;
  --banner-h: 22px;
  --lcd-bg: #f0d4d4;
  --lcd-fg: #4a1018;

  --face: #c0c0c0;
  --hi: #ffffff;
  --sh: #808080;
  --edge: #2b2b2b;

  --input-bg: #ffffff;
  --input-text: #111111;
  --view-bg: #fbfaf6;
  --bar: #2a0810;
  --bar-text: #fce8ec;
  --hover-bg: #e6e3dc;
  --error: #9c2b1f;
  --scenery-a: #ccc9c2;
  --scenery-b: #d8d5ce;
  --scenery-c: #e4e1da;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #040304;
    --text: #ece4e6;
    --dim: #6e5c60;
    --accent: #ff2838;
    --lcd-bg: #120608;
    --lcd-fg: #ff3040;

    --face: #121014;
    --hi: #262022;
    --sh: #020002;
    --edge: #000000;

    --input-bg: #0a080a;
    --input-text: #ece0e4;
    --view-bg: #0e0c0e;
    --bar: #180810;
    --bar-text: #ff4050;
    --hover-bg: #1a1216;
    --error: #ff5548;
    --scenery-a: #0e0c0e;
    --scenery-b: #161316;
    --scenery-c: #201c20;
  }
}

* { box-sizing: border-box; }

/* ─── top marquee: same crimson as holocron pixel screen ─────────────── */
.topbanner {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  min-height: var(--banner-h);
  background: linear-gradient(
    to top,
    var(--lcd-bg) 0%,
    color-mix(in srgb, var(--lcd-bg) 72%, var(--lcd-fg)) 38%,
    color-mix(in srgb, var(--lcd-bg) 28%, var(--lcd-fg)) 72%,
    var(--lcd-fg) 100%
  );
  border-bottom: 1px solid var(--lcd-bg);
  color: color-mix(in srgb, var(--lcd-fg) 12%, #fff);
  text-shadow:
    1px 1px 0 var(--lcd-bg),
    0 0 10px color-mix(in srgb, var(--lcd-fg) 55%, transparent);
  font: bold 12px/1.2 "Courier New", monospace;
  padding: 4px 0;
  overflow: hidden;
  white-space: nowrap;
}
.topbanner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-conic-gradient(color-mix(in srgb, var(--lcd-bg) 65%, #000) 0% 25%, transparent 0% 50%) 0 0 / 4px 4px,
    repeating-linear-gradient(
      to top,
      color-mix(in srgb, var(--lcd-bg) 50%, transparent) 0 1px,
      transparent 1px 2px
    ),
    linear-gradient(to top, color-mix(in srgb, var(--lcd-bg) 80%, #000) 0%, transparent 100%);
}
.marquee {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: max-content;
  animation: marquee 22s linear infinite;
}
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { animation: none; }
}

html, body { height: 100%; margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 ui-monospace, "Cascadia Mono", "SF Mono", Menlo, "Courier New", monospace;
  position: relative;
}

/* ─── dithered pixel beach (bottom scenery) ──────────────────────────── */
.beach-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100vw;
  height: 320px;
  max-height: 320px;
  pointer-events: none;
  z-index: 0;
  image-rendering: pixelated;
  mask-image: linear-gradient(to top, #000 55%, transparent 100%);
}
.topbanner,
#app,
.footer {
  position: relative;
  z-index: 1;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--text); }
:focus-visible { outline: 1px dotted var(--accent); outline-offset: 1px; }

#app {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Win95 bevels ───────────────────────────────────────────────────── */
.btn {
  background: var(--face);
  color: var(--text);
  border: 2px solid;
  border-color: var(--hi) var(--sh) var(--sh) var(--hi);
  box-shadow: 1px 1px 0 var(--edge);
  border-radius: 0;
  padding: 4px 14px;
  cursor: pointer;
}
.btn:active {
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
  box-shadow: none;
  transform: translate(1px, 1px);
}
.btn:disabled { color: var(--dim); cursor: default; }
.btn.primary { font-weight: bold; }
.btn.primary.flash { background: var(--accent); color: var(--bg); }

input[type="text"], select {
  background: var(--input-bg);
  color: var(--input-text);
  border: 2px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
  border-radius: 0;
  padding: 5px 8px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }
input::placeholder { color: var(--dim); }

/* ─── hero: holocron screen + prompt ─────────────────────────────────── */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 16px 0 4px;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nokia-style bezel: bevel-out plastic, bevel-in glass */
.screen {
  background: var(--face);
  border: 2px solid;
  border-color: var(--hi) var(--sh) var(--sh) var(--hi);
  box-shadow: 1px 1px 0 var(--edge);
  padding: 10px;
  cursor: pointer;
}
.screen canvas {
  display: block;
  width: 224px;   /* 84×63 logical → crisp 4:3 */
  height: 168px;
  image-rendering: pixelated;
  border: 2px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
  background: var(--lcd-bg);
}

pre.ascii {
  margin: 0;
  color: var(--accent);
  font: bold 24px/1.15 ui-monospace, "Courier New", monospace;
  letter-spacing: 1px;
  text-align: left;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
}

.prompt {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}
#url-input { flex: 1; min-width: 0; font-size: 14px; }
#go-btn { white-space: nowrap; }

.hint { color: var(--dim); font-size: 12px; }

/* ─── chrome extension promo ─────────────────────────────────────────── */
.ext-promo {
  width: 100%;
  max-width: 560px;
  margin-top: auto;
  margin-bottom: 0;
  align-self: center;
}
.ext-promo-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--face);
  border: 2px solid;
  border-color: var(--hi) var(--sh) var(--sh) var(--hi);
  box-shadow: 1px 1px 0 var(--edge);
}
.ext-copy { flex: 1 1 200px; min-width: 0; }
.ext-title {
  color: var(--accent);
  font-weight: bold;
  font-size: 12px;
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ext-desc {
  margin: 4px 0 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.45;
}
.ext-cta { flex-shrink: 0; white-space: nowrap; }
.ext-soon {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--dim);
  border: 1px dashed var(--sh);
  padding: 4px 8px;
}

/* result mode: hero docks into a slim top bar */
body.has-result #hero {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  position: sticky;
  top: var(--banner-h);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--sh);
}
body.has-result .brand { gap: 0; }
body.has-result .hint { display: none; }
body.has-result .ext-promo { display: none; }
body.has-result .screen { padding: 3px; }
body.has-result .screen canvas { width: 56px; height: 42px; border-width: 1px; }
body.has-result .prompt { flex: 1; max-width: none; }
body.has-result #status { max-width: none; }

/* ─── status ─────────────────────────────────────────────────────────── */
/* Same width as the url-input + go-btn row, centered under the hero. */
#status {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 9px 14px;
  color: var(--dim);
  border: 1px dashed var(--sh);
  background: color-mix(in srgb, var(--face) 45%, transparent);
  animation: status-in 0.16s ease-out;
}
#status::before { content: "> "; color: var(--accent); text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent); }
#status.error {
  color: color-mix(in srgb, var(--error) 88%, var(--text));
  font-weight: normal;
  border: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
  border-left: 3px solid var(--error);
  background: color-mix(in srgb, var(--error) 8%, var(--bg));
  box-shadow: 0 0 16px color-mix(in srgb, var(--error) 10%, transparent);
}
#status.error::before { content: "! "; color: var(--error); text-shadow: 0 0 8px color-mix(in srgb, var(--error) 45%, transparent); }
@keyframes status-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #status { animation: none; }
}

/* ─── result panel ───────────────────────────────────────────────────── */
#result {
  background: var(--face);
  border: 2px solid;
  border-color: var(--hi) var(--sh) var(--sh) var(--hi);
  box-shadow: 1px 1px 0 var(--edge);
}
.card-head {
  background: var(--bar);
  color: var(--bar-text);
  padding: 4px 10px;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#video-author { font-weight: normal; opacity: 0.75; margin-left: 8px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid var(--sh);
}
.toolbar-copy { margin-left: auto; }
.chk { font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; }
.chk-disabled { color: var(--dim); cursor: not-allowed; opacity: 0.65; }
.chk-disabled input { cursor: not-allowed; }
.video-options-hint a { color: var(--accent); }
#lang-select { max-width: 190px; padding: 3px 4px; }
#find-input { flex: 1; min-width: 110px; padding: 4px 6px; }
#find-count { color: var(--accent); font-size: 12px; white-space: nowrap; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  background: var(--face);
  border: 2px solid;
  border-color: var(--hi) var(--sh) var(--sh) var(--hi);
  box-shadow: 2px 2px 0 var(--edge);
  padding: 2px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  min-width: 72px;
}
.menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 5px 12px;
  cursor: pointer;
}
.menu button:hover { background: var(--bar); color: var(--bar-text); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}
.player-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
}
.player-pane {
  background: #000;
  border: 2px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
}
.player-pane iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}
.video-options {
  background: var(--view-bg);
  border: 2px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
}
.video-options-head {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px solid var(--sh);
}
.video-options-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
}
.video-options-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opt-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.video-options-save-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.export-format {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
}
.video-options-label {
  font-size: 10px;
  font-weight: bold;
  color: var(--dim);
  text-transform: lowercase;
}
.video-options-hint {
  margin: 0;
  font-size: 10px;
  color: var(--dim);
  line-height: 1.4;
}
.speaker {
  flex-shrink: 0;
  color: var(--subject, var(--accent));
  font-size: 11px;
  font-weight: bold;
  min-width: 4.5em;
}
.speaker::after { content: ":"; }
.speaker-pad::after { content: ""; }
#transcript {
  overflow-y: auto;
  max-height: 70vh;
  padding: 8px;
  background: var(--view-bg);
  border: 2px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
}
#transcript p {
  margin: 0 0 8px;
  padding: 2px 4px;
  line-height: 1.6;
  cursor: pointer;
}
#transcript p:hover { background: var(--hover-bg); }
#transcript .line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 2px 4px;
  line-height: 1.5;
  cursor: pointer;
}
#transcript .line:hover { background: var(--hover-bg); }
.transcript-footer {
  margin: 12px 0 0;
  padding: 8px 4px 0;
  border-top: 1px dashed var(--sh);
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
  white-space: pre-wrap;
  cursor: default;
}
.ts {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ts::before { content: ">>"; }
::highlight(find) { background: var(--accent); color: var(--bg); }
::highlight(find-current) { background: var(--text); color: var(--bg); }

.statusbar {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-top: 1px solid var(--sh);
  font-size: 11px;
  color: var(--dim);
}
.statusbar .cell {
  padding: 2px 8px;
  border: 1px solid;
  border-color: var(--sh) var(--hi) var(--hi) var(--sh);
  white-space: nowrap;
}
.statusbar .cell.grow { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.statusbar .cell:empty { display: none; }

/* ─── footer ─────────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  margin-top: auto;
  background: var(--bg);
  color: var(--dim);
  font-size: 11px;
  line-height: 1.8;
  text-align: center;
  padding: 24px 16px 28px;
  border-top: 1px solid var(--sh);
}
.footer a {
  color: var(--dim);
  text-decoration: none;
}
.footer a:hover { color: var(--text); }
.footer-logo {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 20px;
  padding: 0;
  color: var(--dim);
  font: normal 7px/8px ui-monospace, "Courier New", monospace;
  letter-spacing: 0;
  text-align: center;
  text-shadow: none;
  white-space: pre;
}
.footer-roku {
  display: inline-block;
  margin-top: 18px;
  color: var(--dim);
  line-height: 0;
  transition: color 0.15s;
}
.footer-roku:hover { color: var(--text); }
.footer-roku svg {
  display: block;
  height: 13px;
  width: auto;
}

/* ─── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .split { grid-template-columns: 1fr; }
  #transcript { max-height: 50vh; }
  pre.ascii { font-size: 16px; }
  .screen canvas { width: 168px; height: 126px; }
}
@media (max-width: 480px) {
  #app { padding: 16px 10px 40px; }
  .prompt { flex-direction: column; }
  #find-input { min-width: 100%; order: 9; }
  #find-count { order: 10; }
  .statusbar .cell.grow { display: none; }
  body.has-result .brand { display: none; }
}
