/* Scrap Paper: screen furniture. Paper, ink, tape. All lettering is drawn by the game's own
   stroke font (see src/render/text.js); the system font below is only a fallback for inputs. */
:root {
  --ink: #1b1b3a;
  --pencil: #55555f;
  --paper: #f7f3e8;
  --paper-2: #fbf8ef;
  --red: #e5484d;
  --blue: #3b82f6;
  --note: #ffe36e;
  --desk: #3b2f2a;
  --line: #a9c4de;
  --hud: 0px;
  --wobble: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-2: 18px 225px 18px 255px / 255px 18px 225px 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--desk); color: var(--ink); font-family: ui-rounded, "Avenir Next", "Segoe UI", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
.overlay { position: fixed; inset: 0; pointer-events: none; }
.overlay > * { pointer-events: auto; }
[hidden] { display: none !important; }
canvas.inktext { display: block; pointer-events: none; }
[data-ink] { display: inline-block; line-height: 0; }

.paper {
  background: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(169, 196, 222, 0.55) 31px 32.5px);
  border: 3px solid var(--ink); border-radius: var(--wobble);
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.28);
}
.note {
  background: var(--note); border-radius: 3px 3px 26px 3px / 3px 3px 12px 3px;
  box-shadow: 5px 7px 0 rgba(0, 0, 0, 0.25); transform: rotate(-1.6deg);
}
.note::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 18px; background: rgba(0, 0, 0, 0.07); }

.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-2); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--wobble);
  padding: 6px 16px; box-shadow: 3px 4px 0 var(--ink); transition: transform 0.06s, box-shadow 0.06s; text-decoration: none;
  font: inherit;
}
.btn:hover { transform: translate(-1px, -1px) rotate(-0.6deg); box-shadow: 4px 6px 0 var(--ink); }
.btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px dashed var(--blue); outline-offset: 4px; }
.btn.primary { background: var(--red); border-radius: var(--wobble-2); }
.btn.big { padding: 12px 34px; }
.btn.small { padding: 3px 10px; border-width: 2.5px; box-shadow: 2px 3px 0 var(--ink); }
.btn[aria-disabled="true"] { opacity: 0.55; }

/* landing */
#landing { display: grid; place-items: center; background: rgba(43, 35, 32, 0.34); overflow: auto; }
.landing-card { width: min(680px, 94vw); padding: 26px 30px 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; transform: rotate(-0.5deg); margin: 16px 0; }
#logo { margin: 0; line-height: 0; }
.tagline { margin: 0; }
.joinrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
#code { width: 124px; font: 700 26px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 6px; text-transform: uppercase; text-align: center; padding: 6px 4px 6px 10px; border: 3px solid var(--ink); border-radius: var(--wobble-2); background: #fff; color: var(--ink); }
#code:focus { outline: 3px dashed var(--blue); outline-offset: 3px; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 1px; }
.links { display: flex; gap: 12px; margin-top: 4px; }
.fine { margin: 0; font-size: 11px; color: var(--pencil); letter-spacing: 0.04em; }

/* lobby */
#joincard { position: absolute; left: 18px; top: 18px; width: clamp(170px, 17vw, 250px); padding: 22px 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr { width: 100%; aspect-ratio: 1; background: #fff; padding: 6px; border: 2.5px solid var(--ink); }
.qr svg { width: 100%; height: 100%; display: block; }
.roomcode { line-height: 0; }
.joinurl { font: 600 clamp(9px, 0.8vw, 12px)/1.2 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); word-break: break-all; text-align: center; }
.joinmini { position: fixed; left: 14px; top: 52px; display: flex; align-items: center; gap: 6px; padding: 12px 8px 6px; transform: rotate(-1.2deg); opacity: 0.92; z-index: 2; }
.joinmini .qr { width: 58px; padding: 3px; border-width: 2px; }
.screen-results .joinmini { left: auto; right: 22px; top: 22px; }
.topright { position: absolute; right: 16px; top: 14px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 46vw; }
.topleft { position: absolute; left: 14px; top: 12px; display: flex; gap: 8px; opacity: 0.75; }
.tips { position: absolute; right: 18px; top: 64px; padding: 20px 12px 10px; display: grid; gap: 0; transform: rotate(1.4deg); background: #9ad8ff; }
@media (max-width: 900px), (max-height: 560px) { .tips { display: none; } }
.startbar { position: absolute; left: 50%; bottom: calc(var(--hud) + 34px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.summary { background: rgba(251, 248, 239, 0.92); border-radius: 8px; padding: 2px 10px; line-height: 0; }
.summary:empty { display: none; }
.resultbar { position: absolute; left: 5vw; bottom: 5vh; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* menus */
.modal { display: grid; place-items: center; background: rgba(43, 35, 32, 0.5); pointer-events: auto; }
.menu-card { width: min(560px, 94vw); max-height: 92vh; overflow: auto; padding: 20px 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: rotate(0.4deg); }
.menu-card h2 { margin: 0; line-height: 0; }
.menu-rows { width: 100%; display: grid; gap: 3px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 10px; border: 2.5px solid transparent; border-radius: var(--wobble); cursor: pointer; min-height: 34px; }
.menu-row.sel { border-color: var(--red); background: rgba(229, 72, 77, 0.1); }
.menu-row .val { display: flex; align-items: center; gap: 6px; }
.menu-row .arrow { cursor: pointer; padding: 0 6px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper-2); line-height: 0; height: 26px; width: 26px; display: grid; place-items: center; }
.menu-row.go { justify-content: center; background: var(--red); border-color: var(--ink); margin-bottom: 4px; }
.menu-row.go.sel { outline: 3px dashed var(--ink); outline-offset: 3px; }
.fame-body { width: 100%; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fame-board { display: grid; gap: 2px; align-content: start; }

.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%) rotate(-1deg); background: var(--note); border: 2.5px solid var(--ink); border-radius: var(--wobble); padding: 6px 16px; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.3); line-height: 0; pointer-events: none; z-index: 5; }

@media (max-height: 560px) { #joincard { width: 150px; padding-top: 18px; } .landing-card { gap: 7px; padding: 14px 20px 10px; } .steps { display: none; } }
@media (max-width: 700px) { .joinmini { position: fixed; left: 14px; top: 52px; display: flex; align-items: center; gap: 6px; padding: 12px 8px 6px; transform: rotate(-1.2deg); opacity: 0.92; z-index: 2; }
.joinmini .qr { width: 58px; padding: 3px; border-width: 2px; }
.screen-results .joinmini { left: auto; right: 22px; top: 22px; }
.topright { max-width: 52vw; } #joincard { width: 132px; } }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
