:root {
  --cast0r-navy: #0D1B2A;
  --cast0r-blue: #1F355E;
  --cast0r-orange: #E07A1F;
  --cast0r-cream: #FFF3E6;
  --cast0r-white: #FFFFFF;
  --text-main: #0D1B2A;
  --text-muted: #667085;
  --background-main: #FFFFFF;
  --background-soft: #FFF3E6;
  --border-soft: #EADCCB;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-main);
  background: var(--background-main);
}

button,
input {
  font: inherit;
}

.app {
  min-height: 100%;
}

.panel {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--cast0r-white);
  background: var(--cast0r-navy);
  font-weight: 800;
  font-size: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 10vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.brand p {
  margin-top: 10px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 48ch;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.button {
  min-height: 56px;
  border: 1px solid var(--cast0r-navy);
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary {
  color: var(--cast0r-white);
  background: var(--cast0r-navy);
}

.secondary {
  color: var(--cast0r-navy);
  background: var(--cast0r-cream);
}

.example,
.active-list {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
}

.example-head,
.active-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--background-soft);
}

.example h2,
.active-list h2 {
  font-size: 18px;
}

.active-list span {
  color: var(--text-muted);
  font-weight: 700;
}

.example a {
  color: var(--cast0r-blue);
  font-weight: 700;
}

pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  color: var(--cast0r-cream);
  background: var(--cast0r-navy);
  font-size: 15px;
  line-height: 1.45;
}

.status {
  min-height: 24px;
  color: var(--text-muted);
}

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

.share a {
  color: var(--cast0r-blue);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.paste-box {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  font-weight: 700;
}

.paste-box textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 14px;
  color: var(--cast0r-cream);
  background: var(--cast0r-navy);
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.45;
}

.game {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 18px;
  color: var(--cast0r-white);
  background: var(--cast0r-navy);
  user-select: none;
}

.back {
  justify-self: start;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--cast0r-white);
  background: transparent;
  cursor: pointer;
}

.card {
  align-self: center;
  width: min(88vw, 720px);
  aspect-ratio: 1.55 / 1;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.35s ease;
}

.card-face {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.26);
  transition:
    opacity 0.25s ease,
    transform 0.35s ease;
}

.card-front {
  background: var(--cast0r-blue);
  opacity: 1;
}

.card-back {
  color: var(--cast0r-navy);
  background: var(--cast0r-cream);
  opacity: 0;
  transform: scale(0.96);
}

.card.is-flipped .card-inner {
  transform: scale(1.02);
}

.card.is-flipped .card-front {
  opacity: 0;
  transform: scale(1.04);
}

.card.is-flipped .card-back {
  opacity: 1;
  transform: scale(1);
}

.card-small {
  color: inherit;
  opacity: 0.72;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
}

.player-stats {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.player-stats span {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 8px;
  color: var(--cast0r-white);
  font-weight: 800;
  font-size: clamp(13px, 3.4vw, 18px);
  line-height: 1.15;
}

.card strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(34px, 11vw, 104px);
  line-height: 1;
}

.tap-hint {
  min-height: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 560px) {
  .panel {
    justify-content: flex-start;
    padding-top: max(22px, env(safe-area-inset-top));
  }

  .brand {
    align-items: flex-start;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .card {
    width: 94vw;
    aspect-ratio: 1 / 1.1;
  }

  .player-stats {
    grid-template-columns: 1fr;
  }
}
