:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  touch-action: manipulation;
}

body {
  display: flex;
  justify-content: center;
}
button {
  cursor: pointer;
}
button,
input {
  font: inherit;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-weight: 650;
  letter-spacing: -0.04em;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 920px);
  height: 100vh;
  height: 100dvh;
  background: var(--ink);
}

.brand-strip {
  display: flex;
  flex: none;
  justify-content: center;
  padding: calc(14px + var(--safe-top)) 24px 14px;
  background: var(--ink);
  border-bottom: 1px solid #ffffff26;
}
.brand-strip__logo {
  display: block;
  width: 176px;
  height: auto;
}
.game-frame {
  position: relative;
  flex: 1;
  min-height: 0;
}
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b7ac90 transparent;
  -webkit-overflow-scrolling: touch;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.screen-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}
.panel {
  min-height: 100%;
  padding: 26px 20px calc(26px + var(--safe-bottom));
}
.panel-main {
  background: var(--paper);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--gold-deep);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}
.section-heading {
  margin-bottom: 24px;
}
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 5.3vw, 2.5rem);
  line-height: 1.12;
}
.section-heading__intro {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-heading-row h2 {
  text-transform: capitalize;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.3;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background 160ms,
    color 160ms,
    border-color 160ms;
}
.primary-button {
  background: var(--gold);
  color: var(--ink);
}
.secondary-button {
  background: var(--ink);
  color: var(--surface);
}
.ghost-button {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}
@media (hover: hover) {
  .primary-button:hover:not(:disabled) {
    background: #efcc69;
  }
  .secondary-button:hover:not(:disabled) {
    background: #33342b;
  }
  .ghost-button:hover:not(:disabled) {
    border-color: var(--gold-deep);
    background: #e2b83f12;
  }
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.button-row > button {
  flex: 1;
}

/* A compact campaign on phones; an editorial split layout on larger embeds. */
.panel-hero--landing {
  display: grid;
  align-content: center;
  gap: 18px;
  color: var(--surface);
  background: var(--ink);
  text-align: center;
}
.hero-copy {
  display: grid;
  justify-items: center;
  gap: 12px;
}
.hero-title {
  margin: 0;
  max-width: 21ch;
  font-size: clamp(1.7rem, 6.7vw, 2.6rem);
  line-height: 1.12;
}
.hero-text {
  margin: 0;
  max-width: 43ch;
  color: var(--text-light);
  font-size: 0.8rem;
  line-height: 1.6;
}
.hero-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
  background: var(--gold);
  color: var(--ink);
}
.hero-showcase__media {
  height: 138px;
  overflow: hidden;
  background: #000;
}
.hero-showcase__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 54%;
  transform: scale(1.6);
}
.hero-showcase__content {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 18px;
  text-align: left;
}
.hero-showcase__label {
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-transform: uppercase;
}
.hero-showcase__content strong {
  font-size: clamp(1.65rem, 6vw, 2.3rem);
  line-height: 1;
  font-weight: 650;
  letter-spacing: -0.05em;
}
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.home-feature-grid span {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--text-light);
}
.home-feature-grid img {
  width: 34px;
  height: 34px;
}
.button-row--home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0;
}
#home-play {
  grid-column: 1 / -1;
  min-height: 54px;
  font-size: 0.88rem;
}
#home-play::after {
  content: "\2192";
  font-size: 1.3rem;
  margin-left: 18px;
  line-height: 1;
}
.button-row--home .ghost-button,
.button-row--home .secondary-button {
  background: transparent;
  border-color: #ffffff40;
  color: var(--surface);
  padding: 12px 8px;
  font-size: 0.7rem;
}
@media (hover: hover) {
  .button-row--home .ghost-button:hover,
  .button-row--home .secondary-button:hover {
    border-color: var(--gold);
    color: var(--gold);
  }
}
.home-privacy-note {
  margin: 0;
  color: var(--text-light);
  font-size: 0.72rem;
  line-height: 1.6;
}
.home-privacy-note a {
  color: var(--gold);
  display: inline-block;
}

/* Instructions stay readable, without competing card styles. */
.instruction-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-bottom: 24px;
}
.instruction-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: start;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.instruction-card > strong {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
}
.instruction-card h3 {
  margin: 0 0 7px;
  font-size: 1.05rem;
}
.instruction-card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.instruction-preview-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
.preview-shot {
  min-width: 0;
  padding: 18px;
  background: var(--ink);
  color: var(--surface);
}
.preview-shot__title {
  margin-bottom: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.preview-shot__hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}
.preview-shot__hud span {
  padding: 8px 2px;
  border-block: 1px solid #ffffff26;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 700;
}
.preview-shot__stage {
  position: relative;
  height: 228px;
  overflow: hidden;
  background: var(--surface-dark);
  border: 1px solid #ffffff1a;
}
.preview-tag {
  position: absolute;
  width: 50px;
  height: 50px;
}
.preview-tag img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-shot__pad {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: 90px;
  height: 27px;
  border-radius: 5px 5px 42px 42px;
  background: var(--gold);
  transform: translateX(-50%);
}
.preview-shot__pad::before {
  content: "";
  position: absolute;
  inset: -6px 0 auto;
  height: 12px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: var(--ink);
}
.preview-shot__caption {
  margin-top: 14px;
  color: var(--text-light);
  font-size: 0.79rem;
  line-height: 1.65;
}
.preview-shot--scoring {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.preview-shot--scoring .preview-shot__caption {
  color: var(--text-muted);
}
.preview-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}
.preview-legend-row strong {
  white-space: nowrap;
  color: var(--gold-deep);
  font-size: 0.88rem;
}
.instruction-summary {
  display: grid;
  gap: 12px;
}
.instruction-summary__card {
  display: grid;
  gap: 10px;
  background: var(--surface);
  border-left: 3px solid var(--gold);
  padding: 18px;
}
.instruction-summary__label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--gold-deep);
  font-weight: 800;
}
.instruction-summary__card strong {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.instruction-summary__card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.65;
}

/* Only the display changes; the simulation remains 400 x 640 on every screen. */
body.is-playing {
  background: var(--ink);
}
body.is-playing .app-shell {
  width: min(100%, 500px);
}
body.is-playing .brand-strip {
  padding: calc(8px + var(--safe-top)) 16px 8px;
}
body.is-playing .brand-strip__logo {
  width: 120px;
}
.screen-game {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 8px calc(8px + var(--safe-bottom));
  gap: 8px;
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: none;
  padding: 12px 0;
  border-bottom: 1px solid #ffffff26;
}
.hud-pill {
  min-width: 0;
  text-align: center;
  color: var(--surface);
  border-right: 1px solid #ffffff26;
}
.hud-pill:last-child {
  border: 0;
}
.hud-pill span {
  display: block;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
}
.hud-pill strong {
  display: block;
  margin-top: 5px;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.hud-pill:first-child strong {
  color: var(--gold);
}
.hud-pill:last-child strong {
  font-size: 0.8rem;
  line-height: 1.7;
}
.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-dark);
  border: 1px solid #ffffff1a;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.overtime-banner,
.rush-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--gold);
  background: var(--ink);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition:
    opacity 160ms,
    transform 160ms;
}
.rush-banner {
  background: var(--gold);
  color: var(--ink);
  letter-spacing: 0.08em;
  z-index: 3;
}
.overtime-banner--active,
.rush-banner--active {
  opacity: 1;
  transform: translate(-50%, 0);
}
.game-tip {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  padding: 8px 12px;
  background: #0a0a09e6;
  color: var(--text-light);
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
}

/* Results and entry form. */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  margin: 20px 0;
}
.result-card {
  padding: 16px 10px;
  min-width: 0;
  border-right: 1px solid var(--border);
}
.result-card:last-child {
  border: 0;
}
.result-card:first-child {
  background: var(--gold);
}
.result-card span {
  font-size: 0.62rem;
  line-height: 1.4;
  display: block;
}
.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.25rem, 5.5vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.end-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 26px;
}
.end-actions button {
  padding-inline: 8px;
  font-size: 0.69rem;
}
.submit-form {
  display: grid;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.field {
  display: grid;
  gap: 8px;
}
.field > span {
  font-size: 0.83rem;
  font-weight: 700;
}
.field small {
  font-size: 0.73rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.field input[type="text"],
.field input[type="email"],
.field select {
  min-width: 0;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid #a6a093;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
.field input::placeholder {
  color: #747068;
}
.field-inline {
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 12px;
}
.field-inline input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--gold-deep);
}
.field-inline > span {
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.65;
  font-weight: 400;
}
.terms-card {
  padding: 18px;
  background: #ede9df;
}
.terms-card__label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.terms-card__body {
  font-size: 0.76rem;
  line-height: 1.65;
  color: var(--text-muted);
}
.terms-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--gold-deep);
  text-decoration: underline;
}
.status-message {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* The single prize position is gold; other entries remain neutral. */
.leaderboard-month-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 20px;
}
.month-chip {
  min-height: 46px;
  padding: 10px 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
}
.month-chip--active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  box-shadow: inset 0 -3px var(--gold);
}
.leaderboard-list {
  display: grid;
  gap: 8px;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.leaderboard-row--podium {
  background: var(--gold);
  border-color: var(--gold);
}
.leaderboard-row__rank {
  font-size: 1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.leaderboard-row__name {
  font-size: 0.85rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.leaderboard-row__meta {
  color: var(--text-muted);
  font-size: 0.64rem;
  line-height: 1.5;
  margin-top: 5px;
}
.leaderboard-row--podium .leaderboard-row__meta {
  color: #403719;
}
.leaderboard-row__score {
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.leaderboard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.leaderboard-stat {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  background: var(--paper);
}
.leaderboard-stat span {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.61rem;
  font-weight: 700;
}
.leaderboard-stat strong {
  font-size: 1.1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.leaderboard-note {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.7;
}
.leaderboard-note summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  padding-block: 10px;
}
.mock-notice {
  flex: none;
  margin: 0;
  padding: 8px 12px;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.68rem;
  line-height: 1.4;
  text-align: center;
}

@media (min-width: 680px) {
  .brand-strip {
    justify-content: flex-start;
    padding-inline: 36px;
  }
  .panel {
    padding: 36px 36px calc(36px + var(--safe-bottom));
  }
  .panel-hero--landing {
    grid-template-columns: 1.05fr 1fr;
    column-gap: 36px;
    row-gap: 24px;
  }
  .hero-copy,
  .home-feature-grid,
  .button-row--home,
  .home-privacy-note {
    grid-column: 1;
  }
  .hero-copy {
    justify-items: start;
    text-align: left;
  }
  .hero-title {
    font-size: clamp(2.1rem, 4.4vw, 2.8rem);
  }
  .hero-text {
    font-size: 0.85rem;
  }
  .hero-showcase {
    grid-column: 2;
    grid-row: 1 / span 4;
    grid-template-columns: 1fr;
    align-self: stretch;
  }
  .hero-showcase__media {
    height: auto;
    min-height: 230px;
    aspect-ratio: 1;
  }
  .hero-showcase__image {
    transform: scale(1.4);
  }
  .hero-showcase__content {
    padding: 24px;
    align-self: end;
  }
  .hero-showcase__content strong {
    font-size: 2.7rem;
  }
  .home-privacy-note {
    text-align: left;
  }
  .instruction-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
  }
  .instruction-preview-grid {
    grid-template-columns: 1fr 1fr;
  }
  .instruction-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .leaderboard-row {
    padding: 20px;
  }
  .leaderboard-month-switcher {
    gap: 10px;
  }
  .result-card {
    padding: 24px;
  }
  .end-actions button {
    font-size: 0.8rem;
  }
  body.is-playing .brand-strip {
    justify-content: center;
  }
}

@media (max-width: 360px), (max-height: 700px) and (max-width: 679px) {
  .brand-strip {
    padding-block: calc(8px + var(--safe-top)) 8px;
  }
  .brand-strip__logo {
    width: 146px;
  }
  .panel-hero--landing {
    padding: 20px 16px calc(20px + var(--safe-bottom));
    gap: 14px;
  }
  .hero-title {
    font-size: 1.65rem;
  }
  .hero-copy {
    gap: 9px;
  }
  .hero-showcase__media {
    height: 112px;
  }
  .hero-showcase__content {
    padding: 12px;
  }
  .hero-showcase__content strong {
    font-size: 1.65rem;
  }
  .home-feature-grid img {
    width: 28px;
    height: 28px;
  }
  .home-feature-grid span {
    font-size: 0.6rem;
  }
}

/* Native modal supplies focus containment, Escape dismissal and an inert backdrop. */
.submission-dialog {
  box-sizing: border-box;
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 5vw, 2rem);
  border: 1px solid var(--gold);
  border-radius: 1.25rem;
  background: var(--paper);
  color: var(--ink);
}
.submission-dialog::backdrop { background: rgb(0 0 0 / 70%); }
.submission-dialog h2 { margin: 0 0 1rem; overflow-wrap: anywhere; }
.submission-dialog .button-row { flex-wrap: wrap; }
.submission-dialog button { white-space: normal; overflow-wrap: anywhere; }
