:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2520;
  background: #f1f4ef;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 1px solid #166534;
  border-radius: 0.45rem;
  color: #fff;
  background: #166534;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #14532d;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

button.secondary {
  color: #166534;
  background: #fff;
}

input {
  min-height: 2.75rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid #88958d;
  border-radius: 0.45rem;
  background: #fff;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 1.5rem;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1;
}

h2,
h3 {
  margin-bottom: 0.65rem;
}

h4 {
  margin-bottom: 0.5rem;
}

.shell {
  width: min(62rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.eyebrow {
  margin-bottom: 0.35rem;
  color: #4b5e53;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.panel {
  padding: 1.2rem;
  border: 1px solid #ccd5cf;
  border-radius: 0.7rem;
  background: #fff;
  box-shadow: 0 1px 2px rgb(27 37 32 / 8%);
}

.setup-panel {
  max-width: 38rem;
}

.setup-panel > p {
  color: #4b5e53;
}

.setup-actions,
.join-fields {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.setup-actions {
  margin-top: 1rem;
}

.join-fields {
  flex: 1;
}

.join-fields input {
  width: 9rem;
  text-transform: uppercase;
}

.or,
.muted {
  color: #64736a;
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.game-heading.is-your-turn {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgb(22 163 74 / 18%);
}

.game-heading h2,
.turn-status {
  margin-bottom: 0;
}

.turn-status {
  max-width: 24rem;
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  color: #33463b;
  background: #e7ede9;
  font-weight: 700;
  text-align: right;
}

.turn-status.is-your-turn {
  color: #fff;
  background: #15803d;
  box-shadow: 0 0 0 4px rgb(21 128 61 / 15%);
}

.turn-status.is-opponent-turn {
  color: #78350f;
  background: #fef3c7;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.score-card {
  padding: 0.85rem 1rem;
  border-radius: 0.55rem;
  color: #fff;
  background: #244f37;
}

.score-card strong,
.score-card span {
  display: block;
}

.score-card span {
  margin-top: 0.2rem;
  color: #dce8df;
  font-size: 0.9rem;
}

.table-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(13rem, 1fr);
  align-items: start;
  gap: 1rem;
}

.table-panel {
  grid-column: 1;
}

.opponent-panel {
  grid-column: 2;
}

.hand-panel,
.action-panel,
.events-panel {
  grid-column: 1 / -1;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.facts div {
  padding: 0.55rem;
  border-radius: 0.35rem;
  background: #f1f4ef;
}

.facts dt {
  color: #64736a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.facts dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
}

.card-row,
.action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.card {
  min-width: 6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #9aa69f;
  border-radius: 0.4rem;
  color: #1b2520;
  background: #fff;
  font-weight: 700;
  text-align: center;
}

.card.red {
  color: #b42318;
}

.card-button {
  min-height: 4.5rem;
  cursor: pointer;
}

.card-button:hover:not(:disabled) {
  border-color: #166534;
  color: #fff;
  background: #166534;
  transform: translateY(-2px);
}

.card-button.red:hover:not(:disabled) {
  color: #fff;
}

.action-list button {
  text-align: left;
}

.events {
  margin: 0;
  padding-left: 1.25rem;
}

.events li + li {
  margin-top: 0.35rem;
}

.message {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: #b42318;
  font-weight: 700;
}

.message.info {
  color: #4b5e53;
}

.game-dialog {
  width: min(28rem, calc(100% - 2rem));
  padding: 1.5rem;
  border: 1px solid #9aa69f;
  border-radius: 0.75rem;
  color: #1b2520;
  background: #fff;
  box-shadow: 0 1rem 3rem rgb(27 37 32 / 25%);
}

.game-dialog::backdrop {
  background: rgb(15 23 19 / 55%);
}

.game-dialog p {
  color: #4b5e53;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1rem, 40rem);
    padding-top: 1rem;
  }

  .setup-actions,
  .join-fields,
  .game-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .join-fields input,
  .join-fields button {
    width: 100%;
  }

  .or {
    text-align: center;
  }

  .turn-status {
    text-align: left;
  }

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

  .hand-panel,
  .action-panel,
  .events-panel,
  .table-panel,
  .opponent-panel {
    grid-column: auto;
  }

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