/* Play XO - account pages: /login, /account, /reset, /admin. Loaded only there, after style.css.
   Same table as the game pages. The far side (marigold) speaks for the house: the promise,
   your seat with your name on it, notices. The near side (paper) is yours: a white panel
   rises over the seam the way the board does and holds the form, the badge case or the numbers.
   Seats carry over: an empty seat heads the sign-in panel, a filled one is the account title,
   and a badge not yet earned is drawn as an empty seat (dashed disc), an earned one sits on
   a marigold disc, the same disc the badge toast uses. */

:root {
  --panel: #ffffff;
  --field: #ffffff;
  /* field edge: 3:1 against the panel in both schemes (WCAG non-text contrast) */
  --edge: #8f8a83;
}
@media (prefers-color-scheme: dark) {
  :root {
    --panel: #22201c;
    --field: #1b1a18;
  }
}

/* ---------- far side: head and side column ---------- */
.far-page { display: grid; gap: 20px; }
.head { display: grid; gap: 12px; justify-items: start; }
.head .lead { margin-top: 0; }
.head-links { display: flex; gap: 8px; }
.head-links .chip { padding: 6px 10px; text-decoration: none; }

/* your seat, with your name on it (account title) */
.seat-you { padding: 12px 16px; gap: 14px; width: 100%; }
.seat-you .seat-mark { width: 36px; height: 36px; }
.seat-you .seat-who { display: grid; gap: 2px; }
.seat-you .seat-name { font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.seat-you .seat-note { font-size: 15px; overflow-wrap: anywhere; }

/* a note from the house: white card on the table, like a seat */
.verify {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 16px;
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  max-width: 420px;
}
.verify strong { font-weight: 700; }
.verify p { font-size: 15px; line-height: 1.4; color: var(--ink-2); }
.verify .btn { margin-top: 4px; }

/* the badges you can collect: white coins on the table (sign-in page) */
.coins { display: grid; gap: 10px; align-content: start; }
.coins-label { font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--table-ink-2); }
.coin-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
/* on phones the coins are one swipeable row, bleeding to the screen edge */
@media (max-width: 639px) {
  .coin-row { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .coin-row::-webkit-scrollbar { display: none; }
}
.coin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 10px;
  border-radius: var(--r-s);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.coin-emoji { font-size: 18px; line-height: 1; }
.coin-more { background: transparent; border: 2px dashed var(--table-line); color: var(--table-ink); }

/* ---------- near side: the panel over the seam ---------- */
.near-page { margin-top: calc(-1 * var(--overlap)); padding-bottom: 40px; display: grid; gap: 32px; align-items: start; }
.near-page .hint { color: var(--muted); }
.panel {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r-l);
  box-shadow: var(--tile-shadow);
  padding: 20px;
  min-width: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2,
.near-page h2 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.count { font-size: 14px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.count:empty { display: none; }

/* empty seat at the head of the sign-in panel: on paper the dashes are grey, not table-ink */
.panel .seat { padding: 6px 4px; margin-bottom: 16px; border-radius: var(--r); }
.panel .seat.is-empty { border-color: transparent; color: var(--ink); }
.panel .seat.is-empty .seat-note { color: var(--muted); }
.panel .seat.is-empty[data-mark='X'] .seat-mark::before,
.panel .seat.is-empty[data-mark='X'] .seat-mark::after { background: var(--bot); }

.near-aside { display: grid; gap: 12px; justify-items: start; align-self: end; }
.near-aside .hint { color: var(--muted); max-width: 34ch; }
.near-aside .btn { width: 100%; }

/* a message at the top of a panel (confirmed, expired, sent) */
.note-box { padding: 12px 14px; margin-bottom: 16px; border-radius: var(--r); background: var(--tint); font-size: 15px; line-height: 1.4; }
.note-box:last-child { margin-bottom: 0; }

/* ---------- sign in: Google, tabs, forms ---------- */
.btn-google { width: 100%; height: 52px; font-size: 16px; gap: 10px; }
.btn-google svg { width: 20px; height: 20px; flex: none; }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.or::before,
.or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#google[hidden] + .or { display: none; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 20px; border-bottom: 2px solid var(--line); }
.tab {
  height: 48px;
  padding: 0 8px;
  margin-bottom: -2px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.tab:hover { color: var(--ink); background: var(--tint); }
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--ink); }
.tab:focus-visible { outline-offset: -3px; }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input,
.input,
.select {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border: 2px solid var(--edge);
  border-radius: var(--r);
  background: var(--field);
  color: var(--ink);
  font: 400 16px/1 var(--font);
  transition: border-color var(--fast) var(--ease);
}
.field input:hover,
.input:hover,
.select:hover { border-color: var(--ink-2); }
.field input:focus-visible,
.input:focus-visible,
.select:focus-visible { border-color: var(--ink); outline-offset: 0; }
.field-note { font-size: 13px; font-weight: 400; color: var(--muted); }
.form .btn { width: 100%; margin-top: 4px; }
.form .btn-small { width: auto; }
/* an error is an X on the sheet: small crimson cross, ink text */
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.form-error::before {
  content: '';
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  background:
    linear-gradient(45deg, transparent calc(50% - 1.6px), var(--x) calc(50% - 1.6px) calc(50% + 1.6px), transparent calc(50% + 1.6px)),
    linear-gradient(-45deg, transparent calc(50% - 1.6px), var(--x) calc(50% - 1.6px) calc(50% + 1.6px), transparent calc(50% + 1.6px));
}
.linkline { font-size: 14px; color: var(--muted); }
.linkline a { color: var(--ink); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.form .linkline { margin-top: 4px; }

/* ---------- badges: the case ---------- */
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge {
  display: grid;
  gap: 4px;
  justify-items: start;
  align-content: start;
  padding: 12px;
  border-radius: var(--r);
  background: var(--tint);
  transition: background-color var(--med) var(--ease);
}
/* not yet earned: an empty seat, dashed disc, the emoji waits in grey */
.badge-emoji {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border: 2px dashed var(--muted);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.75;
}
.badge-name { font-weight: 600; line-height: 1.25; color: var(--ink-2); }
.badge-desc { font-size: 13px; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
/* earned: a tile on the table, the emoji on a marigold disc */
.badge.is-earned { background: var(--cell); box-shadow: var(--tile-shadow); }
.badge.is-earned .badge-emoji { border: 0; background: var(--table); filter: none; opacity: 1; }
.badge.is-earned .badge-name { color: var(--ink); }
.badges:empty { min-height: 120px; }

/* ---------- stats: a scoreboard list ---------- */
.stats-section { display: grid; gap: 12px; }
.stats { margin: 0; display: grid; gap: 0 32px; }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.stat dt { font-size: 15px; color: var(--ink-2); }
.stat dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- settings: a list with the title in the margin ---------- */
.settings { display: grid; }
.setting { display: grid; gap: 12px; padding: 24px 0; border-top: 1px solid var(--line); align-items: start; }
.setting:last-child { border-bottom: 1px solid var(--line); }
.setting h2 { font-size: 18px; }
.setting-body { display: grid; gap: 12px; justify-items: start; }
.setting-body p { max-width: 48ch; }
.setting .form { max-width: 400px; }
.setting .btn { width: auto; min-width: 0; }
.setting .form .btn { width: auto; min-width: 0; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.danger h2 { color: var(--x); }
.btn-danger { color: var(--x); border-color: var(--x); }
.btn-danger:hover:enabled { background: var(--x); color: #ffffff; }
/* .btn-small lives in style.css */

/* ---------- admin ---------- */
.admin-section { display: grid; gap: 16px; align-content: start; }
.admin-two { display: grid; gap: 32px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card { display: grid; gap: 2px; align-content: start; padding: 12px 14px; border-radius: var(--r); background: var(--tint); }
.card strong { font-size: 24px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.card span { font-size: 13px; line-height: 1.3; color: var(--muted); text-wrap: pretty; }
/* the number that matters sits on the table */
.card.is-key { background: var(--table); color: var(--table-ink); }
.card.is-key span { color: var(--table-ink-2); }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; -webkit-overflow-scrolling: touch; }
.table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left;
  padding: 0 12px 8px;
  border-bottom: 2px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child,
.table td:first-child { padding-left: 0; }
.table tbody tr:hover { background: var(--tint); }
.table a { color: var(--ink); font-weight: 600; text-decoration-color: var(--line); text-underline-offset: 3px; }
.table a:hover { text-decoration-color: currentColor; }
.table .num { text-align: right; }
.table .dim { color: var(--muted); }
.table tbody:empty::after { content: 'Nothing here yet.'; display: block; padding: 12px 0; color: var(--muted); }

/* badges awarded: one bar per badge, drawn in ink */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 520px; }
.bar { display: grid; grid-template-columns: 24px minmax(88px, 120px) minmax(0, 1fr) 36px; align-items: center; gap: 8px; font-size: 14px; }
.bar-emoji { text-align: center; line-height: 1; }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; border-radius: 5px; background: var(--tint); overflow: hidden; }
.bar-fill { height: 100%; width: var(--w, 0%); min-width: 0; border-radius: inherit; background: var(--ink); transition: width var(--med) var(--ease); }
.bar-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; max-width: 480px; }
.search .input { height: 48px; }
.search .btn { width: auto; min-width: 0; height: 48px; }
.pager { display: flex; gap: 8px; margin: 0; }
.pager .btn { width: auto; min-width: 0; }

.user-box { display: grid; gap: 12px; }
.user-box h2 { overflow-wrap: anywhere; }
.meta { font-size: 13px; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.actions .btn { width: auto; min-width: 0; }
.actions .select { width: auto; height: 44px; padding-right: 32px; }
.events { list-style: none; margin: 4px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.events li { display: flex; flex-wrap: wrap; gap: 0 8px; }
.events time { color: var(--ink-2); }
.events .ev { color: var(--ink); font-weight: 600; }

/* ---------- wider screens ---------- */
@media (min-width: 640px) {
  .far-page { grid-template-columns: minmax(0, 400px) minmax(220px, 1fr); column-gap: 32px; align-items: start; }
  .far-page > .verify,
  .far-page > .coins { justify-self: start; }
  .near-page { grid-template-columns: minmax(0, 400px) minmax(220px, 1fr); column-gap: 32px; }
  .near-page.is-one { grid-template-columns: minmax(0, 1fr); }
  .near-aside .btn { width: auto; }
  .panel { padding: 28px; }
  .table-wrap { margin: 0; padding: 0; }
  .badges { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .setting { grid-template-columns: 200px minmax(0, 1fr); column-gap: 32px; }
  .setting .btn { width: auto; }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .seat-you .seat-name { font-size: 28px; }
}
@media (min-width: 960px) {
  .far-page,
  .near-page { grid-template-columns: 460px minmax(0, 1fr); column-gap: 56px; }
  .near-page.is-one { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 32px; }
  .badges { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .admin-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; }
  .setting { grid-template-columns: 240px minmax(0, 1fr); column-gap: 56px; }
  .seat-you { padding: 14px 18px; }
  .seat-you .seat-mark { width: 40px; height: 40px; }
  .seat-you .seat-name { font-size: 32px; }
}

/* Юридические страницы */
.legal h2 { margin: 24px 0 6px; font-size: 18px; }
.legal p { margin: 0 0 12px; line-height: 1.55; max-width: 62ch; }
