:root {
  --pink: #ff4d8d;
  --pink-hot: #ff2d6f;
  --gold: #ffd24a;
  --gold-2: #ffe38a;
  --cyan: #3ef0ff;
  --lime: #c6ff4a;
  --purple: #3a1078;
  --navy: #12082a;
  --ink: #1b0a18;
  --cream: #fff7ea;
  --brahman: #2f6bff;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --font-comic: "Bangers", "Trebuchet MS", "Arial Black", impact, system-ui, sans-serif;
  --font-ui: "Fredoka", "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-ui);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #1a0a32;
}

.hidden {
  display: none !important;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: calc(18px + var(--safe-t)) calc(14px + var(--safe-r))
    calc(16px + var(--safe-b)) calc(14px + var(--safe-l));
  overflow: hidden;
  pointer-events: auto;
}

.overlay-center {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 4, 28, 0.28);
}

#title {
  background: linear-gradient(
    180deg,
    rgba(18, 8, 42, 0.42),
    rgba(18, 8, 42, 0.18) 40%,
    rgba(18, 8, 42, 0.32)
  );
}

#loading {
  background: linear-gradient(180deg, #2a0a4a, #12082a);
  flex-direction: column;
  gap: 8px;
}

#loading .logo-fallback {
  font-family: var(--font-comic);
  font-size: clamp(42px, 12vw, 84px);
  letter-spacing: 2px;
  margin: 0;
  color: var(--gold);
  text-shadow: 4px 4px 0 #ff2d6f, 0 0 24px #ff4d8d;
}

.title-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
}

.brand {
  text-align: center;
  flex: 0 0 auto;
}

.logo {
  display: block;
  height: clamp(48px, 12vh, 92px);
  width: auto;
  margin: 0 auto 4px;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.25));
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 2px 0 #7a1848;
}

h1 {
  font-family: var(--font-comic);
  font-size: clamp(26px, 7.2vw, 56px);
  line-height: 0.92;
  margin: 4px 0 6px;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 4px 4px 0 #ff2d6f, -2px 0 0 #3ef0ff;
}

.tag {
  margin: 0 auto;
  max-width: 34rem;
  padding: 0 8px;
  font-size: clamp(13px, 3.4vw, 16px);
  color: #ffe8f4;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.tag em {
  color: var(--gold);
  font-style: normal;
  font-weight: 700;
}

.cards {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.card {
  position: relative;
  appearance: none;
  border: 4px solid #fff;
  border-radius: 28px;
  min-height: 120px;
  min-width: 64px;
  padding: 14px 14px 12px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.28), 0 18px 40px rgba(0, 0, 0, 0.28);
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
}

.card-sherin {
  background: linear-gradient(160deg, #fff3a8 0%, #ff8ad4 42%, #ff4d8d 100%);
  border-color: #ffe38a;
  flex: 1.18 1 0;
}

.card-sherin::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.45) 48%,
    transparent 62%
  );
  animation: sheen 2.4s ease-in-out infinite;
  pointer-events: none;
}

.card-brahman {
  background: linear-gradient(160deg, #d7ecff 0%, #6aa2ff 55%, #2f6bff 100%);
  border-color: #b9e8ff;
}

.crown-banner,
.underdog-banner {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #111;
  color: var(--gold);
  padding: 4px 8px;
  border-radius: 999px;
  z-index: 1;
}

.underdog-banner {
  color: #b9e8ff;
}

.card-row {
  display: flex;
  gap: 12px;
  align-items: center;
  height: 100%;
}

.avatar {
  width: clamp(72px, 18vw, 120px);
  height: clamp(72px, 18vw, 120px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 4px solid #fff;
  flex: 0 0 auto;
  display: block;
}

.card-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.card h2 {
  font-family: var(--font-comic);
  font-size: clamp(28px, 7vw, 44px);
  margin: 0;
  letter-spacing: 1px;
  line-height: 0.9;
}

.role {
  margin: 2px 0 6px;
  font-weight: 700;
  font-size: 13px;
}

.card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  line-height: 1.35;
}

.card li::before {
  content: "★ ";
  color: #fff;
}

.cta {
  display: block;
  margin-top: 8px;
  background: #111;
  color: #fff;
  text-align: center;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 15px;
  min-height: 44px;
  line-height: 24px;
}

.card-sherin .cta {
  background: #111;
  color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.35);
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r))
    calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr auto;
  align-items: start;
}

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-center {
  align-items: center;
  text-align: center;
}

.hud-right {
  align-items: flex-end;
}

.hearts {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 46vw;
}

.heart {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 22px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.heart img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.heart.off {
  opacity: 0.28;
  filter: grayscale(1);
}

.chip {
  display: inline-block;
  align-self: flex-start;
  background: #111;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 2px solid #fff;
}

.chip.underdog {
  color: #b9e8ff;
}

.score {
  font-family: var(--font-comic);
  font-size: clamp(28px, 8vw, 48px);
  line-height: 1;
  text-shadow: 3px 3px 0 #ff2d6f, 0 0 12px rgba(0, 0, 0, 0.45);
}

.combo {
  min-height: 18px;
  font-family: var(--font-comic);
  font-size: 18px;
  color: var(--gold);
  text-shadow: 2px 2px 0 #7a1848;
}

.substats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 0 #000;
}

.icon-btn,
.big-btn {
  pointer-events: auto;
  touch-action: manipulation;
  appearance: none;
  border: 3px solid #fff;
  background: #111;
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
}

.icon-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 16px;
  font-size: 22px;
  box-shadow: 0 4px 0 #000;
}

.icon-btn:active,
.big-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000;
}

.hint {
  grid-column: 1 / -1;
  justify-self: center;
  align-self: end;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.panel {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #fff4c4, #ff8ec8);
  color: var(--ink);
  border: 4px solid #fff;
  border-radius: 28px;
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.3);
}

.panel h2 {
  font-family: var(--font-comic);
  font-size: clamp(32px, 9vw, 48px);
  margin: 4px 0 8px;
}

.roast {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}

.go-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.go-stats div {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 8px;
  font-size: 12px;
}

.go-stats b {
  display: block;
  font-size: 20px;
  font-family: var(--font-comic);
}

.big-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  font-size: 18px;
  margin-top: 8px;
  box-shadow: 0 5px 0 #000;
  background: #111;
  color: var(--gold);
}

.big-btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: none;
}

@keyframes sheen {
  0% {
    transform: translateX(-30%);
  }
  100% {
    transform: translateX(30%);
  }
}

@media (orientation: portrait) and (max-width: 500px) {
  .brand .tag {
    font-size: 13px;
    max-width: 92%;
  }

  .card ul {
    display: none;
  }

  .crown-banner,
  .underdog-banner {
    font-size: 10px;
  }
}

@media (orientation: landscape) {
  .title-inner {
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
  }

  .brand {
    flex: 0 0 34%;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .brand h1 {
    font-size: clamp(28px, 5.4vw, 52px);
  }

  .cards {
    flex-direction: row;
  }

  .card {
    min-height: 0;
  }

  .card ul {
    font-size: 11px;
  }
}

@media (orientation: landscape) and (max-height: 460px) {
  .brand .tag,
  .card ul {
    display: none;
  }

  h1 {
    font-size: 28px;
  }

  .card {
    padding: 10px;
    border-radius: 20px;
  }

  .cta {
    margin-top: 4px;
    padding: 8px;
    min-height: 40px;
  }

  .avatar {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-sherin::before {
    animation: none;
  }
}
