/* Same family as bls.saderra.com: midnight surfaces, warm amber accent. */
:root {
  color-scheme: dark;
  --page: #0b0d12;
  --panel: #12151c;
  --raised: #1a1e27;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #f3efe8;
  --muted: #b4b9c7;
  --accent: #f2b56b;
  --accent-soft: rgba(242, 181, 107, 0.14);
  --accent-ink: #1d1408;
  --danger: #e2735a;
  --ok: #7fd4a0;
  --radius: 16px;
  --wood: #7a5233;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Buttons and small parts ------------------------------------------- */
.btn {
  font: inherit; font-size: 15px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink); padding: 8px 14px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.24); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #f6c486; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #1c0c08; font-weight: 600; }
.btn.danger:hover { background: #e98a74; border-color: #e98a74; }
.btn.big { font-size: 18px; padding: 14px 32px; }
.btn:disabled { opacity: 0.5; cursor: default; }
a.btn { display: inline-block; text-decoration: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 8px currentColor; color: var(--accent); }
.dot.on { background: var(--ok); color: var(--ok); }
.dot.off { background: var(--danger); color: var(--danger); }
.status { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); white-space: nowrap; }

.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--raised); border-radius: 11px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; padding: 7px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(242, 181, 107, 0.35); }
.seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input[type=text], input[type=search], input[type=email] {
  font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--raised); color: var(--ink); width: 100%;
}
input::placeholder { color: var(--muted); }
/* iOS zooms into fields under 16px. */
@media (pointer: coarse) { input[type=text], input[type=search], input[type=email] { font-size: 16px; } }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--muted); white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative; width: 40px; height: 22px; border-radius: 999px; flex: none;
  background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-strong); transition: background 0.2s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .switch-track { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(242, 181, 107, 0.5); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: var(--accent); }
.switch input:checked ~ span:last-child { color: var(--ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.hint { font-size: 14px; color: var(--muted); line-height: 1.5; }
.error { color: var(--danger); font-size: 14px; }

/* Size and Depth sliders for the sand tools */
.brush-controls { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.slider { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.slider output { min-width: 3.2em; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 120px; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-strong); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--raised); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent);
}
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); }
@media (pointer: coarse) { input[type=range] { width: 140px; height: 32px; } }

/* ---- Dialogs ------------------------------------------------------------ */
.modal {
  position: fixed; width: min(520px, calc(100vw - 32px)); padding: 28px; border-radius: 20px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal::backdrop { background: rgba(5, 6, 9, 0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-title { font-family: var(--serif); font-weight: 300; font-size: 28px; margin: 0 0 8px; }
.modal .hint { font-size: 15px; margin: 0 0 22px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.modal-close-form { position: absolute; top: 14px; right: 14px; margin: 0; }
.modal-close {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 22px; line-height: 1;
}
.modal-close:hover { background: var(--raised); color: var(--ink); }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; color: var(--accent); }

/* ---- Home page ---------------------------------------------------------- */
body.home-page {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(242, 181, 107, 0.10), transparent 70%) no-repeat fixed,
    var(--page);
}
.home { max-width: 720px; margin: 0 auto; padding: 12vh 16px 48px; text-align: center; }
.home h1.logo { margin: 40px 0 36px; line-height: 0; }
.home h1.logo img { width: min(330px, 100%); height: auto; }
.home .lead { color: var(--muted); font-size: 18px; line-height: 1.6; margin: 0 auto 32px; max-width: 560px; }
.home .error { margin-top: 12px; }
.home-art { display: flex; justify-content: center; gap: 6px; height: 64px; }
.home-art img { width: 56px; height: 56px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.4)); animation: bob 3.2s ease-in-out infinite; }
.home-art img:nth-child(2) { animation-delay: -0.8s; }
.home-art img:nth-child(3) { animation-delay: -1.6s; }
.home-art img:nth-child(4) { animation-delay: -2.4s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .home-art img { animation: none; } }
.home-points { list-style: none; padding: 0; margin: 48px auto 0; max-width: 560px; text-align: left; display: grid; gap: 12px; }
.home-points li { color: var(--muted); font-size: 15px; line-height: 1.5; padding-left: 22px; position: relative; }
.home-points li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.home-points strong { color: var(--ink); font-weight: 500; }
/* Link to Saderra BLS on the home page */
.sister-site {
  display: block; max-width: 540px; margin: 48px auto 0; padding: 20px 24px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.sister-site:hover { border-color: var(--accent); background: var(--accent-soft); }
.sister-label { display: block; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
.sister-site img { display: block; margin: 0 auto; width: 148px; height: auto; }
.sister-desc { display: block; margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.home-foot { margin-top: 48px; font-size: 13px; color: var(--muted); }
.home-foot a { color: var(--muted); }

/* ---- The tray app ------------------------------------------------------- */
body.app { height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.bar {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.bar .brand { line-height: 0; margin-right: auto; }
.bar .brand img { height: 22px; width: auto; }
.bar-actions { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
.stage { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.tools .spacer { flex: 1; }
.sel-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 3px 3px 3px 12px; border-radius: 11px; background: var(--raised); }
.sel-bar .sel-name { font-size: 14px; color: var(--ink); margin-right: 6px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-bar button { font: inherit; font-size: 14px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.sel-bar button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.sel-bar .remove:hover { color: var(--danger); }

/* The tray keeps a 3:2 shape and fills the space it has. */
.tray-wrap { container-type: size; display: grid; place-items: center; padding: 24px; min-height: 0; }
.tray {
  position: relative; width: min(100cqw - 24px, (100cqh - 24px) * 1.5); aspect-ratio: 3 / 2;
  border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 0 0 10px var(--wood), 0 0 0 11px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);
  background: #4a8cb6;
}
.tray canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 10px; }
.tray::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 6px 18px rgba(0, 0, 0, 0.35);
}
.tray:not([data-tool=move]) { cursor: crosshair; }
.tray:not([data-tool=move]) .fig { pointer-events: none; }
.brush-ring { position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none; border: 1.5px solid rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.brush-ring.rake { border: 0; box-shadow: none; border-radius: 0; }
.brush-ring svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.5)); }
.brush-ring svg path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rake-handle { stroke: #9a6a3c; stroke-width: 4; }
.rake-head { stroke: #e8e1d4; stroke-width: 4; }
.rake-tine { stroke: #e8e1d4; stroke-width: 2.5; }
#figs, #cursors { position: absolute; inset: 0; }
#figs { z-index: 2; }
#cursors { z-index: 3; pointer-events: none; }

.fig { position: absolute; left: 0; top: 0; cursor: grab; transition: transform 0.09s linear, width 0.09s linear, height 0.09s linear; }
.fig img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35)); pointer-events: none; }
.fig.dragging, .tray.resizing .fig { transition: none; }
.fig.dragging { cursor: grabbing; }
.fig.dragging img { filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.35)); }
.fig.selected { outline: 1.5px dashed rgba(255, 255, 255, 0.8); outline-offset: 2px; border-radius: 6px; }
.fig.held { outline: 2px solid var(--holder); outline-offset: 2px; border-radius: 6px; }
.fig.nope { animation: nope 0.3s; }
@keyframes nope { 25% { margin-left: -4px; } 75% { margin-left: 4px; } }
body.read-only .fig { cursor: default; }

.handles span {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); touch-action: none;
}
.handles span::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--accent); }
.h-rotate { left: calc(50% - 11px); top: -34px; cursor: grab; }
.h-rotate::before { content: ""; position: absolute; left: 10px; top: 22px; width: 2px; height: 12px; background: rgba(255, 255, 255, 0.8); }
.h-size { right: -14px; bottom: -14px; cursor: nwse-resize; }
@media (pointer: coarse) { .handles span { width: 30px; height: 30px; } .h-rotate { left: calc(50% - 15px); top: -42px; } .h-rotate::before { left: 14px; top: 30px; } .handles span::after { inset: 9px; } }

.cursor { position: absolute; left: 0; top: 0; transition: transform 0.1s linear; }
.cursor::before {
  content: ""; position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}
.cursor span {
  position: absolute; left: 10px; top: 8px; padding: 2px 8px; border-radius: 6px;
  background: var(--c); color: #111; font-size: 12px; font-weight: 600; white-space: nowrap;
}

.tray-note {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 4;
  padding: 10px 18px; border-radius: 12px; background: rgba(11, 13, 18, 0.78); color: var(--ink);
  font-size: 15px; white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ---- The shelf ---------------------------------------------------------- */
.shelf { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.shelf h2 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 2px 0 0; font-weight: 600; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats button {
  font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
}
.cats button:hover { color: var(--ink); }
.cats button[aria-pressed=true] { background: var(--accent-soft); border-color: rgba(242, 181, 107, 0.5); color: var(--accent); }
.tones-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.tones { display: flex; gap: 6px; }
.tone { width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: 0 0 0 1px var(--line-strong); }
.tone[aria-pressed=true] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.grid-scroll { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -6px; padding: 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.tile {
  aspect-ratio: 1; padding: 8px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; background: var(--raised); touch-action: manipulation;
}
.tile:hover { border-color: rgba(242, 181, 107, 0.5); }
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
body.read-only .shelf .grid-scroll, body.read-only .tools .seg, body.read-only #brushes { opacity: 0.4; pointer-events: none; }
.ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; opacity: 0.85; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.4)); }
body.placing, body.placing * { cursor: grabbing !important; }

.flash {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  padding: 10px 18px; border-radius: 12px; background: #2a5a3f; color: #fff; font-size: 15px;
}

/* ---- Accounts (home page) ------------------------------------------------ */
/* The same sign-in panel as bls.saderra.com. */
.check { display: flex; justify-content: flex-start; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.modal-label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.home-signin {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right));
  background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 18px;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.home-signin:hover { border-color: var(--accent); color: var(--accent); }
.home-signin[hidden] { display: none; }
.account { margin-top: 36px; }
.account-panel {
  margin: 0 auto; max-width: 540px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.account-panel h2 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; font-weight: 600; }
.account-panel h2 .free { color: #fff; font-weight: 700; }
.home .account-panel .hint { margin: 0 0 18px; max-width: none; font-size: 15px; }
.account-row { display: flex; gap: 10px; }
.account-row > input { flex: 1; min-width: 0; }
.account-row .btn { flex: none; white-space: nowrap; }
@media (max-width: 480px) { .account-row { flex-direction: column; } .account-panel { padding: 20px; } }
#loginCode { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.2em; }
.account-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.account-links:not(:has(:not([hidden]))) { display: none; }
.text-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.text-btn:hover { color: var(--ink); }
.text-btn:disabled { opacity: 0.6; cursor: default; }
.my-link { margin: 4px 0 18px; font-family: ui-monospace, Menlo, monospace; font-size: 17px; }
.my-link a { color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.my-link a:hover { color: var(--accent); }
#readyStep .btn.big { width: 100%; }
.home .account-panel .error, .home #accountNote { margin: 14px 0 0; }
.account-foot {
  display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: baseline;
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.account-foot .signed-in { margin-right: auto; }
.home .updates-check { font-size: 14px; color: var(--muted); margin-top: 14px; }
.account-foot .updates-check { flex-basis: 100%; font-size: 13px; margin-top: 4px; }
.account-foot strong { color: var(--ink); font-weight: 500; }
.code-field {
  flex: 1; min-width: 0; display: flex; align-items: center;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 4px 0 16px;
}
.code-field:focus-within { border-color: var(--accent); }
.code-prefix { color: var(--muted); font-size: 15px; white-space: nowrap; }
.code-field input[type=text] {
  border: 0; background: transparent; padding: 10px 8px 10px 0; border-radius: 0; min-width: 0;
  font-family: ui-monospace, Menlo, monospace; color: var(--accent); outline: none;
}
@media (max-width: 420px) { .code-prefix { display: none; } .code-field input[type=text] { padding-left: 0; } }

/* ---- Saved trays (therapist's tray) ------------------------------------- */
.trays-modal { width: min(600px, calc(100vw - 32px)); }
.trays-modal .link-row input { font-family: inherit; color: var(--ink); }
.trays-modal .tray-replace { margin: 10px 0 0; font-size: 14px; }
.trays-modal .tray-warning { margin: 12px 0 0; font-size: 13px; }
.trays-modal .tray-warning strong { color: var(--ink); font-weight: 500; }
.trays-modal .error { margin-top: 14px; }
#traysEmpty { margin: 20px 0 0; }
.tray-list { list-style: none; margin: 20px 0 0; padding: 0; max-height: min(420px, 50vh); overflow-y: auto; }
.tray-list:empty { display: none; }
.tray-list li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: 8px; transition: background 1.2s; }
.tray-list li:last-child { border-bottom: 1px solid var(--line); }
.tray-list li.just-saved { background: var(--accent-soft); }
.tray-thumb { flex: none; width: 90px; height: 60px; border-radius: 6px; object-fit: cover; background: var(--raised); }
.tray-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tray-name { font-size: 15px; overflow-wrap: anywhere; }
.tray-date { font-size: 13px; color: var(--muted); }
.tray-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tray-actions .btn { padding: 6px 14px; font-size: 14px; }
.tray-actions .text-btn { margin-left: 4px; }
@media (max-width: 480px) {
  .tray-list li { flex-wrap: wrap; }
  .tray-actions { width: 100%; padding-left: 102px; }
}

/* ---- Cookie policy ------------------------------------------------------ */
.policy { max-width: 640px; margin: 0 auto; padding: 8vh 20px 64px; line-height: 1.65; }
.policy .back { color: var(--muted); font-size: 14px; text-decoration: none; }
.policy .back:hover { color: var(--ink); }
.policy h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 44px); font-weight: 300; line-height: 1.1; margin: 28px 0 8px; }
.policy h1 em { color: var(--accent); font-style: italic; }
.policy .updated { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.policy h2 { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 36px 0 10px; font-weight: 600; }
.policy p, .policy li { font-size: 16px; }
.policy ul { padding-left: 20px; }
.policy li + li { margin-top: 6px; }
.policy a:not(.back) { color: var(--accent); }

/* Shown when the session ends. */
.ended {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; text-align: center;
  background: rgba(11, 13, 18, 0.9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ended h1 { font-family: var(--serif); font-weight: 300; font-size: clamp(28px, 5vw, 44px); margin: 0 0 12px; }
.ended p { margin: 0 auto 24px; max-width: 420px; color: var(--muted); font-size: 18px; line-height: 1.5; }
.ended .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Tablets held upright: tray on top, figures below, no page scroll. */
@media (orientation: portrait) and (min-width: 820px) {
  .work { display: flex; flex-direction: column; }
  .stage { display: block; }
  .tray-wrap { container-type: inline-size; padding: 22px 24px; }
  .tray { width: calc(100cqw - 20px); }
  .shelf { flex: 1; border-left: 0; border-top: 1px solid var(--line); padding: 14px 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}

/* Narrow screens: tray on top, shelf below, page scrolls. */
@media (max-width: 819px) {
  body.app { height: auto; min-height: 100dvh; overflow: visible; display: block; }
  .bar { padding: 10px 16px; }
  .bar-actions { width: 100%; }
  .work { display: block; }
  .tools { padding: 10px 16px; }
  .tray-wrap { container-type: inline-size; padding: 22px 16px; }
  .tray { width: calc(100cqw - 20px); }
  .shelf { border-left: 0; border-top: 1px solid var(--line); height: 60vh; padding: 14px 16px; }
}
