:root {
  --ta-ink: #183334;
  --ta-muted: #557071;
  --ta-mint: #65d4ba;
  --ta-teal: #087f78;
  --ta-night: #142d3a;
  --ta-sun: #ffd166;
  --ta-cream: #fff9e9;
  --ta-coral: #f47469;
}

.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;
}

.ta-game-page {
  width: min(1220px, calc(100% - 24px));
  margin: 24px auto 64px;
  color: var(--ta-ink);
}

.ta-game-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.ta-game-intro > * {
  min-width: 0;
}

.ta-game-intro h1,
.ta-select-copy h2,
.ta-complete-screen h2,
.ta-council-panel h2,
.ta-game-error h2,
.ta-game-notes h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1.05;
}

.ta-game-intro h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}

.ta-game-intro p {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--ta-muted);
  font-size: clamp(1rem, 1.5vw, 1.17rem);
}

.ta-kicker {
  margin: 0 0 8px !important;
  color: var(--ta-teal) !important;
  font-size: .76rem !important;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ta-balance {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(8, 127, 120, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 10px 28px rgba(24, 51, 52, .08);
  font-size: .88rem;
}

.ta-portal-flash {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 13px 16px;
  border: 1px solid rgba(8, 127, 120, .2);
  border-radius: 16px;
  background: #eefaf5;
  color: var(--ta-ink);
}

.ta-portal-flash p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.45;
}

.ta-coin-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 3px solid #e0a91f;
  border-radius: 50%;
  background: var(--ta-sun);
  color: #6b4b00;
  font-weight: 800;
}

.ta-stage-shell {
  overflow: hidden;
  border: 1px solid rgba(19, 67, 68, .18);
  border-radius: 26px;
  background: var(--ta-night);
  box-shadow: 0 26px 70px rgba(20, 45, 58, .24);
}

.ta-game-root {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 0%, rgba(101, 212, 186, .32), transparent 42%),
    linear-gradient(145deg, #173746, #0f2430);
  isolation: isolate;
}

.ta-game-root.is-selecting {
  min-height: 720px;
}

.ta-game-loading,
.ta-game-error,
.ta-character-screen,
.ta-complete-screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: clamp(20px, 4vw, 48px);
  text-align: center;
  color: #fff;
}

[hidden] {
  display: none !important;
}

.ta-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, .2);
  border-top-color: var(--ta-mint);
  border-radius: 50%;
  animation: ta-spin .8s linear infinite;
}

@keyframes ta-spin {
  to { transform: rotate(360deg); }
}

.ta-character-screen {
  justify-content: space-between;
  background:
    linear-gradient(rgba(15, 36, 48, .16), rgba(15, 36, 48, .76)),
    radial-gradient(circle at 50% 22%, #2f7d7c, #102933 72%);
}

.ta-select-copy {
  max-width: 720px;
}

.ta-select-copy h2 {
  font-size: clamp(1.75rem, 4vw, 3.3rem);
}

.ta-select-copy > p:last-child {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, .72);
}

.ta-character-grid {
  display: grid;
  width: min(920px, 100%);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.ta-character-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.ta-character-card:hover,
.ta-character-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(101, 212, 186, .8);
  outline: none;
}

.ta-character-card.is-selected {
  border-color: var(--ta-mint);
  background: rgba(101, 212, 186, .18);
  box-shadow: inset 0 0 0 2px rgba(101, 212, 186, .22);
}

.ta-character-portrait {
  display: block;
  height: 150px;
  margin-bottom: 8px;
  overflow: hidden;
}

.ta-character-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .22));
}

.ta-character-card strong,
.ta-character-card > span:last-child {
  display: block;
}

.ta-character-card strong {
  font-size: 1rem;
}

.ta-character-card > span:last-child {
  margin-top: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: .76rem;
  line-height: 1.35;
}

.ta-difficulty-picker {
  width: min(920px, 100%);
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  color: #fff;
  text-align: left;
}

.ta-difficulty-picker legend {
  width: 100%;
  margin-bottom: 3px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.ta-difficulty-picker > p {
  margin: 0 0 9px;
  color: rgba(255, 255, 255, .66);
  font-size: .8rem;
  line-height: 1.4;
  text-align: center;
}

.ta-difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.ta-difficulty-options label {
  display: flex;
  min-width: 0;
  min-height: 76px;
  padding: 11px 12px;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 15px;
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
}

.ta-difficulty-options label:has(input:checked) {
  border-color: var(--ta-sun);
  background: rgba(255, 209, 102, .14);
  box-shadow: inset 0 0 0 2px rgba(255, 209, 102, .14);
}

.ta-difficulty-options label:has(input:focus-visible) {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ta-difficulty-options input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--ta-sun);
}

.ta-difficulty-options span,
.ta-difficulty-options strong,
.ta-difficulty-options small {
  display: block;
}

.ta-difficulty-options strong {
  color: #fff;
  font-size: .92rem;
}

.ta-difficulty-options small {
  margin-top: 4px;
  color: rgba(255, 255, 255, .68);
  font-size: .79rem;
  line-height: 1.35;
}

.ta-primary-button,
.ta-game-error button {
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ta-mint);
  color: #10373a;
  font-weight: 500;
  cursor: pointer;
}

.ta-start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.ta-resume-note {
  max-width: 560px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .78);
  font-size: .82rem;
  line-height: 1.4;
}

.ta-secondary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.ta-primary-button:hover,
.ta-primary-button:focus-visible,
.ta-secondary-button:hover,
.ta-secondary-button:focus-visible {
  outline: 3px solid rgba(255, 209, 102, .72);
  outline-offset: 3px;
}

.ta-consent-note {
  max-width: 680px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .58);
  font-size: .74rem;
}

.ta-phaser-container,
.ta-phaser-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ta-phaser-container {
  height: 540px;
  min-height: 540px;
}

.ta-game-hud {
  position: absolute;
  z-index: 12;
  top: 14px;
  right: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.ta-hud-mission,
.ta-hud-stats,
.ta-hud-actions {
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 15px;
  background: rgba(13, 36, 44, .86);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
  color: #fff;
  backdrop-filter: blur(12px);
}

.ta-hud-mission {
  min-width: 220px;
  padding: 9px 13px;
}

.ta-hud-label {
  display: block;
  margin-bottom: 1px;
  color: var(--ta-mint);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ta-hud-tempo {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, .68);
  font-size: .64rem;
  font-weight: 600;
}

.ta-hud-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  font-size: .82rem;
}

.ta-time-mark {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 5px;
  border: 2px solid #e1a921;
  border-radius: 50%;
  background: var(--ta-sun);
  vertical-align: -3px;
}

.ta-time-mark::before,
.ta-time-mark::after {
  position: absolute;
  left: 6px;
  width: 2px;
  border-radius: 2px;
  background: #6b4b00;
  content: "";
  transform-origin: bottom center;
}

.ta-time-mark::before {
  top: 2px;
  height: 6px;
}

.ta-time-mark::after {
  top: 6px;
  height: 5px;
  transform: rotate(125deg);
}

.ta-time-total small {
  margin-left: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: .69rem;
}

.ta-hud-actions {
  display: flex;
  padding: 4px;
  pointer-events: auto;
}

.ta-hud-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}

.ta-hud-actions button:hover,
.ta-hud-actions button[aria-pressed="true"] {
  background: rgba(101, 212, 186, .2);
}

.ta-dialogue {
  position: absolute;
  z-index: 14;
  top: 118px;
  right: 18px;
  bottom: auto;
  width: min(380px, calc(100% - 36px));
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 14px;
  background: rgba(255, 249, 233, .96);
  color: var(--ta-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  pointer-events: none;
}

.ta-dialogue span {
  color: var(--ta-teal);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ta-dialogue p {
  margin: 3px 0 0;
  display: -webkit-box;
  overflow: hidden;
  font-size: .86rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ta-comedy-stamp {
  position: absolute;
  z-index: 24;
  top: 43%;
  left: 50%;
  display: grid;
  width: min(330px, calc(100% - 48px));
  min-height: 112px;
  padding: 14px 18px;
  place-content: center;
  border: 5px double var(--ta-coral);
  border-radius: 9px;
  background: rgba(255, 249, 233, .94);
  color: #a43d35;
  box-shadow: 0 18px 52px rgba(20, 45, 58, .26);
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) rotate(-5deg);
  pointer-events: none;
}

.ta-comedy-stamp.is-visible {
  animation: ta-stamp-slam 1.65s cubic-bezier(.18, .9, .3, 1) both;
}

.ta-comedy-stamp span,
.ta-comedy-stamp strong {
  display: block;
}

.ta-council-panel {
  position: absolute;
  z-index: 23;
  inset: 24px;
  display: flex;
  max-width: 860px;
  max-height: calc(100% - 48px);
  margin: auto;
  padding: clamp(20px, 4vw, 42px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(101, 212, 186, .2), transparent 45%),
    rgba(15, 36, 48, .97);
  color: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  text-align: center;
}

.ta-council-panel h2 {
  font-size: clamp(1.65rem, 4vw, 3rem);
}

.ta-council-panel > p:not(.ta-kicker) {
  max-width: 650px;
  margin: 10px 0 20px;
  color: rgba(255, 255, 255, .74);
  line-height: 1.45;
}

.ta-council-choices {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ta-council-choices button {
  min-width: 0;
  min-height: 126px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 17px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ta-council-choices button:hover,
.ta-council-choices button:focus-visible {
  border-color: var(--ta-mint);
  outline: 3px solid rgba(101, 212, 186, .24);
  background: rgba(101, 212, 186, .14);
}

.ta-council-choices strong,
.ta-council-choices span {
  display: block;
}

.ta-council-choices strong {
  margin-bottom: 7px;
  color: var(--ta-sun);
  font-size: 1rem;
}

.ta-council-choices span {
  color: rgba(255, 255, 255, .72);
  font-size: .8rem;
  line-height: 1.4;
}

.ta-comedy-stamp span {
  margin-bottom: 4px;
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .18em;
}

.ta-comedy-stamp strong {
  font-size: clamp(1.05rem, 3.2vw, 1.65rem);
  line-height: 1;
  letter-spacing: -.025em;
}

@keyframes ta-stamp-slam {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-16deg) scale(2.3);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-5deg) scale(.93);
  }
  28% {
    transform: translate(-50%, -50%) rotate(-5deg) scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56%) rotate(-3deg) scale(.98);
  }
}

.ta-touch-controls {
  position: absolute;
  z-index: 13;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.ta-touch-move,
.ta-touch-action {
  display: flex;
  gap: 9px;
}

.ta-touch-controls button {
  min-width: 58px;
  height: 58px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 18px;
  background: rgba(15, 36, 48, .78);
  color: #fff;
  font-weight: 500;
  pointer-events: auto;
  touch-action: none;
  backdrop-filter: blur(10px);
}

.ta-touch-controls button.is-active {
  background: rgba(101, 212, 186, .7);
  color: #113437;
  transform: scale(.95);
}

.ta-complete-screen {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 209, 102, .3), transparent 38%),
    rgba(15, 36, 48, .94);
}

.ta-complete-screen h2 {
  font-size: clamp(1.7rem, 4vw, 3.4rem);
}

.ta-complete-screen > p:not(.ta-kicker, .ta-consent-note) {
  color: rgba(255, 255, 255, .72);
}

.ta-complete-score,
.ta-portal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.ta-complete-score {
  margin: 12px 0 18px;
}

.ta-complete-score span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
}

.ta-portal-actions a,
.ta-portal-actions button {
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .09);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.ta-portal-actions a:first-child {
  border-color: var(--ta-mint);
  background: var(--ta-mint);
  color: #10373a;
}

.ta-game-notes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 4px 0;
}

.ta-game-notes h2 {
  font-size: 1rem;
}

.ta-game-notes p {
  margin: 6px 0 0;
  color: var(--ta-muted);
  font-size: .85rem;
}

.ta-game-notes kbd {
  padding: 2px 6px;
  border: 1px solid #cbd8d7;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  font-family: inherit;
  font-size: .78rem;
}

.ta-settings {
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  font-size: .85rem;
}

.ta-settings label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ta-settings input {
  width: 18px;
  height: 18px;
  accent-color: var(--ta-teal);
}

.ta-reset-button {
  padding: 4px 9px;
  border: 1px solid #cdd9d8;
  border-radius: 8px;
  background: #fff;
  color: var(--ta-muted);
  font: inherit;
  cursor: pointer;
}

.ta-reset-button:hover {
  border-color: var(--ta-coral);
  color: #a43d35;
}

.ta-game-root.is-reduced-motion *,
.ta-game-root.is-reduced-motion *::before,
.ta-game-root.is-reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

.ta-game-root.is-reduced-motion .ta-comedy-stamp.is-visible {
  opacity: 1;
  animation: none !important;
}

.ta-game-root.is-relaxed .ta-hud-actions button {
  min-height: 42px;
  padding-inline: 14px;
  font-size: .92rem;
}

.ta-game-root.is-relaxed .ta-touch-controls button {
  min-width: 68px;
  height: 68px;
  font-size: .9rem;
}

@media (pointer: coarse), (max-width: 860px) {
  .ta-touch-controls:not([hidden]) {
    display: flex;
  }

  .ta-game-root {
    min-height: 500px;
  }

  .ta-phaser-container {
    height: 500px;
    min-height: 500px;
  }

  .ta-game-hud {
    align-items: flex-start;
  }

  .ta-hud-actions {
    position: absolute;
    top: 52px;
    right: 0;
  }

  .ta-hud-mission {
    min-width: 0;
    max-width: 55%;
  }
}

@media (max-width: 720px) {
  .ta-game-page {
    width: min(calc(100% - 12px), 1220px);
    margin-top: 12px;
  }

  .ta-game-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .ta-character-screen {
    position: relative;
    min-height: 670px;
    padding: 18px 12px;
  }

  .ta-character-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ta-character-portrait {
    height: 105px;
  }

  .ta-character-card {
    padding: 8px;
  }

  .ta-difficulty-options {
    grid-template-columns: 1fr;
  }

  .ta-difficulty-options label {
    min-height: 0;
    padding: 10px 11px;
  }

  .ta-start-actions {
    width: 100%;
  }

  .ta-start-actions button {
    flex: 1 1 180px;
  }

  .ta-council-panel {
    inset: 10px;
    max-height: calc(100% - 20px);
    padding: 18px 13px;
    justify-content: flex-start;
    border-radius: 18px;
  }

  .ta-council-panel > p:not(.ta-kicker) {
    margin-bottom: 12px;
    font-size: .82rem;
  }

  .ta-council-choices {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .ta-council-choices button {
    min-height: 0;
    padding: 11px 13px;
  }

  .ta-consent-note {
    font-size: .68rem;
  }

  .ta-game-notes {
    align-items: flex-start;
    flex-direction: column;
  }

  .ta-settings {
    flex-wrap: wrap;
  }

  .ta-hud-stats {
    font-size: .72rem;
  }

  .ta-dialogue {
    top: 122px;
    right: 10px;
    bottom: auto;
    width: min(330px, calc(100% - 20px));
    padding: 8px 11px;
  }

  .ta-dialogue p {
    font-size: .78rem;
  }
}

@media (max-width: 390px) {
  .ta-game-intro h1 {
    font-size: clamp(1.75rem, 9.5vw, 2.15rem);
    letter-spacing: -.045em;
  }

  .ta-hud-mission {
    max-width: 58%;
    font-size: .72rem;
  }

  .ta-hud-stats {
    gap: 6px;
    padding: 8px;
  }

  .ta-touch-controls button {
    min-width: 52px;
    height: 52px;
    padding: 0 8px;
    font-size: .75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ta-spinner {
    animation-duration: 1.8s;
  }
}
