:root {
  --gib-red: #c8102e;
  --gib-red-hover: #a00d26;
  --white: #ffffff;
  --surface: #fafaf9;
  --surface-elevated: #ffffff;
  --surface-overlay: rgba(255, 255, 255, 0.92);
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --border-focus: #c8102e;
  --accent-gold: #b45309;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--surface);
  background: linear-gradient(180deg, #f5f5f4 0%, #fafaf9 50%, #f0efee 100%);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Gate / Landing */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.gate::-webkit-scrollbar {
  display: none;
}

.gate-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
}

@supports (height: 100dvh) {
  .gate {
    min-height: 100dvh;
    max-height: 100dvh;
  }
}

/* Mobile (incl. Googlebot smartphone): scroll to see all content, scrollbar hidden on .gate */
@media (max-width: 480px) {
  .gate {
    overflow-y: auto;
    justify-content: flex-start;
    padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
  }
  .gate-inner {
    position: static;
    transform: none;
    flex-shrink: 0;
    min-height: min-content;
  }
}

/* Scale gate to fit one viewport when height is limited (all devices; overrides mobile scale when viewport is short) */
@media (min-width: 481px) and (max-height: 720px) {
  .gate {
    overflow: hidden;
    padding: 0.5rem 1rem;
  }
  .gate-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    transform-origin: center center;
  }
}

@media (min-width: 481px) and (max-height: 680px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.9); }
}

@media (min-width: 481px) and (max-height: 640px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.85); }
}

@media (min-width: 481px) and (max-height: 600px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.8); }
}

@media (min-width: 481px) and (max-height: 560px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.75); }
}

@media (min-width: 481px) and (max-height: 520px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.7); }
}

@media (min-width: 481px) and (max-height: 480px) {
  .gate-inner { transform: translate(-50%, -50%) scale(0.65); }
}

/* Mobile + short viewport: use more aggressive scale so logo and footer aren’t clipped (overrides above on small phones) */
@media (max-height: 700px) and (min-width: 481px) {
  .gate {
    padding: 1.25rem 2rem;
    justify-content: flex-start;
  }
  .gate-logo {
    margin-bottom: 0.4rem;
  }
  .gate-tagline {
    margin-bottom: 1rem;
  }
  .gate-footer {
    margin-top: 1rem;
  }
}

@media (max-width: 480px) and (min-aspect-ratio: 9/20) {
  .gate {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-left)) max(0.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
  }
  .gate-logo {
    max-width: 200px;
    margin-bottom: 0.35rem;
    flex-shrink: 0;
  }
  .gate-tagline {
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
    line-height: 1.3;
    flex-shrink: 0;
  }
  .gate-card {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    flex-shrink: 0;
    margin-bottom: 0.6rem;
  }
  .gate-card h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
  .gate-card label {
    font-size: 0.8rem;
    margin-top: 0.6rem;
    margin-bottom: 0.25rem;
  }
  .gate-card input {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
  }
  .gate-card .gate-note {
    font-size: 0.7rem;
    margin-top: 0.5rem;
  }
  .gate-card .btn-play {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    margin-top: 0.5rem;
  }
  .gate-card .gate-back {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
  }
  .gate-leaderboard {
    padding: 0.6rem 0.9rem;
    margin-bottom: 0;
    border-radius: 10px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .gate-leaderboard-title {
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
    flex-shrink: 0;
  }
  .gate-leaderboard-week {
    font-size: 0.65rem;
    margin-bottom: 0.4rem;
    flex-shrink: 0;
  }
  .gate-leaderboard-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 11rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .gate-leaderboard-list::-webkit-scrollbar {
    display: none;
  }
  .gate-leaderboard-list li {
    padding: 0.3rem 0;
    font-size: 0.85rem;
  }
  .gate-leaderboard-empty {
    font-size: 0.8rem;
  }
  .gate-footer {
    margin-top: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.25rem;
    font-size: 0.8125rem;
    flex-shrink: 0;
  }
}

.gate-logo {
  display: block;
  max-width: 280px;
  width: 100%;
  height: auto;
  margin-bottom: 0.5rem;
}

.gate-tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.gate-guide-link {
  border: none;
  background: transparent;
  color: var(--gib-red);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  margin-bottom: 1rem;
}

.gate-guide-link:hover {
  color: var(--gib-red-hover);
}

.gate-leaderboard {
  max-width: 420px;
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-align: left;
}

@media (min-width: 641px) {
  .gate {
    padding: 1.25rem 2rem;
  }
  .gate-logo {
    margin-bottom: 0.35rem;
  }
  .gate-tagline {
    margin-bottom: 1rem;
  }
  .gate-card {
    padding: 1.5rem 2rem;
  }
  .gate-card h2 {
    margin-bottom: 1rem;
  }
  .gate-leaderboard {
    margin-top: 1.25rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
  }
  .gate-leaderboard-week {
    margin-bottom: 0.5rem;
  }
  .gate-leaderboard-list-wrap {
    min-height: 10rem;
  }
  .gate-leaderboard-list {
    height: 10rem;
    max-height: 10rem;
  }
  .gate-leaderboard-list li {
    padding: 0.4rem 0;
  }
  .gate-footer {
    margin-top: 1rem;
    padding-top: 0.35rem;
  }
}

.gate-leaderboard-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.gate-leaderboard-week {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.gate-leaderboard-week a {
  color: var(--gib-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gate-leaderboard-week a:hover {
  color: var(--gib-red-hover);
}

.gate-leaderboard-list-wrap {
  min-height: 11rem;
}

.gate-leaderboard-list {
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: 11rem;
  max-height: 11rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gate-leaderboard-list::-webkit-scrollbar {
  display: none;
}

.gate-leaderboard-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.gate-leaderboard-list li:last-child {
  border-bottom: none;
}

.gate-leaderboard-list li .rank {
  color: var(--accent-gold);
  font-weight: 700;
  margin-right: 0.75rem;
  font-size: 0.875rem;
}

.gate-leaderboard-list li .name {
  flex: 1;
  color: var(--text-primary);
}

.gate-leaderboard-list li .score {
  font-weight: 600;
  color: var(--text-primary);
}

.gate-leaderboard-empty {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.gate-footer {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  flex-shrink: 0;
  font-size: 0.875rem;
  text-align: center;
}

.gate-footer-line {
  margin: 0 0 0.2em 0;
}

.gate-footer-line:last-child {
  margin-bottom: 0;
}

.gate-footer a {
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.gate-footer a:hover {
  color: var(--gib-red);
}

.gate-card {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.gate-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.gate-card label {
  display: block;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

.gate-card label:first-of-type {
  margin-top: 0;
}

.gate-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-card input::placeholder {
  color: var(--text-muted);
}

.gate-card input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.gate-back {
  background: none;
  border: none;
  color: var(--gib-red);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  display: inline-block;
  transition: color 0.15s;
}

.gate-back:hover {
  color: var(--gib-red-hover);
}

.gate-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1rem;
  line-height: 1.5;
}

.btn-play {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--gib-red);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-play:hover {
  background: var(--gib-red-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-play:active {
  transform: translateY(0);
}

.btn-play:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.gate-error {
  color: #b91c1c;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.not-found-page .not-found-card {
  text-align: center;
}

.not-found-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.not-found-copy {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

a.btn-play.not-found-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* Game container — order collection game */
.game-container {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--surface);
  background: linear-gradient(180deg, #f5f5f4 0%, #fafaf9 100%);
}

@supports (height: 100dvh) {
  .game-container {
    height: 100dvh;
    height: 100svh;
  }
}

.game-container.active {
  display: flex;
}

.game-ui {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--surface-elevated);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.strikes {
  color: #dc2626;
  font-size: 1.25rem;
  letter-spacing: 0.1em;
}

.strikes.lost {
  color: var(--text-muted);
}

.game-play-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Desktop: compact, polished width (not stretched); item grid uses content height + square tiles */
@media (min-width: 768px) {
  .game-play-area {
    max-width: 440px;
    padding: 1.5rem;
  }

  .item-buttons {
    flex: 0 0 auto;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 0.6rem;
  }

  .item-btn {
    aspect-ratio: 1;
    max-width: 100%;
  }
}

.game-play-area > .order-label,
.game-play-area > .order-slip,
.game-play-area > .timer-wrap,
.game-play-area > .tray-label,
.game-play-area > .tray,
.game-play-area > .btn-submit {
  flex-shrink: 0;
}

.order-label,
.tray-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.order-slip {
  /* Fixed height so emojis never cause layout shift; fits up to two rows of emojis */
  height: 7rem;
  min-height: 7rem;
  padding: 1.25rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  align-content: center;
  font-size: 2rem;
  line-height: 1.1;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.order-slip .order-item {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.order-slip.empty {
  border-style: dashed;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.3;
}

.timer-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 999px;
  transition: width 0.15s linear, background 0.2s;
}

.timer-bar.warning {
  background: linear-gradient(90deg, #ea580c, #f59e0b);
}

.timer-bar.danger {
  background: var(--gib-red);
}

.tray {
  min-height: 3.5rem;
  padding: 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.tray .tray-item {
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.tray .tray-item:hover {
  background: var(--surface);
}

.tray .tray-item:active {
  background: var(--border);
}

.btn-submit {
  width: 100%;
  padding: 1rem 1.25rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--gib-red);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 1.25rem;
  touch-action: manipulation;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-submit:hover {
  background: var(--gib-red-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.item-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, auto);
  gap: 0.75rem;
  flex: 0 0 auto;
  min-height: 0;
  min-width: 0;
}

.item-btn {
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem;
  font-size: 1.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s, border-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.item-buttons.is-shuffling .item-btn {
  animation: tile-shuffle-in 380ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
  animation-delay: calc(var(--shuffle-index, 0) * 22ms);
}

@keyframes tile-shuffle-in {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9) rotate(-3deg);
  }
  65% {
    opacity: 1;
    transform: translateY(-3px) scale(1.03) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.item-btn:hover {
  background: var(--white);
  border-color: #d6d3d1;
  box-shadow: var(--shadow-sm);
}

.item-btn:active {
  transform: scale(0.97);
}

.item-btn span[aria-hidden="true"] {
  font-size: 2.25rem;
  line-height: 1;
}

.item-btn span.label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-family: var(--font-body);
}

/* Small viewports: same flex layout, slightly tighter top section so grid gets more room */
@media (max-height: 820px), (max-width: 430px) {
  .game-ui {
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
  }

  .game-play-area {
    padding: 0.75rem 1rem;
  }

  .order-slip {
    height: 5rem;
    min-height: 5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
  }

  .order-label,
  .tray-label {
    margin-bottom: 0.35rem;
  }

  .timer-wrap {
    margin-bottom: 0.6rem;
  }

  .tray {
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
  }

  .btn-submit {
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
  }

  .item-buttons {
    gap: 0.5rem;
  }

  .item-btn {
    padding: 0.4rem;
    font-size: 1.5rem;
    gap: 0.2rem;
  }

  .item-btn span[aria-hidden="true"] {
    font-size: 1.875rem;
  }

  .item-btn span.label {
    font-size: 0.5625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .item-buttons.is-shuffling .item-btn {
    animation: none;
  }
}

/* Game over overlay */
.game-over {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.game-over::-webkit-scrollbar {
  display: none;
}

.game-over.active {
  display: flex;
}

.game-over h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  background: var(--gib-red);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  text-align: center;
}

.game-over .final-score {
  font-size: 3rem;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 0 20px rgba(200, 16, 46, 0.6), 0 0 40px rgba(200, 16, 46, 0.4);
  margin-bottom: 1rem;
}

.game-over-share {
  width: min(100%, 22rem);
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--surface-overlay);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.game-over-share-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-share-primary,
.btn-share-secondary {
  appearance: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-share-primary {
  width: 100%;
  border: none;
  padding: 0.875rem 1rem;
  background: var(--gib-red);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn-share-primary:hover,
.btn-share-primary:focus-visible {
  background: var(--gib-red-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-share-primary:active,
.btn-share-secondary:active {
  transform: translateY(0);
}

.btn-share-primary:disabled,
.btn-share-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.game-over-share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.btn-share-secondary {
  min-height: 2.75rem;
  border: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
  background: var(--surface-elevated);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.btn-share-secondary:hover,
.btn-share-secondary:focus-visible {
  background: var(--surface);
  border-color: #d6d3d1;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-share-primary:focus-visible,
.btn-share-secondary:focus-visible {
  outline: 3px solid rgba(200, 16, 46, 0.18);
  outline-offset: 2px;
}

.game-over-share-status {
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.game-over .btn-again {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--gib-red);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: background 0.2s, transform 0.15s;
}

.game-over .btn-again:hover {
  background: var(--gib-red-hover);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .game-over {
    padding: 1.5rem 1.25rem;
    justify-content: center;
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .game-over h2 {
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
  }
  .game-over .final-score {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  .game-over-share {
    width: 100%;
    max-width: 320px;
    padding: 0.875rem;
    gap: 0.65rem;
  }
  .game-over-share-actions {
    grid-template-columns: 1fr;
  }
  .btn-share-primary,
  .btn-share-secondary {
    width: 100%;
  }
  .game-over .btn-again {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 320px;
  }
  .game-over .btn-leaderboard {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    width: 100%;
    max-width: 320px;
  }
}

/* Leaderboard panel */
.leaderboard-panel {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  max-width: 95vw;
  height: 100vh;
  background: var(--surface-elevated);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
  transition: right 0.3s ease, box-shadow 0.3s ease;
  z-index: 20;
  box-shadow: none;
}

.leaderboard-panel.open {
  right: 0;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
}

.leaderboard-panel h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.leaderboard-panel .week-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.leaderboard-panel .week-note a {
  color: var(--gib-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.leaderboard-panel .week-note a:hover {
  color: var(--gib-red-hover);
}

.leaderboard-panel .close-lb {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.15s;
}

.leaderboard-panel .close-lb:hover {
  color: var(--text-primary);
}

.leaderboard-panel ul {
  list-style: none;
  height: 11rem;
  max-height: 11rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard-panel li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.leaderboard-panel li .rank {
  color: var(--accent-gold);
  font-weight: 700;
  margin-right: 0.75rem;
}

.leaderboard-panel li .name {
  color: var(--text-primary);
}

.leaderboard-panel li .score {
  color: var(--text-primary);
  font-weight: 600;
}

/* Public CMS static pages (/p/:slug) */
.gate.static-page {
  max-height: none;
  min-height: 100dvh;
  justify-content: flex-start;
  padding: 1.5rem 1rem 2rem;
  overflow-y: auto;
}

.static-page-back {
  display: inline-block;
  align-self: flex-start;
  margin: 0 auto 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gib-red);
  text-decoration: none;
}

.static-page-back:hover {
  text-decoration: underline;
  color: var(--gib-red-hover);
}

.static-page-card {
  text-align: left;
  max-width: 44rem;
  width: 100%;
}

.static-page-body {
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.static-page-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.static-page-body h2,
.static-page-body h3 {
  font-family: var(--font-display);
  margin-top: 1.35rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text-primary);
}

.static-page-body h2:first-child,
.static-page-body h3:first-child {
  margin-top: 0;
}

.static-page-body p {
  margin-bottom: 0.85rem;
}

.static-page-body ul,
.static-page-body ol {
  margin: 0.35rem 0 1rem 1.35rem;
}

.static-page-body li {
  margin-bottom: 0.35rem;
}

.static-page-body a {
  color: var(--gib-red);
  text-underline-offset: 2px;
}

.static-page-body a:hover {
  color: var(--gib-red-hover);
}

.gate-footer-legal {
  font-size: 0.85rem;
}

.gate-footer-legal a {
  color: var(--text-secondary);
  text-decoration: none;
}

.gate-footer-legal a:hover {
  text-decoration: underline;
  color: var(--gib-red);
}

.hidden {
  display: none !important;
}

/* First-load hand-holding interstitial */
.hand-holding-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hand-holding-modal {
  width: 100%;
  max-width: 620px;
  max-height: min(90vh, 760px);
  overflow-y: auto;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  position: relative;
}

.hand-holding-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.hand-holding-modal h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin-bottom: 0.6rem;
}

.hand-holding-intro {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.45;
}

.hand-holding-offer {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.hand-holding-offer-image {
  display: block;
  width: min(100%, 320px);
  height: auto;
  aspect-ratio: 320 / 100;
  border-radius: calc(var(--radius-md) - 4px);
  object-fit: cover;
}

.hand-holding-static-link-wrap {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.4;
}

.hand-holding-static-link-wrap.hidden {
  display: none;
}

a.hand-holding-static-link {
  color: var(--gib-red);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

a.hand-holding-static-link:hover {
  color: var(--gib-red-hover);
}

.hand-holding-howto h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.hand-holding-howto ol {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.hand-holding-howto li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.hand-holding-howto li > span {
  width: 1.45rem;
  min-width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--gib-red);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.hand-holding-howto li p {
  line-height: 1.4;
  color: var(--text-primary);
}

.hand-holding-visuals {
  margin-top: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.hh-step {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.65rem;
  min-width: 7.25rem;
  text-align: center;
}

.hh-badge {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.hh-items {
  display: block;
  font-size: 1.3rem;
}

.hh-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.hand-holding-dismiss {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.hand-holding-btn {
  margin-top: 0;
}

@media (max-width: 480px) {
  .hand-holding-modal {
    padding: 1.15rem 1rem;
  }

  .hand-holding-modal h2 {
    font-size: 1.35rem;
    padding-right: 1.5rem;
  }
}
