:root {
  --bg: #f4f1ea; --panel: #ffffff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e2ddd2;
  --red: #c8102e; --black: #1d1d1f; --accent: #1f6f4a; --accent-ink: #ffffff;
  --good: #1f8a4c; --good-bg: #e6f4ec; --ok: #9a6b00; --ok-bg: #fbf1d9; --bad: #b42318; --bad-bg: #fbe9e7;
  --btn: #faf8f3; --btn-hover: #efe9dd; --vul: #c8102e; --ask: #1f5fbf;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181a; --panel: #222326; --ink: #ececee; --muted: #9a9aa0; --line: #34353a;
    --red: #ff6b6b; --black: #ececee; --accent: #3fae78; --accent-ink: #0d1a13;
    --good: #5fd08f; --good-bg: #183324; --ok: #f0c35a; --ok-bg: #3a2f14; --bad: #ff8a80; --bad-bg: #3d1d1b;
    --btn: #2a2b2f; --btn-hover: #34353a; --vul: #ff8a80; --ask: #6fa8ff;
  }
}
/* Each drill gets its own page hue, so switching is obvious. */
body { --tabs-bg: #e8e3d8; }
body[data-drill="responding"] { --bg: #e8eef4; --tabs-bg: #d9e2ec; }
body[data-drill="competitive"] { --bg: #f2eaef; --tabs-bg: #e6dae2; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body { --tabs-bg: #2a2b2f; }
  :root:not([data-theme="light"]) body[data-drill="responding"] { --bg: #131a22; --tabs-bg: #222c37; }
  :root:not([data-theme="light"]) body[data-drill="competitive"] { --bg: #1d161b; --tabs-bg: #31252e; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink); transition: background-color 0.25s;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
button { font-family: inherit; }
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 48px; }

header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; }
.header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--tabs-bg); }
.tab {
  font-size: 14px; padding: 6px 14px; border-radius: 8px; border: 0;
  background: none; color: var(--muted); cursor: pointer;
}
.tab:hover:not(.active) { color: var(--ink); }
.tab.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
select {
  font-family: inherit; font-size: 14px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
.toggle { cursor: pointer; margin-right: auto; align-self: center; color: var(--muted); font-size: 13px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: inherit; padding: 0 0 0 6px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stack { display: grid; gap: 16px; }

/* Board info and review navigation */
.board-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.board-info { font-size: 14px; color: var(--muted); }
.board-info strong { color: var(--ink); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.nav button {
  font-size: 13px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--btn); color: var(--ink); cursor: pointer;
}
.nav button:hover:not(:disabled) { background: var(--btn-hover); }
.nav button:disabled { opacity: 0.4; cursor: default; }
.reviewing { color: var(--ok); font-weight: 600; }

/* Auction */
.auction { width: 100%; border-collapse: collapse; table-layout: fixed; margin-bottom: 8px; }
.auction th { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); }
.auction th.vul { color: var(--vul); }
.auction td { text-align: center; padding: 3px; height: 34px; }
.auction td button {
  font-size: 16px; font-weight: 600; padding: 4px 10px; border-radius: 6px; border: 1px solid transparent;
  background: none; color: var(--ink); cursor: pointer;
}
.auction td button:hover, .auction td button.selected { border-color: var(--line); background: var(--btn); }
.auction td .ask { font-weight: 700; color: var(--ask); font-size: 18px; }
.auction td button.mine.right { color: var(--good); }
.auction td button.mine.okay { color: var(--ok); }
.auction td button.mine.wrong { color: var(--bad); text-decoration: line-through; }
.explain { font-size: 14px; color: var(--muted); min-height: 42px; margin: 0; }
.explain strong { color: var(--ink); }

/* Hand */
.hand-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.copy {
  font-size: 13px; padding: 6px 10px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--btn); color: var(--muted); cursor: pointer;
}
.copy:hover { background: var(--btn-hover); }
.hand { display: grid; gap: 6px; }
.row { font-size: 26px; font-weight: 600; letter-spacing: 0.02em; word-spacing: 0.3em; min-height: 38px; }
.row .sym { display: inline-block; width: 28px; margin-right: 2px; text-align: center; }
.row .void { color: var(--muted); font-weight: 400; font-size: 18px; }
.red { color: var(--red); } .black { color: var(--black); }
/* All four hands, compass layout */
.compass {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px;
  grid-template-areas: ". n ." "w c e" ". s .";
}
.compass .seat { font-size: 14px; font-weight: 600; line-height: 1.3; word-spacing: 0.15em; }
.compass .seat.n { grid-area: n; } .compass .seat.w { grid-area: w; }
.compass .seat.e { grid-area: e; } .compass .seat.s { grid-area: s; }
.compass .who { font-size: 12px; font-weight: 600; color: var(--muted); word-spacing: 0; margin-bottom: 2px; }
.compass .who.vul { color: var(--vul); }
.compass .sym { display: inline-block; width: 16px; }
.compass .center {
  grid-area: c; align-self: center; justify-self: center; width: 64px; height: 64px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--btn); position: relative; font-size: 12px; font-weight: 600; color: var(--muted);
}
.compass .center span { position: absolute; }
.compass .center .cn { top: 4px; left: 50%; transform: translateX(-50%); }
.compass .center .cs { bottom: 4px; left: 50%; transform: translateX(-50%); }
.compass .center .cw { left: 6px; top: 50%; transform: translateY(-50%); }
.compass .center .ce { right: 6px; top: 50%; transform: translateY(-50%); }
.compass .center .dealer { color: var(--ink); text-decoration: underline; }
.seat-line { font-size: 14px; color: var(--muted); margin: 0 0 10px; }

/* Bidding box */
.bids { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bids button, .specials button {
  font-size: 17px; font-weight: 600; line-height: 1; padding: 11px 0; border-radius: 8px;
  border: 1px solid var(--line); background: var(--btn); color: var(--ink); cursor: pointer;
}
.bids button:hover:not(:disabled), .specials button:hover:not(:disabled) { background: var(--btn-hover); }
.bids button:disabled, .specials button:disabled { opacity: 0.3; cursor: default; }
.specials { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.specials .x { color: var(--red); }
.specials .xx { color: var(--accent); }

/* Feedback */
.verdict-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.verdict { font-weight: 700; font-size: 18px; margin: 0; }
.verdict.right { color: var(--good); } .verdict.wrong { color: var(--bad); }
.next {
  flex: none; font-size: 15px; font-weight: 600; line-height: 1; padding: 10px 14px; border-radius: 8px; border: 0;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.facts { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.whynot { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); }
.feedback ul { margin: 0 0 12px; padding-left: 20px; }
.feedback li { margin-bottom: 4px; }
.sec { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 4px; }
.sec span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.answers { list-style: none; padding-left: 0 !important; font-size: 14px; }
.answers .basis { color: var(--muted); }
.answers .mine { font-weight: 600; }

details { color: var(--muted); font-size: 14px; margin-top: 16px; }
details summary { cursor: pointer; }
details ul { padding-left: 20px; }
details a { color: inherit; }
