/* -------------------------------------------------------------------------
 * Survive Thanksgiving 2026
 * A warm cream-and-cranberry storybook on top of the site's dark arcade shell.
 * ---------------------------------------------------------------------- */

.tg-page-header {
  padding-top: 1.25rem;
  padding-bottom: 0.3rem;
}

.tg-page-header h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(0.95rem, 3vw, 1.4rem);
}

.tg-page-header p {
  max-width: 70ch;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.tg-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem 3.5rem;
}

/* Full screen: the HUD stays, the playfield takes the rest. */
.tg-shell:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: #0a1222;
}

.tg-shell:fullscreen .tg-hud {
  flex: 0 0 auto;
  border: none;
  padding: 0.65rem 1rem;
}

.tg-shell:fullscreen .tg-stage {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
  border: none;
  box-shadow: none;
}

.tg-shell:fullscreen .tg-help,
.tg-shell:fullscreen .tg-back {
  display: none;
}

.tg-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(180deg, #2a1a4d 0%, #1b1035 100%);
  border: 4px solid var(--ink);
  border-bottom: 0;
}

.tg-hud-left {
  min-width: 0;
}

.tg-dots {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.tg-dot {
  display: block;
  width: 0.62rem;
  height: 0.62rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(10, 5, 24, 0.6);
}

.tg-dot.is-done {
  background: var(--green);
}

.tg-dot.is-active {
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(255, 217, 61, 0.25);
}

.tg-chapter {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: clamp(0.48rem, 1.6vw, 0.6rem);
  line-height: 1.7;
  color: var(--muted);
}

.tg-hud-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.tg-score {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.tg-score strong {
  display: inline-block;
  margin-left: 0.25rem;
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  color: var(--accent-soft);
}

.tg-icon-button {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text);
  background: var(--panel-soft);
  border: 3px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
}

.tg-icon-button:hover {
  filter: brightness(1.15);
}

.tg-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #1a2b4a 0%, #0a1222 72%);
  border: 4px solid var(--ink);
  border-top: 4px solid #0a1222;
  box-shadow: var(--shadow-hard);
}

.tg-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: crosshair;
}

/* The canvas is focused as a keyboard target, but it covers the whole stage:
 * a focus ring around the letterbox is more distracting than helpful. */
.tg-stage canvas:focus-visible {
  outline: none;
}

/* Overlay ---------------------------------------------------------------- */

.tg-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(8, 5, 18, 0.55);
  backdrop-filter: blur(2px);
}

.tg-overlay[hidden] {
  display: none;
}

.tg-card {
  position: relative;
  width: min(100%, 550px);
  max-height: 100%;
  overflow-y: auto;
  padding: 1.35rem 1.45rem 1.25rem;
  color: #2a2340;
  background: #fff8e7;
  border: 4px solid #241a2e;
  border-top: 9px solid #f28a2e;
  box-shadow: 8px 8px 0 rgba(10, 5, 24, 0.75);
}

.tg-games-link {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  padding: 0.15rem 0.05rem;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a6558;
  text-decoration: none;
  border-bottom: 2px solid #c09a67;
}

.tg-games-link:hover {
  color: #9a2b3f;
  border-bottom-color: #9a2b3f;
}

.tg-eyebrow {
  margin: 0 0 0.55rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.44rem, 1.5vw, 0.52rem);
  line-height: 1.8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a2b3f;
}

.tg-card h2 {
  margin: 0 0 0.7rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.88rem, 2.4vw, 1.18rem);
  font-weight: 400;
  line-height: 1.55;
  color: #2a2340;
  text-shadow: 2px 2px 0 #ffd9a3;
}

.tg-copy p {
  margin: 0.45rem 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: #3b3048;
}

.tg-copy strong {
  color: #9a2b3f;
}

.tg-breakdown {
  margin: 0.9rem 0 0.3rem;
  padding: 0.6rem 0.75rem;
  background: #f5e5c7;
  border: 2px dashed #c09a67;
}

.tg-breakdown[hidden] {
  display: none;
}

.tg-breakdown-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.14rem 0;
  font-size: 0.82rem;
  color: #4a3b46;
}

.tg-breakdown-row:last-child {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 2px solid #d7bd97;
  font-weight: 800;
  color: #2a2340;
}

.tg-breakdown-row strong {
  flex: 0 0 auto;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: #9a2b3f;
}

.tg-tip {
  margin: 0.9rem 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.55;
  color: #7a6558;
}

.tg-button {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.54rem, 1.8vw, 0.66rem);
  line-height: 1.7;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2a2340;
  background: #ffd166;
  border: 3px solid #241a2e;
  box-shadow: 4px 4px 0 #241a2e;
  cursor: pointer;
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2), background 0.1s steps(2);
}

.tg-button:hover {
  background: #ffe282;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #241a2e;
}

.tg-button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #241a2e;
}

/* Page bits -------------------------------------------------------------- */

.tg-help {
  max-width: 66ch;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.tg-back {
  display: block;
  width: fit-content;
  margin: 1.3rem auto 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
}

.tg-noscript {
  max-width: 60ch;
  margin: 2rem auto;
  padding: 1rem;
  color: var(--text);
  text-align: center;
}

@media (max-width: 760px) {
  .tg-page-header {
    padding-top: 1.2rem;
  }

  .tg-shell {
    padding: 0 0.55rem 2.2rem;
  }

  .tg-stage {
    aspect-ratio: auto;
    height: min(68vh, 520px);
  }

  .tg-hud {
    padding: 0.55rem 0.7rem;
    gap: 0.5rem;
  }

  .tg-hud-right {
    width: 100%;
    justify-content: space-between;
  }

  .tg-overlay {
    align-items: flex-start;
    padding: 0.55rem;
  }

  .tg-card {
    padding: 1rem 0.95rem 0.95rem;
    border-width: 3px;
    border-top-width: 8px;
    box-shadow: 5px 5px 0 rgba(10, 5, 24, 0.75);
  }

  .tg-card h2 {
    font-size: 0.86rem;
  }

  .tg-copy p {
    font-size: 0.9rem;
  }

  .tg-button {
    font-size: 0.52rem;
    padding: 0.7rem 0.8rem;
  }

  .tg-help {
    font-size: 0.82rem;
  }
}

/* -------------------------------------------------------------------------
 * Phone play shell
 *
 * The site's mobile-play.js sizes this shell to the space below the slim
 * chrome. The HUD is one compact row, the stage takes every pixel left, and
 * story cards become full-screen dialogs instead of being trapped in the
 * 16:9 letterbox. A quiet rotate hint sits under the stage in portrait.
 * ---------------------------------------------------------------------- */

.tg-turn {
  display: none;
}

@media (max-width: 760px) {
  body.mobile-play-fit .tg-shell {
    display: flex;
    flex-direction: column;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: #0a1222;
  }

  body.mobile-play-fit .tg-hud {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-bottom: 3px solid var(--ink);
  }

  body.mobile-play-fit .tg-hud-left {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
  }

  body.mobile-play-fit .tg-dots {
    flex: 0 0 auto;
    gap: 0.2rem;
    margin: 0;
  }

  body.mobile-play-fit .tg-dot {
    width: 0.38rem;
    height: 0.38rem;
    border-width: 1px;
  }

  body.mobile-play-fit .tg-chapter {
    overflow: hidden;
    font-size: 0.44rem;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-play-fit .tg-hud-right {
    flex: 0 0 auto;
    gap: 0.35rem;
    width: auto;
  }

  body.mobile-play-fit .tg-score {
    font-size: 0.5rem;
  }

  body.mobile-play-fit .tg-score strong {
    margin-left: 0.15rem;
    font-size: 0.56rem;
  }

  body.mobile-play-fit .tg-score-long {
    display: none;
  }

  body.mobile-play-fit .tg-icon-button {
    width: 2rem;
    height: 2rem;
    font-size: 0.78rem;
    border-width: 2px;
    box-shadow: 1px 1px 0 var(--ink);
  }

  /* Portrait keeps the 16:9 game at its natural size and gives the rest of
   * the screen to a deliberate rotate panel. No letterboxed strip floating
   * in an empty field. */
  body.mobile-play-fit .tg-stage {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border: 0;
    border-top: 3px solid #0a1222;
    box-shadow: none;
  }

  /* The stage is tall in portrait; the 16:9 game letterboxes inside it.
   * Cards leave the letterbox and use the whole phone screen. */
  body.mobile-play-fit .tg-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    padding: max(0.65rem, env(safe-area-inset-top)) max(0.65rem, env(safe-area-inset-right))
      max(0.65rem, env(safe-area-inset-bottom)) max(0.65rem, env(safe-area-inset-left));
    background: rgba(8, 5, 18, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  body.mobile-play-fit .tg-card {
    width: min(100%, 34rem);
    max-height: calc(100dvh - 1.3rem);
  }

  body.mobile-play-fit .tg-games-link {
    top: 0.55rem;
    right: 0.6rem;
    font-size: 0.44rem;
  }

  body.mobile-play-fit .tg-help,
  body.mobile-play-fit .tg-back {
    display: none;
  }

  body.mobile-play-fit .tg-turn {
    display: none;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 0;
    margin: 0;
    padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom));
    text-align: center;
    background: radial-gradient(circle at 50% 35%, rgba(125, 211, 252, 0.12), transparent 58%),
      #120a2a;
  }

  body.mobile-play-fit .tg-turn-icon {
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    font-size: 2rem;
    line-height: 1;
    color: var(--accent-soft);
    border: 3px solid rgba(255, 217, 61, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(255, 217, 61, 0.08);
  }

  body.mobile-play-fit .tg-turn strong {
    font-family: var(--font-pixel);
    font-size: 0.62rem;
    line-height: 1.7;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-soft);
  }

  body.mobile-play-fit .tg-turn small {
    max-width: 26ch;
    font-size: 0.64rem;
    line-height: 1.5;
    color: var(--muted);
  }

  body.mobile-play-fit.tg-playing .tg-turn {
    display: flex;
  }
}

/* Modern phones in landscape are wider than the site shell's 760px phone
 * breakpoint, so this page adds a full-screen landscape layout of its own.
 * The site header stays as the way back to the rest of Foofire. */
@media (max-height: 520px) and (max-width: 1000px) and (orientation: landscape) {
  html,
  body {
    height: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  body .site-header {
    flex: 0 0 auto;
  }

  body .header-inner {
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
  }

  body .logo {
    font-size: 0.58rem;
    text-shadow: 2px 2px 0 var(--ink);
  }

  body .nav-links {
    gap: 0.5rem;
  }

  body .nav-links a {
    font-size: 0.48rem;
  }

  body main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  body .tg-page-header,
  body footer,
  body .tg-help,
  body .tg-back,
  body .tg-turn {
    display: none;
  }

  body .tg-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: #0a1222;
  }

  body .tg-hud {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding: 0.3rem 0.55rem;
    border: 0;
    border-bottom: 3px solid var(--ink);
  }

  body .tg-hud-left {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
  }

  body .tg-dots {
    gap: 0.2rem;
    margin: 0;
  }

  body .tg-dot {
    width: 0.38rem;
    height: 0.38rem;
    border-width: 1px;
  }

  body .tg-chapter {
    overflow: hidden;
    font-size: 0.44rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body .tg-hud-right {
    flex: 0 0 auto;
    gap: 0.4rem;
    width: auto;
  }

  body .tg-score {
    font-size: 0.5rem;
  }

  body .tg-score strong {
    font-size: 0.56rem;
  }

  body .tg-score-long {
    display: none;
  }

  body .tg-icon-button {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.75rem;
    border-width: 2px;
    box-shadow: 1px 1px 0 var(--ink);
  }

  body .tg-stage,
  body.mobile-play-fit .tg-stage {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
  }

  body .tg-turn,
  body.mobile-play-fit .tg-turn,
  body.mobile-play-fit.tg-playing .tg-turn {
    display: none;
  }

  body .tg-overlay,
  body.mobile-play-fit .tg-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    padding: max(0.3rem, env(safe-area-inset-top)) max(0.6rem, env(safe-area-inset-right))
      max(0.3rem, env(safe-area-inset-bottom)) max(0.6rem, env(safe-area-inset-left));
    background: rgba(8, 5, 18, 0.86);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  body .tg-card,
  body.mobile-play-fit .tg-card {
    width: min(100%, 34rem);
    max-height: calc(100dvh - 0.7rem);
    padding: 0.75rem 0.95rem 0.7rem;
    border-width: 3px;
    border-top-width: 7px;
    box-shadow: 5px 5px 0 rgba(10, 5, 24, 0.75);
  }

  body .tg-eyebrow {
    margin-bottom: 0.3rem;
    font-size: 0.44rem;
  }

  body .tg-card h2 {
    margin-bottom: 0.4rem;
    font-size: 0.94rem;
    line-height: 1.45;
  }

  body .tg-copy p {
    margin: 0.22rem 0;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  body .tg-tip {
    margin: 0.55rem 0 0.65rem;
    font-size: 0.76rem;
    line-height: 1.4;
  }

  body .tg-button {
    padding: 0.6rem 0.75rem;
    font-size: 0.52rem;
  }

  body .tg-breakdown {
    margin: 0.5rem 0 0.2rem;
    padding: 0.4rem 0.55rem;
  }

  body .tg-breakdown-row {
    padding: 0.06rem 0;
    font-size: 0.72rem;
  }

  body .tg-breakdown-row strong {
    font-size: 0.5rem;
  }

  /* The scorecard is taller than a landscape phone. Two columns keep the totals
   * and the Play again button above the fold. */
  body .tg-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    row-gap: 0;
  }

  body .tg-breakdown-row.is-total {
    grid-column: 1;
  }

  body .tg-breakdown-row.is-best {
    grid-column: 2;
  }

  body .tg-breakdown-row.is-total,
  body .tg-breakdown-row.is-best {
    margin-top: 0;
    padding-top: 0.28rem;
    border-top: 2px solid #d7bd97;
    font-weight: 800;
    color: #2a2340;
  }
}
