/* The online interface — the Android app's palette (res/values/colors.xml):
   ink blue, amber for what is chosen, lavender tiles. */
:root {
  --bg: #FFF7FE; --surface: #FFFFFF; --line: #E7E0EC; --text: #1D1B20; --muted: #625B71;
  --primary: #2F4B7C; --chosen: #FFDCBA; --on-chosen: #2C1600;
  --tile: #E1DAEC; --tile-part: #DCD4E8; --tile-icon: #57506A;
  --badge-sheet: #C9C2D8; --badge-sheet-icon: #332E40; --band-file: #C4BCD4;
  --shadow: 0 1px 3px rgba(0,0,0,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { width: 20px; height: 20px; flex-shrink: 0; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 20px; color: var(--primary); }
.repo select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
#search { flex: 1 1 220px; min-width: 0; font: inherit; padding: 10px 14px; border: 1px solid #79747E; border-radius: 8px; background: var(--surface); }
.modes { display: flex; border: 1px solid #79747E; border-radius: 20px; overflow: hidden; }
.modes button { display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 40px; border: 0; background: transparent; }
.modes button + button { border-left: 1px solid #79747E; }
.modes button[aria-selected="true"] { background: var(--chosen); color: var(--on-chosen); }
.live { color: #9E9E9E; font-size: 14px; }
.live.on { color: #2E7D32; }

.split { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; }
.list { flex: 1 1 380px; max-width: 520px; min-width: 0; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.detail { flex: 999 1 480px; min-width: 0; overflow-y: auto; padding: 24px 28px; }
.hint, .count { color: var(--muted); }
.count { font-size: 14px; letter-spacing: .02em; padding: 12px 16px 4px; margin: 0; }

/* Rows as in the app: a tile, two lines, a band down from a piece to its parts. */
.row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; min-height: 64px; position: relative; }
.row:hover { background: #F7F2FA; }
.row[aria-current="true"] { background: var(--chosen); }
.tile { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--tile); color: var(--tile-icon); position: relative; flex-shrink: 0; }
.tile svg { width: 28px; height: 28px; }
.tile.piece { color: #fff; }
.tile.part { width: 40px; height: 40px; border-radius: 10px; background: var(--tile-part); margin-left: 14px; }
.tile.part svg { width: 22px; height: 22px; }
.tile.part > svg { transform: translate(-3px, -4px); }
.badge { position: absolute; right: -8px; bottom: -6px; display: flex; align-items: center; gap: 2px; padding: 1px 6px 1px 4px; border-radius: 10px; font-size: 12px; font-weight: 700; border: 2px solid var(--surface); }
.badge svg { width: 12px; height: 12px; }
.badge.n-parts { color: #fff; }
.badge.n-sheets { background: var(--badge-sheet); color: var(--badge-sheet-icon); }
.words { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.title { font-size: 17px; overflow-wrap: anywhere; }
.sub { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.band { position: absolute; left: 36px; width: 8px; top: 0; bottom: 0; }
.row.first-part .band { top: -10px; }

/* The detail: a piece and its parts, each with its sheets. */
.detail h1 { font-family: Georgia, "Times New Roman", serif; font-size: 30px; margin: 0 0 4px; overflow-wrap: anywhere; }
.detail .arr { color: var(--muted); margin: 0 0 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 8px; background: #E8DEF8; color: #1D192B; }
.chip.set { background: #D8E2FF; color: #0B1B33; }
.partblock { margin: 0 0 28px; }
.partblock h2 { font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.partblock h2 .dot { width: 12px; height: 12px; border-radius: 6px; }
.partblock .sub { margin: 0 0 10px; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.sheet { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.sheet img { width: 100%; aspect-ratio: 180 / 255; object-fit: contain; background: #fff; display: block; }
.sheet span { font-size: 12px; color: var(--muted); padding: 4px 6px; text-align: center; }
.sheet:hover { outline: 2px solid var(--primary); }
.entries { list-style: none; padding: 0; margin: 0; counter-reset: entry; }
.entries li { display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.entries li .n { width: 28px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.entries li button { border: 0; background: none; padding: 0; text-align: left; font-size: 16px; color: var(--primary); }

/* The page, large. */
.viewer { position: fixed; inset: 0; background: rgba(20,20,18,.94); display: flex; align-items: center; justify-content: center; z-index: 10; }
.viewer[hidden] { display: none; }
.viewer img { max-width: calc(100% - 160px); max-height: calc(100% - 80px); background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.5); }
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; color: #F3F1EA; }
.viewer-bar button, .viewer .turn { border: 0; background: #24231F; color: #F3F1EA; border-radius: 10px; min-width: 48px; min-height: 48px; display: flex; align-items: center; justify-content: center; }
.viewer .turn { position: absolute; top: 50%; transform: translateY(-50%); height: 33%; width: 56px; }
.viewer .turn.left { left: 16px; }
.viewer .turn.right { right: 16px; }
.viewer svg { width: 24px; height: 24px; }

@media (max-width: 720px) {
  .list { max-width: none; border-right: 0; flex-basis: 100%; max-height: 50vh; }
  .detail { padding: 16px; }
  .viewer img { max-width: calc(100% - 32px); }
  .viewer .turn { width: 44px; height: 25%; }
}

/* ---- Editing (slices 2–4) ---- */
.count.line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 12px; }
button.small, .actions button, .actions .button, .pick button, details.edit summary, .assemble button, a.button, label.button {
  font-size: 14px; padding: 8px 14px; min-height: 40px; border-radius: 20px; border: 1px solid #79747E; background: var(--surface);
  color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
button.small { min-height: 32px; padding: 4px 12px; }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.danger { color: #B3261E; border-color: #B3261E; }
label.upload { margin-left: auto; }
.head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 20px; }
.head .actions { margin: 0; }
.transfer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.transfer .actions { margin: 0; }
.pick { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
select, .pick input, form.inline input, .adder input, .chips input {
  font: inherit; padding: 8px 10px; border: 1px solid #79747E; border-radius: 8px; background: var(--surface); min-height: 40px; }
details.edit { position: relative; }
details.edit summary { list-style: none; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
details.edit.block { margin: 0 0 20px; }
form.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0 0; }
form.inline label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip button, button.chip { border: 0; cursor: pointer; }
.chip .x, .entries .x { border: 0; background: none; font-size: 18px; line-height: 1; padding: 0 4px; color: var(--muted); cursor: pointer; }
.chip.inherited { background: transparent; border: 1px dashed var(--badge-sheet); color: var(--muted); }
.chips input { min-height: 32px; padding: 4px 10px; width: 140px; }
.partblock.lit { background: #FFF1E6; border-radius: 12px; padding: 12px; margin-left: -12px; margin-right: -12px; }
.sheetbox { position: relative; display: flex; flex-direction: column; }
.sheetbox .sheet { width: 100%; }
.pickbox { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; z-index: 1; accent-color: var(--primary); }
.sheetbox.picked .sheet { outline: 3px solid #E58A1F; }
.owner { font-size: 11px; color: var(--muted); border-left: 4px solid; padding: 2px 6px; margin-top: 4px; overflow-wrap: anywhere; }
.assemble { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 12px; margin: 0 0 14px;
  background: var(--chosen); color: var(--on-chosen); border-radius: 12px; }
.entries li { cursor: grab; }
.entries li.dragging { opacity: .5; }
.entries .grip { color: var(--badge-sheet); letter-spacing: -2px; user-select: none; }
.entries .go { flex: 1; }
.adder { margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.results { display: flex; flex-wrap: wrap; gap: 6px; }
.results .add { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 6px 12px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #322F35; color: #F5EFF7; padding: 12px 20px;
  border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 20; max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }

/* ---- How a page is shown (slice 6) ---- */
.showcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 20px; display: flex; flex-direction: column; gap: 12px; }
.showcard h2 { font-size: 16px; margin: 0; }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.seglabel { width: 160px; color: var(--muted); font-size: 14px; }
.seg button { font-size: 14px; padding: 6px 14px; min-height: 36px; border: 1px solid #79747E; background: var(--surface); margin-left: -1px; }
.seg button:first-of-type { border-radius: 18px 0 0 18px; }
.seg button:last-of-type { border-radius: 0 18px 18px 0; }
.seg button[aria-pressed="true"] { background: var(--chosen); color: var(--on-chosen); }
.showcard .check { display: flex; align-items: center; gap: 8px; }
.showcard .check input { width: 20px; height: 20px; accent-color: var(--primary); }
.margins { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.margins label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.margins input { width: 72px; font: inherit; padding: 6px 8px; border: 1px solid #79747E; border-radius: 8px; }
.margins button { font-size: 14px; padding: 6px 14px; min-height: 36px; border-radius: 18px; border: 1px solid #79747E; background: var(--surface); color: var(--primary); }
.sheettools { display: flex; gap: 4px; margin-top: 4px; }
.sheettools button { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--primary); cursor: pointer; }

/* ---- Notes (slice 5) ---- */
.sheet { position: relative; }
.inkmark { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 12px; background: #B40000; color: #fff;
  font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0; }
.viewer-tools { display: flex; gap: 8px; margin-left: auto; margin-right: 12px; }
.viewer-tools button { font-size: 14px; padding: 6px 14px; border-radius: 18px; }
.viewer-tools button[aria-pressed="true"] { background: #F0B44C; color: #1A1408; }
.asks { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px; background: #FFF1E6; border-bottom: 1px solid var(--line); }
.asks[hidden] { display: none; }
.ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ask input { font: inherit; padding: 6px 10px; border: 1px solid #79747E; border-radius: 8px; min-width: 220px; }
.ask button { font-size: 14px; padding: 6px 14px; min-height: 36px; border-radius: 18px; border: 1px solid #79747E; background: var(--surface); color: var(--primary); }
.ask button.primary { background: var(--primary); color: #fff; }
.ask .linkish { border: 0; background: none; padding: 0; min-height: 0; text-decoration: underline; }

/* ---- Accounts (RS3) ---- */
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account .who { font-weight: 600; color: var(--primary); }
.account button { font-size: 14px; padding: 6px 12px; min-height: 36px; border-radius: 18px; border: 1px solid #79747E; background: var(--surface); color: var(--primary); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: .08em; }
.members { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.members li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.members .who { min-width: 160px; font-weight: 600; }
.members button { font-size: 14px; padding: 6px 12px; border-radius: 18px; border: 1px solid #B3261E; color: #B3261E; background: var(--surface); }
/* The storages (RS6): a name over its address and its last read, then the switches. */
.storages li { padding: 10px 0; border-bottom: 1px solid var(--line, #E0DCE4); }
.storages .who { flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; }
.storages .who .sub { font-weight: 400; }
.storages .why { color: #B3261E; }
.storages button:not(.danger) { border-color: var(--primary); color: var(--primary); }
.devicecode { margin: 12px 0 20px; padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--primary); max-width: 560px; }
.devicecode .code { font-size: 28px; font-weight: 700; letter-spacing: 0.12em; margin: 6px 0; }
.check, form.inline label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 14px; align-self: flex-end; padding-bottom: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
/* A player sees and plays: nothing that edits is offered. */
body[data-role="player"] :is(.actions, details.edit, label.upload, .assemble, .count.line button, .chips input, .chip .x, .entries .x, .entries select, .adder, .sheettools, .showcard, .pickbox) { display: none; }
.findings { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.findings th, .findings td { text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.findings th { color: var(--muted); font-weight: 600; }
button.primary { border-radius: 20px; padding: 8px 16px; min-height: 40px; border: 1px solid var(--primary); cursor: pointer; }
/* Signed out, the header keeps the name and nothing to work with (9 October 2026). */
body.signed-out .bar :is(.repo, #search, .modes, label.upload, .live) { display: none; }
/* The code for the app (9 October 2026): crisp, and large enough for a phone's camera at arm's length. */
img.appcode { width: 288px; height: 288px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }
