:root {
  color-scheme: dark;
  --bg: #0f241d;
  --bg-soft: #17382e;
  --panel: #f7efe0;
  --panel-ink: #1c241f;
  --muted: #bed5c7;
  --gold: #f3c969;
  --red: #cf3d4c;
  --black: #17211d;
  --felt: #1d5b46;
  --felt-dark: #143d31;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f8f3e9;
  background:
    radial-gradient(circle at top left, rgba(243, 201, 105, 0.16), transparent 32rem),
    linear-gradient(135deg, #081610, var(--bg));
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-weight: 800;
  color: #1c241f;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 0.9;
}

h2 {
  margin-bottom: 0.5rem;
}

.subtitle,
.hint,
#round-info {
  color: var(--muted);
}

.subtitle {
  max-width: 46rem;
  margin-bottom: 0;
}

.table {
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  min-height: 420px;
  margin-bottom: 1rem;
  border: 10px solid #6d432b;
  border-radius: 2rem;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.09), transparent 34%),
    linear-gradient(160deg, var(--felt), var(--felt-dark));
  box-shadow: var(--shadow), inset 0 0 42px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.opponent {
  position: absolute;
  display: grid;
  gap: 0.25rem;
  min-width: 8rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  color: #f8f3e9;
  background: rgba(8, 22, 16, 0.52);
  backdrop-filter: blur(10px);
}

.opponent span {
  color: var(--muted);
  font-size: 0.85rem;
}

.opponent-left {
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
}

.opponent-top {
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.opponent-right {
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  text-align: right;
}

.trick-area {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 1rem;
  width: min(520px, calc(100% - 2rem));
  text-align: center;
}

.trick {
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 0.75rem;
  min-height: 132px;
  align-items: center;
}

.played-card {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.status {
  min-height: 2.8rem;
  margin: 0;
  color: #fff7e6;
  font-size: 1.1rem;
  font-weight: 800;
}

.secondary {
  justify-self: center;
  color: #f8f3e9;
  background: var(--bg-soft);
  outline: 2px solid rgba(255, 255, 255, 0.18);
}

.panel {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border-radius: 1.4rem;
  color: var(--panel-ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel .hint,
.panel #round-info {
  color: #617064;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-height: 130px;
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  width: 74px;
  height: 108px;
  border: 2px solid #fefcf7;
  border-radius: 0.75rem;
  color: var(--black);
  background: #fffaf0;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  user-select: none;
}

.card.red {
  color: var(--red);
}

.card.playable {
  transform: translateY(-8px);
  outline: 3px solid var(--gold);
}

.card.selected {
  transform: translateY(-16px);
  outline: 4px solid #7dcfff;
}

.card.disabled {
  filter: grayscale(0.4);
  opacity: 0.58;
}

.rank {
  font-size: 1.45rem;
  font-weight: 900;
}

.suit {
  font-size: 2rem;
  line-height: 1;
}

.scores {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.score-card {
  padding: 0.85rem;
  border-radius: 1rem;
  background: rgba(29, 91, 70, 0.12);
}

.score-card.current {
  outline: 3px solid var(--gold);
}

.score-card strong {
  display: block;
  font-size: 1.8rem;
}

.hidden {
  display: none;
}

@media (max-width: 740px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .table {
    min-height: 360px;
  }

  .opponent {
    min-width: auto;
    padding: 0.65rem 0.75rem;
    font-size: 0.88rem;
  }

  .card {
    width: 58px;
    height: 86px;
  }

  .rank {
    font-size: 1.1rem;
  }

  .suit {
    font-size: 1.5rem;
  }

  .scores {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
