:root {
  color-scheme: light;
  --felt: #0b6b4b;
  --felt-dark: #06452f;
  --ink: #15201a;
  --muted: #66736d;
  --line: rgba(255, 255, 255, 0.28);
  --paper: #ffffff;
  --red: #c0392b;
  --black: #111916;
}

* { 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;
  background: linear-gradient(135deg, #f7f8f5, #ffffff);
  color: var(--ink);
}

button, select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid #dbe0dc;
  background: rgba(255,255,255,0.9);
}

.topbar a {
  color: var(--felt-dark);
  font-weight: 800;
  text-decoration: none;
}

.topbar strong {
  margin-right: auto;
}

.topbar button,
.controls button,
.controls select {
  min-height: 38px;
  border: 1px solid #cdd6d0;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
}

.ai-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #cdd6d0;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 750;
}

.ai-toggle input {
  accent-color: var(--felt);
}

.controls button.primary,
.topbar button {
  border-color: var(--felt);
  background: var(--felt);
  color: white;
}

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

.status {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid #dbe0dc;
  color: var(--muted);
  line-height: 1.45;
}

.status strong {
  color: var(--ink);
}

.table {
  min-height: 680px;
  display: grid;
  grid-template-columns: 260px minmax(360px, 1fr) 260px;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 18px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.12), transparent 34rem),
    linear-gradient(145deg, var(--felt), var(--felt-dark));
}

.seat {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  color: white;
  padding: 12px;
}

.seat h2 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 0;
  display: flex;
  justify-content: space-between;
}

.north { grid-column: 2; grid-row: 1; }
.west { grid-column: 1; grid-row: 2; }
.east { grid-column: 3; grid-row: 2; }
.south { grid-column: 2; grid-row: 3; }

.center {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  align-content: center;
  gap: 14px;
}

.auction,
.trick,
.controls,
.rules {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 18px 50px rgba(0,0,0,0.18);
  padding: 14px;
}

.auction {
  min-height: 92px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  font-size: 13px;
}

.auction div {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f1f4f2;
}

.trick {
  min-height: 122px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.card {
  width: 42px;
  height: 58px;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 6px;
  background: var(--paper);
  color: var(--black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 850;
  box-shadow: 0 2px 5px rgba(0,0,0,0.16);
}

.card.red { color: var(--red); }
.card.playable {
  outline: 3px solid rgba(255, 215, 0, 0.9);
  cursor: pointer;
}

.card:disabled {
  cursor: default;
}

.card.hidden {
  color: rgba(255,255,255,0.82);
  background: repeating-linear-gradient(45deg, #174f86, #174f86 6px, #0e3760 6px, #0e3760 12px);
}

.played-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  font-size: 13px;
  color: var(--muted);
}

.rules {
  margin: 18px;
  box-shadow: none;
}

.rules h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.rules p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .table {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .north, .west, .east, .south, .center {
    grid-column: 1;
    grid-row: auto;
  }
}
