/* Surface layouts: play, leaderboards, auth, profile, about. */

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100vh;
}
body {
  background:
    radial-gradient(ellipse 120% 90% at 30% 10%, rgba(38, 54, 43, 0.5), transparent 60%),
    var(--ground);
  color: var(--ink);
  font-family: var(--font-chalk);
  font-size: var(--text-md);
}

.top-bar {
  border-bottom: var(--line) solid rgba(207, 214, 202, 0.35);
  padding: 0 var(--space-4);
  background: rgba(16, 22, 19, 0.6);
}
.top-bar .chalk-nav {
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  font-family: var(--font-display) !important;
  font-size: var(--text-xl) !important;
  color: var(--ink) !important;
  margin-right: var(--space-4);
}
.user-status {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.user-status a {
  color: var(--amber-300);
  text-decoration: none;
}

.outlet {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4);
}

/* crawlable/accessible h1 kept visually off the chalkboard surface */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- play surface: three distinct zones (opponents / board / my hand) ---- */
.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: var(--space-4);
  min-height: calc(100vh - var(--nav-height) - 3 * var(--space-4));
}
.table-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
}

/* zone separation: each region gets a label + its own visual weight */
.zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.zone-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-xs);
  margin: 0;
}

/* OPPONENTS: top, small cards in seats */
.zone-opponents .opponents-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}
.opponent-seat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opponent-seat .seat-label {
  font-size: var(--text-xs);
  color: var(--ink-faint);
}
.opponent-seat .seat-cards {
  display: flex;
  gap: var(--space-1);
}
.zone-opponents .card-slot {
  width: 46px;
  height: 64px;
}

/* BOARD: chalk-drawn center strip — visually distinct band */
.zone-board .board-strip {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  border: var(--line) dashed var(--chalk-500);
  border-radius: var(--radius-panel);
  padding: var(--space-2) var(--space-3);
  background: rgba(16, 22, 19, 0.55);
  min-height: 104px;
}
.zone-board .card-slot {
  width: 64px;
  height: 89px;
}
.board-slot-empty {
  width: 64px;
  height: 89px;
  border: 1px dashed var(--chalk-600);
  border-radius: var(--radius-card);
  opacity: 0.45;
  position: relative;
}
.board-slot-empty::after {
  content: attr(data-street);
  position: absolute;
  inset: auto 0 4px 0;
  text-align: center;
  font-family: var(--font-chalk);
  font-size: 9px;
  color: var(--chalk-600);
}

/* MY HAND: bottom, largest cards, amber label — what you act on */
.zone-my-hand {
  border-top: var(--line) solid rgba(207, 214, 202, 0.25);
  padding-top: var(--space-3);
}
.zone-label--mine {
  color: var(--amber-300);
  font-size: var(--text-sm);
}
.zone-my-hand .my-cards {
  display: flex;
  gap: var(--space-2);
}
.zone-my-hand .card-slot {
  width: 84px;
  height: 118px;
}

.deal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.guess-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  align-self: start;
  position: sticky;
  top: var(--space-4);
}
.reveal-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.verdict {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  text-align: center;
  min-height: 2.4rem;
}
.verdict--good {
  color: var(--chalk-200);
}
.verdict--off {
  color: var(--amber-300);
}

/* ---- generic list/table surfaces ---- */
.chalk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-lg);
}
.chalk-table th {
  font-family: var(--font-display);
  font-weight: 600;
  text-align: left;
  color: var(--ink-soft);
  border-bottom: var(--line) solid var(--chalk-400);
  padding: var(--space-2);
}
.chalk-table td {
  padding: var(--space-2);
  border-bottom: 1px dashed var(--chalk-600);
}
.chalk-table td.num,
.chalk-table th.num {
  text-align: right;
  font-family: var(--font-numbers);
}

/* ---- forms ---- */
.chalk-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-5);
}
.chalk-form label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.chalk-form input {
  background: var(--slate-800);
  border: var(--line) solid var(--chalk-500);
  border-radius: var(--radius-panel);
  color: var(--ink);
  font-family: var(--font-chalk);
  font-size: var(--text-lg);
  padding: var(--space-2);
}
.chalk-form input:focus {
  border-color: var(--accent);
}
.form-error {
  color: var(--clay-400);
  min-height: 1.4em;
}

/* ---- history cards ---- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.history-item {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3);
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ---- responsive: mobile is first-class ---- */
@media (max-width: 900px) {
  .play-grid {
    grid-template-columns: 1fr;
  }
  .guess-panel {
    /* relative (not static) so the panel keeps the containing block for its
       corner ticks; sticky is neutralised either way. */
    position: relative;
  }
  .zone-opponents .card-slot {
    width: 38px;
    height: 53px;
  }
  .zone-board .card-slot,
  .board-slot-empty {
    width: 52px;
    height: 73px;
  }
  .zone-my-hand .card-slot {
    width: 72px;
    height: 101px;
  }
  .outlet {
    padding: var(--space-3);
  }
}

/* ---- responsive: compact header (<=600px) ---- */
/* Two rows: brand + status on the first line, nav links on the second. A
   full-basis pseudo-element forces the line break so the rows never collide. */
@media (max-width: 600px) {
  .top-bar {
    padding: 0 var(--space-3);
  }
  .top-bar .chalk-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--space-3);
    row-gap: 0;
    height: auto;
    padding: var(--space-2) 0;
  }
  .top-bar .chalk-nav .brand {
    order: 1;
    display: flex;
    align-items: center;
    min-height: 44px;
    flex: 0 1 auto;
    margin-right: 0;
    font-size: var(--text-lg) !important;
    white-space: nowrap;
  }
  .top-bar .chalk-nav .user-status {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    margin-left: 0;
    text-align: right;
    overflow-wrap: break-word;
  }
  /* zero-height full-width item: forces the nav links onto their own row */
  .top-bar .chalk-nav::after {
    content: "";
    order: 3;
    flex: 0 0 100%;
    height: 0;
  }
  .top-bar .chalk-nav > a:not(.brand) {
    order: 4;
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-top: var(--space-2);
    padding: 0 var(--space-1);
  }
  /* 44px touch target; inline-flex grows the line instead of overlapping */
  .top-bar .chalk-nav .user-status a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-1);
    vertical-align: middle;
  }
}

/* ---- responsive: narrow phones (<=430px) ---- */
@media (max-width: 430px) {
  .table-panel {
    padding: var(--space-3);
  }
  /* board strip wraps and slots shrink so five fit within the panel */
  .zone-board .board-strip {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: var(--space-2);
    padding: var(--space-2);
  }
  .zone-board .card-slot,
  .board-slot-empty {
    width: 48px;
    height: 67px;
  }
  .zone-my-hand .my-cards {
    flex-wrap: wrap;
  }
}
