/* Main menu, leaderboard and waiting room, in the "Bureau" look: graph paper, sticky notes and
   index cards on the wooden desk. Shared tokens (--paper, --ink, --red, ...) come from style.css. */

.menu-screen {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  min-height: 100dvh; padding: max(20px, env(safe-area-inset-top)) 16px 28px;
}
.menu-top { width: min(940px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu-title {
  color: var(--paper); font-size: clamp(2.1rem, 6vw, 3.4rem); line-height: 1.05;
  text-shadow: 2px 3px 0 rgba(0, 0, 0, 0.3); transform: rotate(-1.5deg);
}
.menu-subtitle { width: min(940px, 100%); margin: -6px 0 6px; color: var(--paper); font-family: var(--script); font-size: 1.5rem; }

.paper-sheet {
  position: relative; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 20px 20px; box-shadow: 3px 8px 16px rgba(60, 40, 0, 0.3);
}
.paper-sheet::before {
  content: ""; position: absolute; left: calc(50% - 50px); top: -12px; width: 100px; height: 24px;
  background: rgba(255, 255, 255, 0.55); transform: rotate(-2deg);
}
.menu-heading { margin: 0; font-family: var(--script); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--red); }

/* home: name note, play sheet, side tiles */
.menu-desk {
  width: min(940px, 100%); display: grid; gap: 22px 26px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "name side" "sheet side";
}
.menu-name { grid-area: name; justify-self: start; width: min(340px, 100%); padding: 16px 20px; }
.menu-name input { font-size: 1.4rem; }
.menu-desk > .menu-sheet { grid-area: sheet; }
.menu-side { grid-area: side; display: flex; flex-direction: column; gap: 22px; padding-top: 6px; }

.mode-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-chips.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mode-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 12px; border-style: dashed; background: var(--paper-2); min-height: 84px;
}
.mode-chip strong { font-size: 1.25rem; }
.mode-chip small { line-height: 1.2; }
.mode-chip.active { border-style: solid; border-color: var(--red); background: var(--highlight); box-shadow: 2px 3px 0 var(--ink); }
.mode-chips.compact .mode-chip { min-height: 0; }
.mode-chips.compact .mode-chip small { display: none; }

.menu-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-actions button { height: 56px; font-size: 1.25rem; }
.menu-code { display: flex; align-items: flex-end; gap: 10px; padding-top: 4px; border-top: 1.5px dashed var(--ink-soft); }
.menu-code label { flex: 1; padding-top: 10px; }
.menu-code button { flex: none; }

.menu-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  padding: 50px 18px 18px; text-align: left; border: none; border-radius: 2px;
  box-shadow: 2px 6px 12px rgba(60, 40, 0, 0.25); transition: transform 0.12s ease;
}
.menu-tile strong { font-family: var(--marker); font-weight: 400; font-size: 1.5rem; }
.menu-tile:hover:not(:disabled) { transform: rotate(0deg) translateY(-2px); background-color: #fff; }
.scrap-tile { background: var(--sticky); transform: rotate(-1.4deg); padding-top: 22px; }
.scrap-tile:hover:not(:disabled) { background: var(--sticky); }

/* leaderboard */
.ranks-sheet { width: min(560px, 100%); }
.ranks-sheet > button { align-self: flex-start; }
.ranks-table { width: 100%; border-collapse: collapse; font-size: 1.15rem; }
.ranks-table th { font-family: var(--script); font-size: 1.4rem; text-align: left; border-bottom: 2px solid var(--ink); }
.ranks-table td { padding: 5px 4px; border-bottom: 1px solid var(--ink-soft); }
.ranks-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ranks-table .place { width: 2.2em; font-family: var(--marker); color: var(--muted); }
.ranks-table tr:nth-child(2) .place { color: var(--red); }
.ranks-table .who { overflow-wrap: anywhere; }
.ranks-table tr.me td { background: var(--highlight); }
.ranks-table .empty { border: none; color: var(--muted); padding: 12px 0; }

/* waiting room */
.room-sheet { width: min(760px, 100%); }
.room-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.room-code {
  font-family: var(--marker); font-size: 1.8rem; letter-spacing: 0.12em; color: var(--ink);
  background: linear-gradient(transparent 55%, var(--highlight) 55%);
}
.room-badge { padding: 4px 12px; background: var(--sticky); box-shadow: 1px 2px 0 var(--ink-soft); transform: rotate(1.5deg); }
.room-share { display: flex; gap: 10px; align-items: flex-end; }
.room-share input { flex: 1; min-width: 0; font-size: 0.95rem; color: var(--muted); }
.room-share button { flex: none; }

.room-seats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.room-seats:has(.team) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.team-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.team-head h3 { margin: 0; font-family: var(--script); font-size: 1.7rem; }
.team-0 .team-head h3 { color: var(--red); }
.team-1 .team-head h3 { color: #2b6cb0; }
.seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.seat { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 4px; border-bottom: 1.5px dashed var(--ink-soft); font-size: 1.2rem; }
.seat .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.seat .tag { font-size: 0.9rem; }
.seat .check { width: 1.2em; font-family: var(--marker); color: var(--green); }
.seat .remove { padding: 0 8px; }
.seat.me .name { text-decoration: underline wavy var(--red); text-underline-offset: 4px; }
.seat.open { color: var(--muted); }
.seat.open .dot { border-style: dashed; background: transparent; }
.seat.open .name { font-style: italic; }
.seat.open button { font-size: 0.95rem; }

.room-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.room-actions button { height: 48px; padding: 0 18px; font-size: 1.15rem; }
.room-actions [data-action="leave-room"] { margin-right: auto; }

/* game-over ranking and team tags in the in-game table */
#overlay ol.ranking { list-style: none; padding: 0; }
#overlay .row { gap: 12px; }
.team-tag {
  display: inline-block; min-width: 1.4em; padding: 0 4px; border-radius: 4px; text-align: center;
  font-family: var(--marker); font-size: 0.8rem; color: #fff;
}
.team-tag.team-0 { background: var(--red); }
.team-tag.team-1 { background: #2b6cb0; }

/* phones */
@media (max-width: 800px) {
  .menu-screen { padding-top: max(14px, env(safe-area-inset-top)); gap: 8px; }
  .menu-title { font-size: clamp(1.6rem, 8vw, 2.4rem); }
  .menu-subtitle { font-size: 1.1rem; margin: -4px 0 8px; }
  .menu-desk { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "sheet" "side"; gap: 18px; }
  .menu-name { width: 100%; }
  .menu-side { flex-direction: row; gap: 14px; padding-top: 0; }
  .menu-tile { padding: 18px 14px 14px; }
  .menu-tile strong { font-size: 1.25rem; }
  .paper-sheet { padding: 18px 16px; }
  .mode-chips { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .mode-chip { min-height: 0; padding: 8px 12px; }
  .mode-chip strong { font-size: 1.15rem; }
  .mode-chip:not(.active) small { display: none; }
  .menu-actions button { height: 50px; }
  .mode-chips.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-actions { grid-template-columns: minmax(0, 1fr); }
  .room-seats:has(.team) { grid-template-columns: minmax(0, 1fr); }
  .room-actions button { flex: 1; }
  .room-actions [data-action="leave-room"] { margin-right: 0; }
}
