/* Bot Marble – warm paper, ink and brass. Mobile first; 16px gutters; nothing scrolls sideways. */
:root {
  --paper: #f4ecdc; --paper2: #fbf6ea; --card: #fffaf0; --ink: #2a2622; --ink2: #5d554b; --line: #d9ccb4;
  --brass: #b8862b; --brass2: #8c6418; --rust: #8a3b12; --ok: #2f7d45; --bad: #b8322a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--rust); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 19px; } h4 { font-size: 15px; margin-top: 14px; }
p { margin: 8px 0; }
button, .btn, .cta { font: 600 15px/1.2 var(--sans); border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); border-radius: 10px; padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
button:hover, .btn:hover { background: #fff; }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.cta { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cta:hover { background: #000; }
.cta.big { font-size: 17px; padding: 13px 20px; width: 100%; margin-top: 12px; }
textarea, input[type=text] { width: 100%; font: 14px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink); background: var(--paper2); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }
input[type=text] { font-family: var(--sans); margin: 6px 0; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.muted { color: var(--ink2); }
.small { font-size: 14px; }
.warn { background: #fbe3d3; border: 1.5px solid #e1a27f; border-radius: 10px; padding: 10px 12px; }

/* header + footer */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; background: rgba(244, 236, 220, 0.94); border-bottom: 1.5px solid var(--line); backdrop-filter: blur(6px); }
.brand { font: 800 19px/1 var(--serif); letter-spacing: 0.08em; color: var(--ink); text-decoration: none; margin-right: auto; }
.pill { font: 700 12px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 10px; background: var(--card); white-space: nowrap; }
.pill:empty { display: none; }
#countdown { background: var(--brass); color: #fff; border-color: var(--brass2); font-variant-numeric: tabular-nums; }
.top .cta { min-height: 34px; padding: 7px 12px; font-size: 14px; }
main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 14px 16px 28px; }
.loading { padding: 60px 0; text-align: center; color: var(--ink2); }
.foot { padding: 18px 16px 26px; text-align: center; font-size: 13px; color: var(--ink2); border-top: 1.5px solid var(--line); }
.wrap { max-width: 760px; margin: 0 auto; }

/* the wall */
.grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.wallwrap { min-width: 0; }
.tag { font: 600 italic 18px/1.3 var(--serif); margin: 2px 0 6px; }
.status { font-size: 14px; color: var(--ink2); min-height: 21px; margin-bottom: 8px; }
canvas.wall { display: block; max-width: 100%; margin: 0 auto; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 0 2px 0 var(--line); }
/* the 3D machine: a fixed viewport the camera moves through */
.stage { position: relative; }
canvas.wall.three { width: 100%; height: clamp(380px, 72vh, 860px); /* JS fits it to the machine */ max-width: none; touch-action: none; cursor: grab; background: #eee4d2; user-select: none; -webkit-user-select: none; }
canvas.wall.three:active { cursor: grabbing; }
.caption { position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px); background: rgba(42, 38, 34, 0.86); color: #fbf6ea; font: 600 14px/1.3 var(--sans); padding: 7px 11px; border-radius: 999px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bayinfo { position: absolute; left: 10px; bottom: 10px; width: min(360px, calc(100% - 20px)); background: rgba(255, 250, 240, 0.96); border: 1.5px solid var(--ink); border-radius: 12px; padding: 10px 40px 10px 12px; box-shadow: 0 3px 0 rgba(42, 38, 34, 0.15); }
.bayinfo p { margin: 4px 0; font-size: 14px; }
.bayinfo .cta { min-height: 34px; padding: 7px 12px; font-size: 14px; margin-top: 4px; }
.bayinfo .share { min-height: 32px; padding: 6px 11px; font-size: 13px; margin-top: 4px; }
.bayinfo .x { position: absolute; right: 6px; top: 6px; min-height: 30px; width: 30px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
.good { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.hint { text-align: center; font-size: 13px; color: var(--ink2); margin: 0 0 6px; }
.hint:empty { display: none; }
.clipstage canvas.clip.three { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: pan-y; border: 1.5px solid var(--ink); border-radius: 10px; background: #eee4d2; }
.ctrl { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.ctrl button { font-size: 14px; padding: 7px 12px; min-height: 36px; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.how { padding-left: 20px; margin: 6px 0; }
.how li { margin: 8px 0; }
.hon { list-style: none; padding: 0; margin: 4px 0; font-size: 14px; }
.hon li { display: flex; align-items: center; gap: 8px; padding: 3px 0; overflow-wrap: anywhere; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c, #ccc); border: 1px solid rgba(0, 0, 0, 0.3); flex: none; }
.sheets { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.sheets figure { margin: 0; text-align: center; position: relative; }
.sheets canvas { display: block; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.sheets figcaption { font-size: 12px; color: var(--ink2); }
.perfect { position: absolute; top: -8px; right: -6px; color: var(--brass); font-size: 16px; }

/* owner page */
.me { display: flex; flex-direction: column; gap: 14px; }
.me h1 { font-size: 32px; overflow-wrap: anywhere; }
.steps { padding-left: 22px; }
.steps li { margin: 10px 0; }
.mecard { border-color: var(--ink); }
.pend { color: var(--brass2); font-weight: 600; }
.news { padding-left: 20px; margin: 10px 0 0; }
.news li { margin: 4px 0; }
canvas.clip { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--paper); }
.play { width: 100%; display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 5px; padding: 12px; margin: 10px 0 0; font-weight: 400; border-color: var(--line); border-radius: 12px; position: relative; }
.play.on { border-color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); background: #f3faf2; }
.play .slot { position: absolute; top: 12px; left: 12px; font: 800 20px/1 var(--serif); width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; background: var(--card); }
.play .tagw { font: 700 17px/1.2 var(--serif); padding: 8px 0 4px 46px; min-height: 36px; }
.play .mini { width: 100%; max-width: 360px; height: auto; aspect-ratio: 2 / 1; border-radius: 8px; border: 1px solid var(--line); background: var(--paper2); }
.play .drops { font: 600 14px/1.2 ui-monospace, Consolas, monospace; color: var(--ok); letter-spacing: 0.04em; }
.play .eff { font-size: 14px; color: var(--ok); }
.play .eff.bad { color: var(--bad); font-weight: 600; }
.play .rep { font-size: 14px; color: var(--ink2); }
.play .choose { font-weight: 700; background: var(--ink); color: var(--paper); border-radius: 8px; padding: 7px 12px; margin-top: 4px; }
.play.on .choose { background: var(--ok); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.me details textarea { margin: 8px 0; }
.me details button { margin: 4px 0; }
.card.small p button { margin: 4px 0; }

@media (min-width: 640px) {
  .play { padding-right: 236px; min-height: 150px; }
  .play .mini { position: absolute; right: 12px; top: 12px; width: 210px; }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
  .side { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; }
  .tag { font-size: 21px; }
}
@media (max-width: 420px) {
  .top { gap: 6px; padding: 8px 12px; }
  .brand { font-size: 17px; }
  .pill { font-size: 11px; padding: 5px 8px; }
  #ballpill { display: none; }
  .xs-hide { display: none; }
  h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
[hidden] { display: none !important; }
