/* Tinkertable's look: one stylesheet for Maps, Cards, sign-in, and the account page. DESIGN.md explains it.
   Plain CSS, so it works offline and needs no build. The rule it follows: anything you press is a
   piece that stands up, anything you type into or tick is a slot sunk into the panel, and "on" is a
   piece sitting in its slot.

   Nothing here reaches what prints. Boards and cards carry their own font and colours (INK, MUTED,
   CARD, FONT in base.js; .card and .sheet in cards.html), so no rule below may set a property that a
   card or board would inherit, such as line-height or number style, on body or #app. */
@layer theme, base, components, utilities;

@font-face { font-family: "Gabarito"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("/static/gabarito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Gabarito"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("/static/gabarito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/atkinson-hyperlegible-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/static/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/atkinson-hyperlegible-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/atkinson-hyperlegible-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Type */
  --tt-font-ui: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --tt-font-display: "Gabarito", "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --tt-font-num: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* The table: neutral, so a game's own colours read true on the stage. */
  --tt-ink: #1b1c1f;
  --tt-muted: #5b5d66;
  --tt-rule: #d3d4d8;
  --tt-stage: #e3e3e3;
  --tt-stage-dot: #bdbdbd;
  --tt-panel: #f7f7f9;

  /* Pieces stand up; slots are sunk in. */
  --tt-piece: #ffffff;
  --tt-piece-edge: #bcc0c9;
  --tt-slot: #eceef2;
  --tt-slot-line: #c6c9d1;
  --tt-slot-edge: #d6d9e0;
  --tt-edge: 3px;
  --tt-radius: 6px;

  /* Yellow is an action you can take, and nothing else. */
  --tt-action: #f5b914;
  --tt-action-edge: #bd8a00;
  --tt-action-deep: #7a5900;  /* its edge on a coloured bar */

  /* Orange is something to fix: the darker shade for words, the brighter for a piece. */
  --tt-warn: #b34a00;
  --tt-warn-wash: #fdf0e6;
  --tt-fix: #d9620a;
  --tt-fix-edge: #8a3a00;

  /* A grey piece is a plain count. */
  --tt-count: #8a8c96;
  --tt-count-edge: #62646d;

  /* The open tool's colour. Near-black away from the tools: sign-in, account, email. */
  --tt-tool: #1b1c1f;
  --tt-tool-edge: #000000;
  --tt-tool-slot: #2b2c31;
  --tt-tool-deep: #000000;
  --tt-tool-lift: #3c3e45;
  --tt-tool-wash: #ececef;
  --tt-bar-muted: #c9cad1;

  --tt-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --tt-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --tt-tick-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%231b1c1f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --tt-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%231b1c1f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  accent-color: var(--tt-tool);
  caret-color: var(--tt-tool);
}
:root[data-tool="maps"] {
  --tt-tool: #1d52c0; --tt-tool-edge: #143a8c; --tt-tool-slot: #17429c; --tt-tool-deep: #102f70; --tt-tool-lift: #2f68dc;
  --tt-tool-wash: #e6edfb; --tt-bar-muted: #c8d5f4;
}
:root[data-tool="cards"] {
  --tt-tool: #c53422; --tt-tool-edge: #8f2417; --tt-tool-slot: #a82a1a; --tt-tool-deep: #741c11; --tt-tool-lift: #d23f2b;
  --tt-tool-wash: #fbe9e6; --tt-bar-muted: #fdeae6;
}

@layer base {
  *, ::before, ::after { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body { font-family: var(--tt-font-ui); background: var(--tt-stage); color: var(--tt-ink); }
  button, input, select, textarea { font: inherit; color: inherit; }
  ::selection { background: var(--tt-tool); color: #fff; }
  :focus-visible { outline: 2px solid var(--tt-ink); outline-offset: 2px; }
  .tt-scroll { scrollbar-width: thin; scrollbar-color: var(--tt-piece-edge) transparent; }
  @media print { body { background: #fff; } }
}

@layer components {
  /* ---------- pieces: anything you press ---------- */
  .btn, .btn-lg, select.field {
    --face: var(--tt-piece); --face-ink: var(--tt-ink); --edge: var(--tt-piece-edge);
    border: 1px solid var(--edge); border-radius: var(--tt-radius); background-color: var(--face); color: var(--face-ink);
    box-shadow: 0 var(--tt-edge) 0 var(--edge); margin-bottom: var(--tt-edge);
    font-size: 0.875rem; line-height: 1.2; cursor: pointer;
    transition: transform 90ms var(--tt-ease), box-shadow 90ms var(--tt-ease);
  }
  .btn, .btn-lg {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
    min-height: 2rem; padding: 0 0.75rem; font-weight: 600; white-space: nowrap; text-decoration: none;
  }
  .btn-lg { min-height: 2.75rem; padding: 0 1.125rem; font-size: 1rem; }
  .btn:hover, .btn-lg:hover, select.field:hover { transform: translateY(-1px); box-shadow: 0 calc(var(--tt-edge) + 1px) 0 var(--edge); }
  .btn:active, .btn-lg:active, select.field:active { transform: translateY(var(--tt-edge)); box-shadow: none; }
  .btn:disabled, .btn-lg:disabled, select.field:disabled { transform: none; box-shadow: none; color: var(--tt-muted); background-color: var(--tt-slot); border-color: var(--tt-slot-line); cursor: default; }
  .btn svg { width: 0.875rem; height: 0.875rem; flex: none; }
  .btn kbd { font: 500 0.6875rem var(--tt-font-num); opacity: 0.7; }

  /* The one yellow piece on a screen is what to press next. */
  .btn-go { --face: var(--tt-action); --edge: var(--tt-action-edge); }
  /* A piece in use is pressed down flat, in the open tool's colour. */
  .btn-on kbd { opacity: 1; }
  .btn-on, .btn-on:hover { --face: var(--tt-tool); --face-ink: #fff; --edge: var(--tt-tool-edge); transform: translateY(var(--tt-edge)); box-shadow: none; }

  /* A menu is a piece: it opens when pressed. */
  select.field {
    appearance: none; width: 100%; min-width: 0; min-height: 2rem; padding: 0 1.75rem 0 0.625rem; font-weight: 500;
    background-image: var(--tt-chevron); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 0.75rem;
  }

  /* A small piece, for a dense row such as a table cell: a 2px edge. */
  .tt-small { --tt-edge: 2px; min-height: 1.625rem; }

  /* ---------- slots: anything you type into ---------- */
  .field:not(select), .field-lg {
    width: 100%; min-width: 0; min-height: 2rem; padding: 0.25rem 0.625rem; border: 1px solid var(--tt-slot-line); border-radius: var(--tt-radius);
    background: var(--tt-slot); color: var(--tt-ink); box-shadow: inset 0 2px 0 var(--tt-slot-edge);
    font-size: 0.875rem; line-height: 1.35; font-variant-numeric: tabular-nums;
  }
  .field-lg { min-height: 2.75rem; padding: 0.5rem 0.875rem; font-size: 1rem; }
  .field:not(select)::placeholder, .field-lg::placeholder { color: var(--tt-muted); opacity: 1; }
  .field:not(select):focus-visible, .field-lg:focus-visible { outline: 2px solid var(--tt-tool); outline-offset: 1px; background: #fff; }
  textarea.field { resize: vertical; }

  /* An empty slot is off. A piece sitting in it is on. */
  input[type="checkbox"] {
    appearance: none; flex: none; width: 1.125rem; height: 1.125rem; margin: 0; border: 1px solid var(--tt-slot-line); border-radius: 4px;
    background: var(--tt-slot); box-shadow: inset 0 2px 0 var(--tt-slot-edge); cursor: pointer; vertical-align: -0.2em;
    transition: transform 90ms var(--tt-ease);
  }
  input[type="checkbox"]:checked {
    background: var(--tt-tool) var(--tt-tick) center / 0.875rem no-repeat; border-color: var(--tt-tool-edge);
    box-shadow: 0 2px 0 var(--tt-tool-edge); transform: translateY(-1px);
  }
  input[type="checkbox"]:active { transform: translateY(1px); }

  /* A slider is a piece riding in a slot. */
  input[type="range"] { appearance: none; height: 1.25rem; background: transparent; cursor: pointer; }
  input[type="range"]::-webkit-slider-runnable-track { height: 0.5rem; border: 1px solid var(--tt-slot-line); border-radius: 0.25rem; background: var(--tt-slot); box-shadow: inset 0 2px 0 var(--tt-slot-edge); }
  input[type="range"]::-moz-range-track { height: 0.5rem; border: 1px solid var(--tt-slot-line); border-radius: 0.25rem; background: var(--tt-slot); box-shadow: inset 0 2px 0 var(--tt-slot-edge); }
  input[type="range"]::-webkit-slider-thumb { appearance: none; width: 0.875rem; height: 1rem; margin-top: -0.375rem; border: 1px solid var(--tt-tool-edge); border-radius: 4px; background: var(--tt-tool); box-shadow: 0 2px 0 var(--tt-tool-edge); }
  input[type="range"]::-moz-range-thumb { width: 0.875rem; height: 1rem; border: 1px solid var(--tt-tool-edge); border-radius: 4px; background: var(--tt-tool); box-shadow: 0 2px 0 var(--tt-tool-edge); }

  /* ---------- the bar: the open tool's colour ---------- */
  .tt-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.5rem 1rem 0.3125rem;
    background: var(--tt-tool); color: #fff; font-size: 0.875rem;
  }
  .tt-bar :focus-visible { outline-color: #fff; }
  .tt-bar .btn, .tt-bar select.field { --edge: var(--tt-tool-deep); }
  .tt-bar .btn-go { --edge: var(--tt-action-deep); }
  .tt-bar .field:not(select) { background: var(--tt-tool-slot); border-color: var(--tt-tool-deep); box-shadow: inset 0 2px 0 var(--tt-tool-deep); color: #fff; margin-bottom: var(--tt-edge); }
  .tt-bar .field:not(select)::placeholder { color: var(--tt-bar-muted); }
  .tt-bar .field:not(select):focus-visible { outline-color: #fff; background: var(--tt-tool-slot); }
  .tt-bar input[type="checkbox"] { background-color: var(--tt-tool-slot); border-color: var(--tt-tool-deep); box-shadow: inset 0 2px 0 var(--tt-tool-deep); }
  .tt-bar input[type="checkbox"]:checked { background: #fff var(--tt-tick-ink) center / 0.875rem no-repeat; border-color: var(--tt-tool-deep); box-shadow: 0 2px 0 var(--tt-tool-deep); }
  .tt-bar-label { font-size: 0.75rem; color: var(--tt-bar-muted); }
  /* What just happened, at the bar's right end: up to two lines, the whole message in its title. */
  .tt-status { flex: 1 1 8rem; min-width: 0; margin-left: auto; margin-bottom: var(--tt-edge); font-size: 0.75rem; line-height: 1.25; color: var(--tt-bar-muted); text-align: right;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .tt-bar a.tt-bar-label { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
  .tt-bar a.tt-bar-label:hover { color: #fff; text-decoration-style: solid; }

  .tt-brand { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: var(--tt-edge); color: inherit; text-decoration: none;
    font: 800 1.375rem/1 var(--tt-font-display); letter-spacing: -0.01em; }
  .tt-brand svg { width: 1.75rem; height: 1.75rem; flex: none; }

  /* Maps | Cards: two pieces in one slot. The open tool is pressed down. */
  .tt-switch { display: inline-flex; gap: 0.25rem; padding: 0.25rem 0.25rem calc(0.25rem + var(--tt-edge)); margin-bottom: var(--tt-edge);
    border: 1px solid var(--tt-tool-deep); border-radius: calc(var(--tt-radius) + 3px); background: var(--tt-tool-slot); box-shadow: inset 0 2px 0 var(--tt-tool-deep); }
  .tt-switch a { display: inline-flex; align-items: center; min-height: 1.625rem; padding: 0 0.75rem; border-radius: var(--tt-radius); background: var(--tt-tool-lift); color: #fff;
    box-shadow: 0 var(--tt-edge) 0 var(--tt-tool-deep); font-weight: 700; text-decoration: none; transition: transform 90ms var(--tt-ease), box-shadow 90ms var(--tt-ease); }
  .tt-switch a:hover { transform: translateY(-1px); box-shadow: 0 calc(var(--tt-edge) + 1px) 0 var(--tt-tool-deep); }
  .tt-switch a[aria-current="page"], .tt-switch a:active { background: #fff; color: var(--tt-tool); transform: translateY(var(--tt-edge)); box-shadow: none; }

  /* ---------- panels ---------- */
  .tt-panel { background: var(--tt-panel); font-size: 0.875rem; }
  .panel-title { margin: 0 0 0.625rem; font: 700 1rem/1.2 var(--tt-font-display); color: var(--tt-ink); text-wrap: balance; }
  .label { display: block; margin-bottom: 0.25rem; font-size: 0.75rem; font-weight: 600; color: var(--tt-muted); }
  .fold { margin-bottom: 1rem; border-bottom: 1px solid var(--tt-rule); padding-bottom: 0.75rem; }
  .fold > summary { display: flex; align-items: center; gap: 0.375rem; margin-bottom: 0.5rem; cursor: pointer; user-select: none; list-style: none;
    font: 700 0.9375rem/1.25 var(--tt-font-display); color: var(--tt-ink); }
  .fold > summary::-webkit-details-marker { display: none; }
  .fold > summary::before { content: ""; flex: none; width: 0.75rem; height: 0.75rem; background: var(--tt-chevron) center / contain no-repeat; transform: rotate(-90deg); transition: transform 120ms var(--tt-ease); }
  .fold[open] > summary::before { transform: none; }
  .fold .fold > summary { font-size: 0.875rem; }
  .linkish { cursor: pointer; color: var(--tt-tool); text-decoration: underline dotted; text-underline-offset: 2px; }
  .linkish:hover { text-decoration-style: solid; }
  .note { font-size: 0.875rem; color: var(--tt-muted); }
  .warn { border: 1px solid var(--tt-warn); border-radius: var(--tt-radius); background: var(--tt-warn-wash); padding: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--tt-ink); }
  .rowline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; border-bottom: 1px solid var(--tt-rule); padding: 0.5rem 0; }

  /* Checks: a grey piece is a count, an empty slot has nothing to fix, an orange piece does. */
  .tt-mark { display: inline-block; flex: none; width: 0.625rem; height: 0.5625rem; border-radius: 2px; background: var(--tt-count); box-shadow: 0 2px 0 var(--tt-count-edge); transform: translateY(-1px); }
  .tt-mark-ok { height: 0.625rem; border: 1px solid var(--tt-slot-line); background: var(--tt-slot); box-shadow: inset 0 2px 0 var(--tt-slot-edge); transform: none; }
  .tt-mark-fix { background: var(--tt-fix); box-shadow: 0 2px 0 var(--tt-fix-edge); }

  /* IDs and measurements: one coded style wherever they appear. */
  .tt-id { font-family: var(--tt-font-num); font-weight: 500; font-variant-numeric: tabular-nums; }
  .tt-num { font-family: var(--tt-font-num); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; word-spacing: -0.2em; }

  /* ---------- the stage ---------- */
  /* Dots are true to scale: --dot is the printed step in screen pixels, set by the editor as it zooms. */
  .tt-stage { background-color: var(--tt-stage); background-image: radial-gradient(circle, var(--tt-stage-dot) 1.1px, transparent 1.6px);
    background-size: var(--dot, 20px) var(--dot, 20px); background-position: var(--dot-x, 0) var(--dot-y, 0); }
  .tt-stage.tt-plain { background-image: none; }
  .tt-tray { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; padding: 0.375rem 0.375rem 0.1875rem;
    border: 1px solid var(--tt-slot-line); border-radius: calc(var(--tt-radius) + 4px); background: var(--tt-slot); box-shadow: inset 0 2px 0 var(--tt-slot-edge); }
  .tt-tray select.field { width: auto; }
  .tt-tray .tt-gap { align-self: stretch; width: 1px; margin: 0.125rem 0.125rem 0.3125rem; background: var(--tt-slot-line); }
  /* Notes along the foot of the stage: the hint at the left, the dots' scale at the right. On a narrow stage the scale sits above the hint. */
  .tt-notes { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; display: flex; flex-wrap: wrap-reverse; align-items: flex-start; gap: 0.5rem; pointer-events: none; }  /* wrap-reverse flips the cross axis: flex-start is the bottom */
  .tt-notes > :first-child:not(:last-child) { flex: 1 1 18rem; max-width: 36rem; }
  .tt-notes > :last-child { margin-left: auto; }
  /* The one sentence that says what to do first, where the tool tray will be. */
  .tt-lead { max-width: 30rem; border: 1px solid var(--tt-rule); border-radius: var(--tt-radius); background: var(--tt-panel); padding: 0.75rem 1rem; font-size: 0.9375rem; line-height: 1.4; color: var(--tt-ink); text-wrap: pretty; }
  .tt-chip { border: 1px solid var(--tt-rule); border-radius: var(--tt-radius); background: var(--tt-panel); padding: 0.375rem 0.625rem; font-size: 0.75rem; color: var(--tt-muted); }
  .tt-float { border: 1px solid var(--tt-warn); border-radius: var(--tt-radius); background: #fff; padding: 0.5rem 0.75rem; font-size: 0.875rem; box-shadow: 0 6px 18px rgba(27, 28, 31, 0.18); }

  @media (prefers-reduced-motion: reduce) {
    .btn, .btn-lg, select.field, .tt-switch a, input[type="checkbox"], .fold > summary::before { transition: none; }
    .btn:not(.btn-on):hover, .btn-lg:hover, select.field:hover, .tt-switch a:not([aria-current]):hover { transform: none; box-shadow: 0 var(--tt-edge) 0 var(--edge, var(--tt-tool-deep)); }
  }
}
