/* The table's tile drawing on the site pages: the variables and rules tiles.js relies on, scoped to .lines. */
.lines {
  --tile-base-w: 58px; --tile-base-h: 81px; --tile-scale: 1; --tile-size: 1; --fit: 1; --zoom: 1;
  --tile-face: #fdfbf5; --tile-edge: #d9d2c2; --tile-shadow: rgba(60, 45, 25, 0.28);
  --pip-bam: #1a7a44; --pip-crak: #b02a2f; --pip-dot: #1e5391; --pip-wind: #6b5636;
  --pip-flower: #2f8a52; --pip-flower-heart: #c8892a; --pip-joker: #7a3d8f;
  --tile-ink: #232019; --ink: #232019;
}
.lines .line { margin: 0 0 10px; }
.lines .line-head { font: 600 0.9rem var(--sans); color: var(--ink-soft); }
.lines .pattern { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; }
.lines .pattern-group { display: flex; gap: 2px; }
.lines .tile {
  width: calc(var(--tile-base-w) * var(--tile-scale)); height: calc(var(--tile-base-h) * var(--tile-scale));
  border: 0; padding: 0; border-radius: 4px; position: relative; overflow: hidden; display: flex;
  align-items: center; justify-content: center; background: linear-gradient(#fff, var(--tile-face) 42%, var(--tile-edge));
  box-shadow: 0 1px 0 var(--tile-shadow); font-family: var(--sans); color: var(--ink);
}
.lines .tile.pattern-tile { --tile-scale: 0.46; }
.lines .tile .face { width: 100%; height: 100%; display: block; }
.lines .tile.pattern-tile .face .corner { transform: scale(0.85); transform-origin: 12px 12px; }

/* figures (MASTER.md): the same tile drawing, at a size set by the page */
.figure { --tile-base-w: 58px; --tile-base-h: 81px; --tile-scale: 0.62; --tile-size: 1; --fit: 1; --zoom: 1;
  --tile-face: #fdfbf5; --tile-edge: #d9d2c2; --tile-shadow: rgba(60, 45, 25, 0.28);
  --pip-bam: #1a7a44; --pip-crak: #b02a2f; --pip-dot: #1e5391; --pip-wind: #6b5636;
  --pip-flower: #2f8a52; --pip-flower-heart: #c8892a; --pip-joker: #7a3d8f; --tile-ink: #232019; --ink: #232019;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.figure .figure-group { display: inline-flex; gap: 3px; }

/* A phone is 390px and a rack is fourteen tiles: a group that will not break puts the page into a sideways
   scroll, which a screenshot hides because it simply crops (18 Sep, found with tools/overflow.py). The tiles
   come down a size and a group is allowed to break rather than run off the edge. */
@media (max-width: 34rem) {
  .figure { --tile-scale: 0.42; gap: 7px; }
  .figure.large { --tile-scale: 0.55; }
  .figure .figure-group { flex-wrap: wrap; }
}
.figure .tile {
  width: calc(var(--tile-base-w) * var(--tile-scale)); height: calc(var(--tile-base-h) * var(--tile-scale));
  border: 0; padding: 0; border-radius: 6px; position: relative; overflow: hidden; display: block;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 16%),
    linear-gradient(0deg, rgba(88, 66, 36, 0.30), rgba(88, 66, 36, 0) 11%),
    radial-gradient(130% 95% at 50% 18%, #fffdf7 0%, var(--tile-face) 55%, var(--tile-edge) 135%);
  box-shadow: 0 2px 0 var(--tile-shadow), 0 4px 8px rgba(30, 24, 12, 0.28);
}
.figure .tile .face { width: 100%; height: 100%; display: block; }
.figure .tile.back { background: linear-gradient(160deg, #2f5fa8, #1d3f7a); }   /* a face-down tile: the blue back of an American set */
.figure.large { --tile-scale: 0.85; }
.figure.small { --tile-scale: 0.46; gap: 6px; }

/* the editor and the correction screen */
.editor { max-width: none; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.editor .card-form { display: grid; gap: 0.7rem; }
.editor .card-form label { display: grid; gap: 0.2rem; font-family: var(--sans); font-size: 0.92rem; }
.editor .card-form label.check { grid-template-columns: auto 1fr; align-items: start; gap: 0.5rem; }
.editor textarea { font: 0.95rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
.editor .errors { background: #fff4f0; border-left: 4px solid var(--accent); padding: 0.6rem 1rem 0.6rem 2rem; margin: 0; font-size: 0.92rem; }
.editor .beside .photo { max-width: 100%; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); margin-bottom: 1rem; }
.library, .card-view, .scan { max-width: 60rem; }
.scan .card-form { display: grid; gap: 0.7rem; max-width: 30rem; }
.scan .card-form label { display: grid; gap: 0.2rem; font-family: var(--sans); font-size: 0.92rem; }
.banner.error { border-left: 4px solid var(--accent); background: #fff4f0; padding: 0.6rem 1rem; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }

/* The hands as text, which the server writes and cardlines.js draws tiles above. Everyone sees the words now:
   a crawler and an answer engine because there is nothing else, a reader because what a line means is the
   thing a beginner came for (23 Sep). */
.lines-text { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.lines-text li { font-weight: 700; letter-spacing: 0.03em; }
.lines-text .says { font-weight: 400; letter-spacing: 0; color: var(--ink-soft); font-size: 0.95rem; }
.lines-text .line-draw:not(:empty) { margin-bottom: 0.35rem; }

/* What a line means. Closed by default: a reader who can already read the card should not have to scroll
   past nine paragraphs of explanation to reach the next line. */
.reading { margin-top: 0.4rem; font-weight: 400; letter-spacing: 0; }
.reading summary { font-family: var(--sans); font-size: 0.9rem; color: var(--accent); cursor: pointer;
                   width: fit-content; padding: 0.15rem 0; }
.reading summary:hover { text-decoration: underline; }
.reading[open] summary { margin-bottom: 0.5rem; }
.reading p { margin: 0 0 0.55rem; max-width: 46rem; line-height: 1.55; }
.reading .worked { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 0.4rem; }
.reading .figure { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* The kinds of hand (/hands, 23 Sep). A teacher does not teach a card, she teaches what a line means and what
   the categories are, because those survive January. */
.hands { max-width: 52rem; }
.hands-head { padding-top: 2.5rem; }
.hands-head .lead { font-size: 1.15rem; line-height: 1.6; color: var(--ink-soft); margin: 0 0 1rem; }
.hands section { margin-top: 2.6rem; }
.hands h2 { margin-bottom: 0.6rem; }
.hands p { line-height: 1.65; max-width: 46rem; }

.key { display: grid; gap: 0; margin: 1.1rem 0; border-top: 1px solid var(--line); }
.key > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem;
             padding: 0.55rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.key dt { font-weight: 700; font-family: var(--sans); font-size: 0.95rem; }
.key dd { margin: 0; color: var(--ink-soft); line-height: 1.5; }

.hand-kind-facts { display: grid; gap: 0.5rem; margin: 1rem 0 0; }
.hand-kind-facts > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: baseline; }
.hand-kind-facts dt { font-family: var(--sans); font-size: 0.82rem; text-transform: uppercase;
                 letter-spacing: 0.06em; color: var(--ink-soft); }
.hand-kind-facts dd { margin: 0; line-height: 1.55; }

.hand-kind-line { margin-top: 1.4rem; padding: 1.1rem 1.2rem; background: var(--card);
             border: 1px solid var(--line); border-radius: 12px; }
.hand-kind-line p { margin: 0 0 0.6rem; }
.hand-kind-line .line-notation { font-weight: 700; letter-spacing: 0.03em; }
.hand-kind-line .line-notation .says { font-weight: 400; letter-spacing: 0; color: var(--ink-soft); font-size: 0.95rem; }
.hand-kind-line .worked { color: var(--ink-soft); font-size: 0.95rem; }
.hand-kind-line .figure { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0; }

@media (max-width: 640px) {
  .key > div, .hand-kind-facts > div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
}
.hand-kind-line h4 { margin: 0 0 0.7rem; font-size: 1.05rem; display: flex; flex-wrap: wrap;
                     gap: 0.6rem; align-items: baseline; }
.hand-kind-line h4 .says { font-weight: 400; color: var(--ink-soft); font-size: 0.9rem; }
.hand-kind h3 { margin: 1.8rem 0 0; font-size: 1rem; }
