/* /css/wt.css */

/* =========================
   GLOBAL: one viewport, no scroll
   ========================= */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
}

/* =========================
   PAGE GRID: header + game
   ========================= */
.wt-page {
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

/* ----- HEADER OVERRIDES FOR THIS PAGE ----- */
.wt-page > .site-header {
  background: var(--color-header-bg, #fff) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  z-index: 20;
}
.wt-page > .site-header,
.wt-page > .site-header * {
  color: var(--color-header-text, #111) !important;
}
.wt-page .menu-btn,
.wt-page .theme-toggle {
  color: var(--color-header-text, #111) !important;
  background: transparent !important;
}
.wt-page .site-nav {
  background: var(--color-header-bg, #fff) !important;
  border-bottom: 1px solid var(--color-header-border, #eee);
}

/* =========================
   GAME LAYOUT
   ========================= */
.wt-wrap {
  min-height: 0;
  padding: var(--gap, 16px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--gap, 16px);
}

@media (min-width: 900px) {
  .wt-wrap {
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr;
    align-items: stretch;
  }
}

/* =========================
   PANELS
   ========================= */
.wt-panel {
  min-height: 0;
  overflow: hidden;
  border: none;
  border-radius: 22px;
  background: var(--color-tile-bg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.wt-left {
  display: grid;
  grid-template-rows: 1fr;
}
.wt-image-box {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}
.wt-image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 22px;
  background: transparent;
}
@media (min-width: 900px) {
  .wt-left { height: 100%; aspect-ratio: 1 / 1; max-width: 50vw; }
  .wt-left .wt-image-box { height: 100%; }
}
@media (max-width: 899px) {
  .wt-left { width: 100%; }
  .wt-left .wt-image-box { width: 100%; aspect-ratio: 1 / 1; height: auto; }
}

/* =========================
   RIGHT PANEL
   ========================= */
.wt-right {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-content: stretch;
}

/* ==== FEEDBACK MESSAGE: LARGER AND COLORFUL ==== */
.wt-message {
  padding: 14px 14px 8px;
  min-height: 34px;
  font-size: 1.5rem;
  font-weight: 600;
  opacity: 1;
  text-align: center;
  letter-spacing: 0.01em;
  transition: color 0.18s, background 0.18s, font-size 0.15s;
}
.wt-message.wrong {
  color: #e74c3c !important;
}
.wt-message.correct {
  color: #20b26c !important;
}

.wt-answers {
  min-height: 0;
  padding: 15px 14px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  gap: 10px;
  align-items: start;
  justify-items: stretch;
  align-content: start;
}

.wt-bottom {
  padding: 10px 14px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  align-items: end;
}

.wt-info-left {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  align-items: center;
  align-self: end;
}
.wt-info-right {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  justify-content: end;
  align-items: end;
  align-self: end;
}
.wt-progress-label {
  font-size: 13px;
  opacity: 0.9;
}
.wt-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

/* =========================
   TIMER VISUAL STATES
   ========================= */
#wtTimer {
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
#wtTimer.wt-timer-warn {
  background: rgba(230, 126, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(230, 126, 0, 0.22);
}
#wtTimer.wt-timer-danger {
  background: rgba(231, 76, 60, 0.26);
  box-shadow: inset 0 0 0 1px rgba(231, 76, 60, 0.22);
  animation: wtTimerPulse 900ms ease-in-out infinite;
}
@keyframes wtTimerPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* MOBILE FIXES */
@media (max-width: 899px) {
  .wt-bottom { grid-template-columns: minmax(0, 1fr) auto; }
  .wt-info-left {
    grid-auto-flow: row;
    grid-template-columns: max-content max-content;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 6px;
    align-items: center;
    justify-content: start;
    min-width: 0;
  }
  .wt-progress-label { grid-column: 1 / -1; }
  .wt-info-right .wt-btn {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 0;
    height: auto;
  }
  .wt-message {
    padding: 8px 14px 4px;
    min-height: 18px;
    font-size: 1.0rem;
  }
  .wt-answers { padding: 14px 10px 8px; }
}

/* =========================
   BUTTONS
   ========================= */
.wt-btn {
  border: none;
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text);
  font: 600 14px/1.3 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  cursor: pointer;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 6px 18px rgba(0, 0, 0, 0.18);
  display: block;
  width: 100%;
  height: auto;
  min-height: 36px;
}
.wt-btn:hover { background: rgba(255, 255, 255, 0.16); }
.wt-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.wt-btn-ghost { padding: 6px 10px; font-size: 13px; background: rgba(255, 255, 255, 0.08); box-shadow: none; width: auto; }
.wt-btn-primary { background: rgba(230, 126, 0, 0.35); width: auto; }

/* Answer feedback */
.wt-answer.correct { background: rgba(46, 204, 113, 0.30); }
.wt-answer.wrong   { background: rgba(231, 76, 60, 0.28); }

/* ACCESSIBILITY: hidden H1 */
.wt-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =========================
   GAME OVER MODAL (dialog)
   Minimal, theme-consistent, grid-based
   ========================= */
.wt-gameover-dialog {
  border: none;
  padding: 0;
  border-radius: 18px;
  background: var(--color-tile-bg);
  color: var(--color-text);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
  width: min(520px, calc(100vw - 28px));
}

.wt-gameover-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.wt-gameover-form {
  margin: 0;
  padding: 18px 18px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.wt-gameover-title {
  margin: 0;
  font-family: "Oswald", system-ui, -apple-system, sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.wt-gameover-stats {
  white-space: pre-line;
  font: 600 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  opacity: 0.95;

  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.wt-gameover-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  justify-content: end;
  align-items: center;
}

/* Buttons inside modal reuse existing .wt-btn styles */
/* Ensure modal buttons don't stretch full width (override .wt-btn width:100%) */
.wt-gameover-actions .wt-btn {
  width: auto;
  min-height: 36px;
}

@media (max-width: 520px) {
  .wt-gameover-form {
    padding: 16px 14px 14px;
  }
  .wt-gameover-actions {
    grid-auto-flow: row;
    justify-content: stretch;
  }
  .wt-gameover-actions .wt-btn {
    width: 100%;
  }
}
