:root {
  --paper: #f5efe3;
  --card: #fffdf8;
  --ink: #1f1c17;
  --ink-soft: #5c554a;
  --rule: #e3d9c6;
  --blue: #2d5aa6;
  --blue-deep: #1e417d;
  --gold: #c8962c;
  --error: #a3341f;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px 48px;
}

.intro { margin-bottom: 20px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 500;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(34px, 9vw, 46px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.lede { margin: 0; color: var(--ink-soft); font-size: 19px; }

h2 { margin: 0 0 16px; font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }

/* Scene */

.scene { margin: 0 0 24px; }

.scene-frame {
  position: relative;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: #2a1a12;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px -18px rgba(60, 35, 15, 0.55), 0 0 0 1px rgba(60, 35, 15, 0.25);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
}

.scene-overlay { position: absolute; inset: 0; pointer-events: none; }

.bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 46%;
  padding: 3px 7px 4px;
  background: #fffdf8;
  color: var(--ink);
  border: 2px solid #2a1a12;
  border-radius: 4px;
  font-family: var(--pixel);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
  width: max-content;
}

.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 6px;
  height: 6px;
  background: #fffdf8;
  border-right: 2px solid #2a1a12;
  border-bottom: 2px solid #2a1a12;
  transform: translateX(-50%) rotate(45deg);
}

.bubble.label { background: var(--blue-deep); color: #fff; border-color: var(--blue-deep); }
.bubble.label::after { background: var(--blue-deep); border-color: var(--blue-deep); }

.sound-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 22, 15, 0.55);
  color: #fff;
  cursor: pointer;
}

.sound-toggle svg { display: block; width: 100%; height: 100%; }
.sound-toggle .sound-off { display: none; }
.sound-toggle[aria-pressed="false"] .sound-waves { display: none; }
.sound-toggle[aria-pressed="false"] .sound-off { display: inline; }

.scene-caption { margin: 10px 0 0; text-align: center; font-size: 15px; color: var(--ink-soft); font-style: italic; }

/* Cards and form */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 18px;
  margin-bottom: 24px;
}

.card p { margin: 0 0 12px; }

.field { margin-bottom: 16px; position: relative; }

label, legend { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 500; }

.optional { font-weight: 400; color: var(--ink-soft); font-style: italic; }

fieldset { border: 0; margin: 0 0 4px; padding: 0; min-width: 0; }

legend { padding: 0; margin-bottom: 10px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfc3ad;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  line-height: 1.35;
  appearance: none;
}

textarea { resize: vertical; min-height: 84px; }

input::placeholder, textarea::placeholder { color: #a89f90; }

input:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }

input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }

.hint { margin: 4px 0 0 !important; font-size: 14px; color: var(--ink-soft); }

.row { display: grid; grid-template-columns: 1fr 64px 96px; gap: 10px; }
.row .field { margin-bottom: 16px; }

@media (max-width: 360px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row .city { grid-column: 1 / -1; }
}

.suggestions {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 100%;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid #cfc3ad;
  border-radius: 8px;
  box-shadow: 0 12px 28px -12px rgba(40, 25, 10, 0.35);
}

.suggestions li { padding: 8px 10px; border-radius: 5px; cursor: pointer; line-height: 1.3; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: #eef2fa; }
.suggestions .main { display: block; font-size: 16px; }
.suggestions .secondary { display: block; font-size: 14px; color: var(--ink-soft); }
.suggestions .attribution { padding: 6px 10px 2px; font-size: 12px; color: var(--ink-soft); cursor: default; text-align: right; }
.suggestions .attribution:hover { background: none; }

#turnstile:not(:empty) { margin-bottom: 12px; }

.form-error { color: var(--error); font-size: 15px; }

.submit {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 2px 0 var(--blue-deep);
}

.submit:hover { background: #2a539a; }
.submit:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--blue-deep); }
.submit:disabled { opacity: 0.7; cursor: progress; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer { font-size: 14px; color: var(--ink-soft); text-align: center; }
.footer p { margin: 0; }

/* Editor sheet */

.sheet {
  width: min(420px, calc(100% - 32px));
  border: 0;
  border-radius: 12px;
  padding: 22px 18px 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(30, 18, 8, 0.6);
}

.sheet::backdrop { background: rgba(31, 22, 15, 0.45); }

.editor-look { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 18px; }

#editor-preview { width: 144px; height: 144px; image-rendering: pixelated; background: #f1e6d2; border-radius: 8px; }

.look-step {
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.sheet-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-actions .submit { width: auto; padding: 0 28px; }

[hidden] { display: none !important; }
