/* Nói Chuyện web: dark, edge-to-edge captions. Same look as the Android app (Nói Chuyện Pixel). */
:root {
  --bg: #0b0b0b;
  --text: #ffffff;
  --grey: #9a9a9a;
  --amber: #ffc857;
  --red: #ff8a80;
  --on: #1f7a33;
  --off: #b3261e;
  --frac: 0.075;                       /* text size as a fraction of the shorter screen side (as on Android) */
  --btn: 60px;                         /* the two floating round buttons */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.defs { position: absolute; width: 0; height: 0; }
[hidden] { display: none !important; }

#scroll {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#scroll::-webkit-scrollbar { display: none; }
#scroll { display: flex; flex-direction: column; }
#column {
  margin-top: auto;          /* short content sits at the bottom; tall content scrolls (captions are plain blocks, so a float inside one does not stretch it) */
  padding: calc(var(--sat) + 2vmin) calc(4vmin + var(--sar)) calc(4vmin + var(--sab)) calc(4vmin + var(--sal));
}
.line {
  font-size: calc(var(--frac) * 100vmin);
  line-height: 1.12;
  margin: 0 0 calc(var(--frac) * 50vmin) 0;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.line.error { color: var(--amber); }
.line.hint { color: #555; }
.line.pending { color: var(--grey); }
.dots span {
  display: inline-block; width: 0.28em; height: 0.28em; margin-right: 0.22em;
  border-radius: 50%; background: var(--grey); opacity: 0.35;
  animation: blink 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
.dots.think span { background: var(--amber); }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: 0.8; } }

/* Soft fade of the oldest lines at the very top edge only (no strip behind the buttons). */
#strip {
  position: fixed; left: 0; right: 0; top: 0;
  height: calc(var(--sat) + 30px);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(11,11,11,0.95) 0, rgba(11,11,11,0.6) 45%, rgba(11,11,11,0) 100%);
}
/* Two small round buttons floating top right. Text beside them is wrapped narrower by app.js (a float spacer per line), never under them. */
#floaters {
  position: fixed; z-index: 5;
  top: calc(var(--sat) + 8px); right: calc(var(--sar) + 8px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  max-width: calc(100vw - var(--sal) - var(--sar) - 16px);
}
#buttons { display: flex; gap: 8px; }
.round {
  width: var(--btn); height: var(--btn); min-width: var(--btn); border-radius: 50%;
  margin: 0; padding: 0; cursor: pointer;
  border: 2px solid rgba(255,255,255,0.92); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.round svg { width: 100%; height: 100%; display: block; }
#gear { background: rgba(58,58,58,0.92); }
#mic.on { background: rgba(31,122,51,0.92); }
#mic.off { background: rgba(179,38,30,0.92); }
#mic.on .slash { display: none; }
.round:active { filter: brightness(1.25); }
#problem {
  text-align: right; font-weight: 700; padding: 4px 10px; border-radius: 10px;
  font-size: calc(0.03 * 100vmin); line-height: 1.2; color: var(--red);
  background: rgba(11,11,11,0.92); max-width: min(60vw, 20rem);
}
#problem.amber { color: var(--amber); }
.gap { float: right; }          /* invisible spacer app.js inserts at the start of a caption: lines beside the buttons wrap narrower */

#sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; background: rgba(0,0,0,0.35); }
#panel {
  width: 100%; background: #1f1f1f; padding: 4vmin calc(4vmin + var(--sar)) calc(6vmin + var(--sab)) calc(4vmin + var(--sal));
  max-height: 100%; overflow-y: auto;
}
#panel h1 { margin: 0 0 2vmin; font-size: calc(0.055 * 100vmin); }
.row { display: flex; align-items: center; margin-top: 2vmin; }
#sizeLabel { flex: 1; text-align: center; font-weight: 700; font-size: calc(0.05 * 100vmin); }
.big {
  min-height: 64px; font-size: calc(0.05 * 100vmin); font-weight: 700; color: #fff;
  background: #3a3a3a; border: 0; border-radius: 12px; padding: 3.5vmin; cursor: pointer;
  font-family: inherit;
}
.row .big { width: 22vmin; min-width: 88px; height: 15vmin; min-height: 72px; }
.wide { display: block; width: 100%; height: 15vmin; min-height: 72px; margin-top: 2vmin; }
#clear { margin-top: 4vmin; }
.big:active { filter: brightness(1.3); }
#version { margin: 3vmin 0 0; color: #888; text-align: center; font-size: calc(0.035 * 100vmin); }
button:focus-visible { outline: 3px solid #8ab4ff; outline-offset: 2px; }
.nosleep { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0.02; pointer-events: none; }
