/* Answer dock: situation chip, textarea, timer, submit. Sits right above the on-screen keyboard. */

/* Split dock (base.css): the situation + input scroll, the clock and SUBMIT stay pinned at any height. */
.panel.answer-dock { gap: 10px; padding-top: 18px; }
.answer-dock .dock-body { gap: 10px; }
.answer-dock .dock-foot { gap: 6px; }

.timer-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
.timer-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-cyan), #7dfcff);
  box-shadow: 0 0 12px var(--c-cyan);
  transform-origin: 0 50%;
  transition: transform 1s linear;
}
.timer-bar-fill.is-urgent { background: var(--c-red); box-shadow: 0 0 14px var(--c-red); animation: urgent-blink 0.5s steps(2) infinite; }
@keyframes urgent-blink { 50% { opacity: 0.55; } }

.situation-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 204, 0, 0.4);
  background: rgba(255, 204, 0, 0.08);
  text-align: left;
  color: var(--c-text);
}
.situation-chip-label {
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-yellow);
}
.situation-chip-text { font-size: 0.98rem; font-weight: 600; line-height: 1.32; }
.situation-chip.is-collapsed .situation-chip-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 0.88rem;
}
.situation-chip.is-collapsed .situation-chip-label { display: none; }
.situation-chip.is-collapsed { padding: 8px 10px; }

.answer-input-wrap { position: relative; }
.answer-input { min-height: 76px; }
.answer-sent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--c-green);
  background: rgba(3, 26, 18, 0.94);
  box-shadow: 0 0 22px rgba(0, 255, 136, 0.3);
  animation: sent-slam 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.5) both;
}
.answer-sent-tick {
  flex: none;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--c-green);
  color: #02140c;
  font-weight: 900;
}
.answer-sent-text {
  font-size: 0.92rem;
  font-style: italic;
  color: #d5ffe9;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
@keyframes sent-slam { from { opacity: 0; transform: scale(1.12); } }

.answer-foot { display: flex; align-items: center; gap: 12px; }
.answer-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 0.76rem; color: var(--c-dim); }
.answer-ready { color: var(--c-green); font-weight: 600; }
.answer-hint { font-size: 0.72rem; color: var(--c-faint); text-align: center; }
.answer-submit { min-width: 138px; }

.timer-ring { position: relative; width: 48px; height: 48px; flex: none; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-track { fill: rgba(9, 11, 28, 0.6); stroke: rgba(255, 255, 255, 0.12); stroke-width: 4; }
.timer-ring-fill {
  fill: none;
  stroke: var(--c-cyan);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
  filter: drop-shadow(0 0 4px var(--c-cyan));
}
.timer-ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
}
.timer-ring.is-urgent .timer-ring-fill { stroke: var(--c-red); filter: drop-shadow(0 0 5px var(--c-red)); }
.timer-ring.is-urgent .timer-ring-text { color: var(--c-red); animation: urgent-pop 1s ease-out infinite; }
@keyframes urgent-pop { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* Keyboard up: every pixel counts. */
.hud.kb-open .answer-input { min-height: 56px; }
@media (orientation: portrait) {
  .hud.kb-open .answer-dock { gap: 8px; padding-top: 12px; padding-bottom: 8px; max-height: 62%; }
}

@media (orientation: landscape) and (min-width: 700px) {
  .timer-bar { border-radius: 0; top: auto; bottom: 0; height: 6px; }
  .situation-chip-text { font-size: 1.08rem; }
  .answer-input { min-height: 120px; }
  .panel.answer-dock { gap: 14px; padding-top: calc(var(--topbar-h) + var(--safe-t) + 8px); }
}

/* Phone landscape: ~375 px of height for the whole show. The sidebar keeps SUBMIT and the clock pinned at the
   bottom (dock-split) and spends what is left on the situation and the input, so nothing needs scrolling to reach. */
@media (orientation: landscape) and (max-height: 500px) {
  /* The top-bar chips (mute, settings) float over the sidebar: start below them, not below the whole bar. */
  .panel.answer-dock {
    gap: 10px;
    padding-top: calc(52px + var(--safe-t));
    padding-bottom: calc(10px + var(--safe-b));
  }
  .answer-dock .dock-body { gap: 8px; }
  .situation-chip { padding: 8px 10px; }
  .situation-chip-text { font-size: 0.96rem; line-height: 1.26; }
  .answer-input { min-height: 84px; }
  .answer-cast { gap: 6px; }
  /* A hardware keyboard is unlikely on a phone held sideways; the hint is not worth a line here. */
  .answer-hint { display: none; }
  .timer-ring { width: 40px; height: 40px; }
  .answer-foot { gap: 10px; }
  .answer-submit { min-width: 112px; }
  .btn.answer-submit { min-height: 44px; }
}
/* Phone landscape + keyboard: the top bar is gone (chrome.css), the sidebar starts at the very top and the
   situation scrolls inside the body while the input and SUBMIT stay put. */
@media (orientation: landscape) and (max-height: 500px) {
  .hud.kb-open .answer-dock { gap: 8px; padding-top: calc(8px + var(--safe-t)); padding-bottom: calc(6px + var(--safe-b)); }
  .hud.kb-open .answer-dock .dock-body { gap: 6px; }
  /* `rows="3"` is the textarea's intrinsic height, and a min-height cannot shrink it — with ~185 px of visual viewport
     the box overflowed the body and was cut off against SUBMIT. Cap it instead: one line here, the rest scrolls. */
  .hud.kb-open .answer-input { min-height: 44px; height: 44px; max-height: 44px; }
  .hud.kb-open .situation-chip-text { font-size: 0.88rem; }
}

/* Spectator: the situation and the clock, no input. */
.answer-watch {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--field);
  border: 1.5px dashed var(--field-line);
  color: var(--c-dim);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}
.answer-watch-icon { font-size: 1.3rem; }

/* Twist rule (CONTRACTS §9.5): hazard-green chip under the situation. */
.twist-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(182, 255, 59, 0.55);
  background: rgba(182, 255, 59, 0.08);
  font-size: 0.88rem;
  line-height: 1.3;
}
.twist-chip-kicker {
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b6ff3b;
}
.twist-chip-title { font-weight: 800; }
.twist-chip-rule { color: var(--c-dim); }
.answer-chars.is-over { color: var(--c-red); font-weight: 700; }

/* A TV screen's view of the typing room: every contestant, typing dots or a tick. */
.answer-cast { display: flex; flex-wrap: wrap; gap: 8px; }
.cast-chip {
  --seat: var(--c-cyan);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--seat) 55%, transparent);
  background: rgba(9, 11, 28, 0.7);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.cast-chip-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--seat) 30%, #0a0b1c); font-size: 1.1rem; }
.cast-chip-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.86rem; }
.cast-chip-mark { min-width: 1em; color: var(--seat); font-weight: 900; }
.cast-chip.is-ready { border-color: var(--c-green); background: rgba(0, 255, 136, 0.12); }
.cast-chip.is-ready .cast-chip-mark { color: var(--c-green); }
.cast-chip.is-offline { opacity: 0.45; }
