:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f5ef;
  background: #101714;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --surface: #18211d;
  --muted: #9aa69c;
  --gold: #f0c46d;
  --green: #88c29d;
  --red: #e47b78;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 32%, rgb(47 91 67 / 15%), transparent 48%),
    #101714;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  width: min(100% - 40px, 920px);
  min-height: 100vh;
  margin: 0 auto;
  flex-direction: column;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  min-height: 84px;
  border-bottom: 1px solid rgb(255 255 255 / 7%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f5f5ee;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 34px;
  place-items: center;
  border: 1px solid rgb(240 196 109 / 36%);
  border-radius: 9px;
  color: var(--gold);
  font-size: 20px;
}

.brand-accent {
  color: var(--gold);
}

.header-note,
.site-footer {
  color: #849087;
  font-size: 12px;
}

.landing {
  display: flex;
  flex: 1;
  max-width: 560px;
  margin: 48px auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-cards {
  display: flex;
  height: 95px;
  align-items: center;
  justify-content: center;
  margin: 0 0 24px;
}

.mini-card {
  display: grid;
  width: 51px;
  height: 73px;
  place-items: center;
  margin: 0 -7px;
  border: 1px solid #e8e8dc;
  border-radius: 9px;
  background: #f5f3e9;
  box-shadow: 0 10px 24px rgb(0 0 0 / 24%);
  font-size: 26px;
  font-weight: 800;
}

.mini-card:first-child {
  transform: rotate(-15deg) translateY(3px);
}

.mini-card:last-child {
  transform: rotate(15deg) translateY(3px);
}

.mini-card--red {
  color: #b94d4c;
}

.mini-card--gold {
  z-index: 1;
  color: #17231d;
  transform: translateY(-4px) !important;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 13px;
  color: #9bc3a7;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #84be98;
  box-shadow: 0 0 12px rgb(132 190 152 / 70%);
}

h1 {
  margin: 0;
  color: #f2f2eb;
  font-size: clamp(42px, 8vw, 66px);
  font-weight: 850;
  letter-spacing: -0.07em;
  line-height: 0.98;
}

.landing h1 span {
  color: var(--gold);
}

.intro {
  max-width: 390px;
  margin: 20px 0 25px;
  color: #a5aea6;
  font-size: 15px;
  line-height: 1.7;
}

.feature-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
  text-align: left;
}

.feature-card {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 13px;
  background: rgb(255 255 255 / 2.5%);
}

.feature-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  font-size: 19px;
}

.feature-icon--gold {
  background: rgb(240 196 109 / 10%);
  color: var(--gold);
}

.feature-icon--green {
  background: rgb(136 194 157 / 10%);
  color: var(--green);
}

.feature-card h2 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 750;
}

.feature-card p {
  margin: 0;
  color: #87938a;
  font-size: 10px;
}

.button {
  display: inline-flex;
  min-height: 47px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button--primary {
  background: var(--gold);
  color: #19201b;
}

.button--primary:hover:not(:disabled) {
  background: #f6d48f;
}

.button--large {
  width: min(100%, 360px);
  min-height: 54px;
}

.button-arrow {
  font-size: 19px;
  line-height: 1;
}

.api-note {
  margin: 13px 0 0;
  color: #66736a;
  font-size: 10px;
}

.error-message {
  display: flex;
  width: min(100%, 440px);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgb(228 123 120 / 25%);
  border-radius: 10px;
  background: rgb(228 123 120 / 8%);
}

.error-text {
  margin: 0;
  color: #f2c0bc;
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}

.button--retry {
  min-height: 35px;
  padding: 0 11px;
  background: rgb(228 123 120 / 13%);
  color: #ffd4ce;
  font-size: 11px;
  white-space: nowrap;
}

.button--retry:hover:not(:disabled) {
  background: rgb(228 123 120 / 22%);
}

.game {
  flex: 1;
  padding: 42px 0 36px;
}

.game-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 19px;
}

.game-heading h1 {
  font-size: clamp(27px, 5vw, 35px);
  letter-spacing: -0.045em;
}

.game-heading .eyebrow {
  margin-bottom: 8px;
  font-size: 10px;
}

.round-counter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.round-counter span {
  color: #7f8b82;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.round-counter strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 14px;
  background: rgb(8 14 11 / 38%);
}

.score-player {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
}

.score-player + .score-player {
  border-left: 1px solid rgb(255 255 255 / 9%);
}

.player-details {
  display: flex;
  align-items: center;
  gap: 11px;
}

.player-details > span:last-child {
  display: grid;
  gap: 3px;
}

.player-details strong {
  font-size: 12px;
}

.player-details small {
  color: #7f8a82;
  font-size: 10px;
}

.player-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
}

.player-icon--you {
  background: rgb(240 196 109 / 10%);
  color: var(--gold);
}

.player-icon--cpu {
  background: rgb(166 152 225 / 10%);
  color: #baaef0;
}

.score-number {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.table {
  position: relative;
  overflow: hidden;
  margin-top: 13px;
  padding: 26px 24px 18px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 21px;
  background:
    radial-gradient(ellipse at 50% 42%, rgb(47 105 74 / 43%), transparent 62%),
    linear-gradient(140deg, #1d4434, #173428 65%, #152c22);
  box-shadow: 0 20px 44px rgb(0 0 0 / 17%);
}

.table::before {
  position: absolute;
  inset: 9px;
  border: 1px solid rgb(255 255 255 / 6%);
  border-radius: 15px;
  content: "";
  pointer-events: none;
}

.table-inset {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.card-side {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.card-side h2 {
  display: flex;
  min-height: 24px;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  color: rgb(248 250 245 / 84%);
  font-size: 12px;
  font-weight: 700;
}

.winner-mark {
  display: none;
  color: var(--gold);
}

.card-side.is-winner .winner-mark {
  display: inline;
}

.playing-card {
  position: relative;
  display: grid;
  width: clamp(110px, 22vw, 168px);
  aspect-ratio: 5 / 7;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: 10px;
  background: #f7f5ec;
  box-shadow: 0 14px 30px rgb(0 0 0 / 29%);
  animation: card-arrive 260ms ease both;
}

.playing-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-back {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgb(240 196 109 / 8%) 6px 7px),
    #17251e;
}

.card-back::before {
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(240 196 109 / 34%);
  border-radius: 6px;
  content: "";
}

.card-back span {
  color: rgb(240 196 109 / 70%);
  font-size: 43px;
}

.card-label {
  min-height: 18px;
  margin: 10px 0 0;
  color: rgb(245 248 242 / 72%);
  font-size: 11px;
  font-weight: 550;
  text-align: center;
  text-transform: capitalize;
}

.versus {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding-top: 18px;
}

.versus span {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 50%;
  background: rgb(0 0 0 / 15%);
  color: rgb(255 255 255 / 74%);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.versus small {
  color: rgb(255 255 255 / 38%);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.round-result {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-height: 36px;
  margin: 12px auto 0;
  padding: 9px 18px;
  border: 1px solid rgb(240 196 109 / 16%);
  border-radius: 10px;
  background: rgb(0 0 0 / 14%);
  color: #f1d493;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.game-error {
  width: 100%;
}

.game-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 17px;
}

.rules-note,
.deck-note {
  margin: 13px 0 0;
  color: #89958b;
  font-size: 10px;
  text-align: center;
}

.rules-note span {
  padding: 0 5px;
  color: #58675d;
}

.deck-note {
  margin-top: 9px;
  color: #68756c;
}

.text-button {
  display: block;
  margin: 15px auto 0;
  padding: 10px 18px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 9px;
  background: rgb(255 255 255 / 4%);
  color: #d3ddcf;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.text-button:hover {
  background: rgb(255 255 255 / 8%);
}

.site-footer {
  min-height: 55px;
  margin-top: auto;
  border-top: 1px solid rgb(255 255 255 / 6%);
  color: #647168;
  font-size: 10px;
}

.site-footer span:last-child {
  letter-spacing: 0.3em;
}

@keyframes card-arrive {
  from {
    opacity: 0.65;
    transform: translateY(7px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 28px, 920px);
  }

  .site-header {
    min-height: 68px;
  }

  .header-note {
    max-width: 120px;
    font-size: 10px;
    text-align: right;
  }

  .landing {
    margin: 26px auto;
  }

  .hero-cards {
    margin-bottom: 16px;
  }

  .intro {
    margin-top: 15px;
    font-size: 13px;
  }

  .feature-grid {
    gap: 8px;
  }

  .feature-card {
    min-height: 70px;
    gap: 8px;
    padding: 10px;
  }

  .feature-icon {
    width: 29px;
    height: 29px;
  }

  .game {
    padding-top: 30px;
  }

  .score-player {
    min-height: 69px;
    padding: 11px;
  }

  .player-details {
    gap: 8px;
  }

  .player-icon {
    width: 31px;
    height: 31px;
  }

  .score-number {
    font-size: 24px;
  }

  .table {
    padding: 22px 10px 15px;
  }

  .table-inset {
    grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
    gap: 3px;
  }

  .playing-card {
    width: clamp(96px, 29vw, 145px);
  }

  .versus span {
    width: 34px;
    height: 34px;
    font-size: 9px;
  }

  .card-side h2 {
    font-size: 11px;
  }

  .card-label {
    font-size: 10px;
  }

  .rules-note {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
