/* --- Reset & Layout Global --- */
html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: #f4f4f9;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
}

.game-body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* --- Navigation ---
   .game-nav / .nav-side / .back-button / .lang-selector etc. now live in
   the shared public/shared/css/game-header.css, loaded before this file. */
.score-display {
  font-weight: bold;
  color: #28a745;
  background: #e8f5e9;
  padding: 4px 12px;
  border-radius: 12px;
}

/* --- Game Container --- */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.game-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
}

/* --- Word Card --- */
.word-card {
  width: 100%;
  min-height: 250px;
  background-color: #fff3cd;
  border: 2px solid #ffffff;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  font-weight: 900;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  color: #856404;
  white-space: pre-line;
  word-break: break-word;
}

.word-main-term-wrapper {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.word-main-term {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.word-taboo-container {
  width: 100%;
  margin-top: 8px;
}

.word-taboo-separator {
  width: 100%;
  height: 1px;
  background-color: rgba(0, 0, 0, 0.15);
  margin-bottom: 8px;
}

.word-taboo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  font-size: 1rem;
}

.word-taboo-list .taboo-item {
  background-color: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 4px 10px;
}

.word-card.defi-active {
  position: relative;
}

.word-card.defi-active::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #dc3545;
  box-shadow: 0 0 0 2px #ffffff;
}

.end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.end-title {
  font-size: 2rem;
  font-weight: 900;
}

.end-stats {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  text-align: left;
}

.end-stats li {
  margin: 2px 0;
}

/* --- Controls (Boutons) --- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.action-button {
  width: 100%;
  padding: 18px;
  font-size: 1.2rem;
  font-weight: bold;
  border: none;
  border-radius: 16px;
  color: white;
  cursor: pointer;
}

.action-button:active {
  transform: scale(0.97);
}

#btn-next {
  background-color: #007bff;
}
#btn-pass {
  background-color: #dc3545;
}
#btn-failed {
  background-color: #dc3545;
}
#btn-validate {
  background-color: #28a745;
}
#btn-success {
  background-color: #28a745;
}
#btn-start {
  background-color: #28a745;
}
#btn-resume {
  background-color: #007bff;
}
#btn-restart-keep,
#btn-restart-all {
  background-color: #343a40;
}

/* --- Timer Selector (setup screen) --- */
.timer-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.timer-option {
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: bold;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  color: #495057;
  transition:
    border-color 0.15s,
    background-color 0.15s;
}

.timer-option:hover {
  border-color: #007bff;
}

.timer-option.active {
  border-color: #007bff;
  background-color: #e7f1ff;
  color: #007bff;
}

.timer-selector .custom-timer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.custom-timer-wrap input {
  width: 3.5rem;
  padding: 10px 8px;
  font-size: 1rem;
  font-weight: bold;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  text-align: center;
  color: #495057;
}

.custom-timer-wrap input:focus {
  outline: none;
  border-color: #007bff;
}

.custom-timer-suffix {
  font-weight: bold;
  color: #495057;
}

/* --- Timer Display (during play) --- */
.timer-display {
  display: none;
  width: 100%;
}

.timer-display.visible {
  display: block;
}

.timer-track {
  width: 100%;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: #28a745;
  border-radius: 5px;
  transition:
    width 0.9s linear,
    background-color 0.5s;
}

.timer-bar.warning {
  background: #ffc107;
}
.timer-bar.danger {
  background: #dc3545;
}

.timer-count {
  display: block;
  text-align: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: #495057;
  margin-top: 6px;
}

/* .floating-info-button and .rules-modal* used to live here; every game
   now uses the shared .options-panel from game-header.css instead. */

/* --- Wordpack page layout (docs/PLATFORM_RULES.md sections 6 and 7) ---
   Scoped to body.wp-page (wordplayer.html only): Pyramide also loads this
   file and must not change. Mobile first; landscape puts the controls
   beside the card; desktop and TV sizes follow the screen height. */
body.wp-page {
  height: 100dvh;
  min-height: 0;
  overscroll-behavior: none;
  font-size: max(16px, 2.4dvh);
}

.wp-page .game-nav {
  flex: 0 0 auto;
}

/* Android bars can cover the bottom even when the safe-area inset is 0. */
.wp-page .game-container {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
  padding: 12px max(24px, env(safe-area-inset-right, 0px))
    max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px))
    max(24px, env(safe-area-inset-left, 0px));
}

.wp-page .game-interface {
  min-height: 0;
  gap: 12px;
  padding: 0;
}

.wp-page .word-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.6em;
  font-size: 2.2em;
}

.wp-page .word-main-term {
  font-size: 1em;
  margin-bottom: 0.3em;
}

.wp-page .word-taboo-list,
.wp-page .end-stats {
  font-size: 0.45em;
}

.wp-page .end-screen {
  gap: 0.3em;
}

.wp-page .end-title {
  font-size: 0.8em;
}

.wp-page .controls {
  flex: 0 0 auto;
  gap: 10px;
}

.wp-page .action-button {
  min-height: max(48px, 6.5dvh);
  padding: 0.4em 1em;
  font-size: 1.1em;
  touch-action: manipulation;
}

.wp-page .action-button-soft {
  background-color: #6c757d;
}

.wp-page #btn-continue {
  background-color: #28a745;
}

.wp-page .timer-option,
.wp-page .custom-timer-wrap input,
.wp-page .custom-timer-suffix,
.wp-page .timer-count {
  font-size: 1em;
}

.wp-page .timer-option,
.wp-page .custom-timer-wrap input {
  min-height: max(44px, 5.5dvh);
  padding: 0.3em 0.8em;
}

.wp-page .custom-timer-wrap input {
  width: 4em;
}

/* No hover-only feedback: the active state is what matters. */
.wp-page .timer-option:hover {
  border-color: #dee2e6;
}

.wp-page .timer-option.active {
  border-color: #007bff;
}

.wp-page :focus-visible,
html.tv body.wp-page :focus {
  outline: max(3px, 0.4dvh) solid #ffbf00;
  outline-offset: max(2px, 0.3dvh);
}

/* Landscape (phones ~360px tall up to a TV): card left, controls right. */
@media (orientation: landscape) {
  .wp-page .game-interface {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 3vw;
    row-gap: 8px;
  }

  .wp-page .timer-display {
    grid-column: 1 / -1;
  }

  .wp-page .word-card {
    grid-column: 1;
    grid-row: 2;
  }

  .wp-page .controls {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    max-height: 100%;
    overflow: auto;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .wp-page .game-container {
    padding-top: 6px;
  }

  .wp-page .timer-count {
    display: inline;
    margin: 0;
  }

  .wp-page .word-card {
    font-size: 1.6em;
  }
}

/* Desktop and TV, 960x540 up to 3840x2160: the header grows with the
   screen and everything stays 3% away from the edges (TV overscan). */
@media (min-width: 960px) and (min-height: 500px) {
  .wp-page .game-nav {
    height: auto;
    padding: 3dvh max(3vw, env(safe-area-inset-right, 0px)) 1dvh
      max(3vw, env(safe-area-inset-left, 0px));
  }

  .wp-page .back-button,
  .wp-page .options-button {
    width: max(36px, 6dvh);
    height: max(36px, 6dvh);
    font-size: max(1rem, 3dvh);
  }

  .wp-page .back-button svg,
  .wp-page .options-button svg {
    width: 50%;
    height: 50%;
  }

  .wp-page .nav-banner {
    max-height: max(45px, 7dvh);
  }

  .wp-page .score-display {
    font-size: 1.2em;
    padding: 0.2em 0.7em;
    border-radius: 0.6em;
  }

  .wp-page .game-container {
    padding: 2dvh max(3vw, env(safe-area-inset-right, 0px)) max(40px, 5dvh)
      max(3vw, env(safe-area-inset-left, 0px));
  }

  .wp-page .word-card {
    border-radius: 1em;
    font-size: 3em;
  }

  .wp-page .timer-track {
    height: max(10px, 1.2dvh);
  }
}
