/* Plain, high-legibility look shared by all pages. */
:root {
  --bg: #ffffff; --fg: #15181d; --muted: #4f5661; --line: #c8cdd5; --soft: #f1f3f6;
  --accent: #1f4fbf; --accent-fg: #ffffff;
  --pick: #17643a; --pick-fg: #ffffff;
  --note-bg: #fff7e0; --note-line: #e2c675;
  --bad: #a3261b; --good: #17643a; --warn: #a24b00;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", "Nirmala UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417; --fg: #eceef1; --muted: #a9b0bb; --line: #3b414a; --soft: #1b1f24;
    --accent: #86a8ff; --accent-fg: #0c1426; --pick: #3fa86a; --pick-fg: #06150c;
    --note-bg: #2a2410; --note-line: #6b5a22; --bad: #ff8a7a; --good: #6fd38f; --warn: #f0b45a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 17px; line-height: 1.5;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 110px max(16px, env(safe-area-inset-left, 0px));
}
.wrap { max-width: 980px; margin: 0 auto; }
header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; }
h1 { font-size: 1.45rem; margin: 0; line-height: 1.2; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.lang { display: flex; gap: 6px; }
.lang button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 6px; font: inherit; font-size: .95rem; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.banner { margin: 12px 0 0; padding: 10px 14px; background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 6px; font-size: .97rem; }
nav.tabs {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; flex-wrap: wrap; gap: 0 2px; margin-top: 12px; border-bottom: 2px solid var(--line);
}
nav.tabs a {
  flex: 0 0 auto; padding: 10px 10px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: .97rem;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
nav.tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main { padding-top: 6px; }
h2 { font-size: 1.3rem; margin: 18px 0 8px; line-height: 1.25; }
h3 { font-size: 1.08rem; margin: 0 0 6px; }
p { margin: 0 0 10px; max-width: 72ch; }
.muted { color: var(--muted); }
.bad { color: var(--bad); font-weight: 600; }
.good { color: var(--good); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
ol.steps { margin: 0; padding-left: 1.6em; display: grid; gap: 8px; }
ol.steps li { font-size: 1.12rem; font-weight: 700; line-height: 1.45; }
.tablewrap { overflow-x: auto; }
table.ex { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .97rem; }
table.ex th, table.ex td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
table.ex td:first-child, table.ex th:first-child { text-align: center; width: 3.5em; }
s { color: var(--muted); }
.box { border: 2px solid var(--fg); padding: 12px 16px; margin-top: 16px; max-width: 760px; }
.box ol { margin: 0; padding-left: 1.3em; }
.box li { margin: 6px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border-radius: 8px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-fg);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .92rem; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.panel { border: 1px solid var(--line); background: var(--soft); border-radius: 8px; padding: 12px 14px; margin: 12px 0; max-width: 760px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; max-width: 760px; }
.big { font-size: 1.4rem; font-weight: 800; }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .04em; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
select, input[type="text"], input[type="password"], input[type="number"], textarea {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; min-height: 48px; width: 100%; max-width: 360px;
}
textarea { max-width: 100%; min-height: 110px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* Choose flats */
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 12px; }
.blk { border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-width: 0; }
.blk h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tag { font-size: .8rem; font-weight: 600; color: var(--muted); }
table.bt { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
table.bt th { font-size: .82rem; color: var(--muted); font-weight: 600; text-align: center; padding: 0; }
table.bt td { padding: 0; }
button.flat {
  position: relative; width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--soft); color: var(--fg); font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; padding: 6px 4px; font-variant-numeric: tabular-nums;
}
button.flat.on { background: var(--pick); color: var(--pick-fg); border-color: var(--pick); }
.rk {
  position: absolute; top: -8px; right: -6px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px;
  background: var(--fg); color: var(--bg); font-size: .78rem; display: inline-flex; align-items: center; justify-content: center;
}
.fn { font-size: .88rem; color: var(--muted); margin-top: 12px; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--bg); border-top: 2px solid var(--line);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.bar .in { max-width: 980px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.bar b { font-size: 1.05rem; }

/* My list */
ol.mylist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; max-width: 760px; }
ol.mylist li { display: grid; grid-template-columns: 2.6em 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pos { font-size: 1.25rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.what { min-width: 0; }
.what b { display: block; font-size: 1.05rem; }
.what span { color: var(--muted); font-size: .9rem; }
.acts { display: flex; gap: 6px; }
.acts button {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg);
  font-size: 1.1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.acts button:disabled { opacity: .3; cursor: not-allowed; }

/* Draw / results */
.result { border: 2px solid var(--fg); border-radius: 8px; padding: 14px 16px; margin: 14px 0; max-width: 760px; }
.result .turn { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.result ul { margin: 0 0 10px; padding-left: 1.2em; }
.result .get { font-size: 1.3rem; font-weight: 800; margin: 6px 0 0; }
table.grid { border-collapse: collapse; width: 100%; font-size: .95rem; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
table.grid th { background: var(--soft); }
table.grid tr.me td { font-weight: 800; background: var(--soft); }
footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  ol.mylist li { grid-template-columns: 2.2em 1fr; }
  .acts { grid-column: 1 / -1; justify-content: flex-end; }
}
