/* Collage Together: plain styles. */
:root {
  --bg: #fcee21;
  --ink: #222222;
  --muted: #666666;
  --line: #cccccc;
  --accent: #222222;
  --error: #a01010;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 system-ui, -apple-system, sans-serif; color: var(--ink); }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- ransom-note cut-out words ---------- */
.ransom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cut {
  display: inline-block;
  padding: 2px 14px;
  font-family: Fredoka, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.1;
  box-shadow: 6px 8px 0 #00000040;
}
.cut.serif { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.cut.hand { font-family: Caveat, "Brush Script MT", cursive; font-size: 1.2em; padding-block: 0; }
.c-white { background: #ffffff; outline: 1px solid #dddddd; color: #343434; transform: rotate(-2deg); }
.c-pink { background: #ec015a; color: #ffffff; transform: rotate(2deg); }
.c-blue { background: #2dc5f4; color: #343434; transform: rotate(-1deg); }

/* ---------- submit page ---------- */
.submit-page { background: #ffffff; padding: 24px 16px 48px; }
.maker { max-width: 560px; margin: 0 auto; display: grid; gap: 16px; }
.paper { display: grid; gap: 16px; }
.paper h1 { margin: 0 0 8px; font-size: 36px; }
.mode { margin: 0; justify-self: start; padding: 4px 10px; border-radius: 6px; background: #eeeeee; font-size: 13px; }

.field { display: grid; gap: 4px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label { font-size: 14px; font-weight: 600; }
.count { font-size: 13px; color: var(--muted); }
.count.over { color: var(--error); font-weight: 600; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 16px; /* 16px keeps iOS from zooming in */
  color: var(--ink);
  background: #ffffff;
}
textarea { font-family: var(--mono); font-size: 15px; min-height: 190px; resize: vertical; tab-size: 2; }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.hint code { font-family: var(--mono); }

.preview-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.preview-tile { display: grid; gap: 4px; justify-items: center; }
.preview-frame { width: 200px; height: 200px; border: 1px solid var(--line); }
.preview-frame iframe { width: 200px; height: 200px; border: 0; display: block; }
.preview-caption { font-size: 13px; color: var(--muted); }
.actions { flex: 1; min-width: 180px; display: grid; gap: 8px; align-content: start; }

.btn { border-radius: 6px; padding: 10px 16px; font-size: 16px; border: 1px solid var(--accent); }
.btn.primary { background: var(--accent); color: #ffffff; }
.btn.ghost { background: #ffffff; color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 4px 0; text-decoration: underline; justify-self: start; color: var(--ink); }
.linkbtn.danger { color: var(--error); }

.status { margin: 0; padding: 8px 10px; border-radius: 6px; }
#error { background: #fff0f0; color: var(--error); font-family: var(--mono); font-size: 14px; white-space: pre-wrap; }
.status.ok { background: #eef7ee; }

/* ---------- wall page ---------- */
.wall-page { height: 100vh; overflow: hidden; background: #111111; }
.board { position: absolute; inset: 0; overflow: hidden; }
.board-inner {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  background: var(--bg);
  overflow: hidden;
}
.shared-canvas { position: absolute; inset: 0; width: 1920px; height: 1080px; border: 0; display: block; }
.wall-title { position: absolute; left: 48px; top: 32px; margin: 0; font-size: 84px; gap: 18px; pointer-events: none; z-index: 1; }
.empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
  font-size: 40px; pointer-events: none;
}
.empty p { margin: 0; }
.empty p + p { font-size: 28px; color: var(--muted); }

.credits { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.chip {
  position: absolute;
  max-width: 300px;
  padding: 2px 10px;
  border: 0;
  font-size: calc(24px * var(--chip-scale, 1));
  font-weight: 700;
  box-shadow: 6px 8px 0 #00000040;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%) rotate(var(--chip-rot, 0deg));
  pointer-events: auto;
  transition: left 0.6s ease, top 0.6s ease, opacity 0.6s ease;
}
.chip.arriving { opacity: 0; }

.join-card {
  position: absolute; right: 40px; bottom: 40px; z-index: 10000;
  display: flex; align-items: center; gap: 20px;
  padding: 16px 24px 16px 16px;
  background: #ffffff;
}
.qr { width: 220px; height: 220px; }
.qr img, .qr canvas { display: block; width: 220px; height: 220px; }
.join-text { display: grid; gap: 4px; max-width: 360px; }
.join-label { font-weight: 700; font-size: 44px; line-height: 1.1; }
.join-url { font-family: var(--mono); font-size: 24px; overflow-wrap: anywhere; }

.controls {
  position: fixed; top: 12px; right: 12px; z-index: 20000;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 6px;
  background: #111111; color: #ffffff; font-size: 14px;
  transition: opacity 0.3s ease;
}
.ctl { border: 0; border-radius: 4px; padding: 4px 10px; background: #ffffff; color: #111111; font-size: 14px; }
body.idle .controls { opacity: 0; pointer-events: none; }
body.idle { cursor: none; }

/* ---------- piece detail ---------- */
dialog { border: 0; padding: 0; max-width: min(980px, calc(100vw - 32px)); background: #ffffff; color: var(--ink); }
dialog::backdrop { background: #000000aa; }
.detail { display: flex; gap: 24px; padding: 24px; flex-wrap: wrap; }
.detail-preview { width: 400px; height: 400px; border: 1px solid var(--line); flex: none; overflow: hidden; }
.detail-preview iframe { width: 400px; height: 400px; border: 0; display: block; }
.detail-body { flex: 1; min-width: 260px; display: grid; gap: 12px; align-content: start; }
.detail-body h2 { margin: 0; font-size: 32px; }
.detail-body pre {
  margin: 0; max-height: 300px; overflow: auto;
  padding: 12px; border-radius: 6px; background: #f2f2f2;
  font: 15px/1.5 var(--mono); white-space: pre-wrap;
}
.detail-note { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 16px; align-items: center; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  .chip, .controls { transition: none; }
}
