:root {
  --bg: #f6f1ea;
  --ink: #2b2622;
  --muted: #7a7068;
  --card: #fffdf9;
  --accent: #c2410c;
  --line: #e4dbcf;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* Login */
#login { align-items: center; justify-content: center; padding-left: 16px; padding-right: 16px; }
.card { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0 0 4px; font-size: 24px; font-weight: 650; }
.card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.card input { font-size: 17px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); -webkit-user-select: text; user-select: text; }
.card button { padding: 12px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; }
.error { margin: 0; color: #b91c1c; font-size: 14px; }

/* App */
.topbar { display: flex; align-items: center; justify-content: flex-end; padding: 8px 16px; min-height: 40px; }
.people { display: flex; gap: 6px; font-size: 13px; color: var(--muted); }
.people .who { display: inline-flex; align-items: center; gap: 4px; }
.people .who::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 12px; }
.paper { position: relative; background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 24px rgba(60,40,20,.10); overflow: hidden; }
.paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.offline { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.75); color: var(--muted); font-weight: 600; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
@media (orientation: landscape), (min-width: 700px) { .hint { display: none; } }

.toolbar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px; flex-wrap: wrap; }
.tools { display: flex; gap: 6px; }
.tool { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.tool.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0,0,0,.12); padding: 0; }
.swatch.active { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatches.disabled .swatch { opacity: .35; }
.clear { height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--accent); font-weight: 600; }
.devices { margin: 0; padding: 0 16px 6px; text-align: center; font-size: 12px; color: var(--muted); min-height: 1.4em; }

/* Short landscape phones: tighten everything so the canvas gets the room. */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { min-height: 28px; padding: 2px 16px; font-size: 14px; }
  .toolbar { padding: 4px 12px; gap: 8px; }
  .tool { width: 38px; height: 38px; }
  .swatch { width: 28px; height: 28px; }
  .clear { height: 34px; }
  .devices { padding-bottom: 2px; }
}
