/* Ramo QR — warm paper, soft ink, one accent. Light by design: the stage is a
   sheet of florist's paper and the code has to read as printed on it. */

:root {
  --paper: #faf6f0;
  --paper-2: #ffffff;
  --ink: #2f2a2e;
  --ink-soft: #6d6469;
  --ink-faint: #a29aa0;
  --line: #e6ded4;
  --accent: #b0455f;
  --accent-soft: #f6e6ea;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(60, 40, 50, 0.10);
  --panel-w: 348px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA-level display:none, so any author rule
   that sets `display` (as .panel and .error do) would silently override it. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------------------------------------------------------------- stage -- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hint:hover { color: var(--ink); }

.received {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(78%, 460px);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.received__eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.received__message {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(19px, 2.6vw, 28px);
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- panel -- */

.panel {
  flex: 0 0 var(--panel-w);
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border-left: 1px solid var(--line);
  box-shadow: -1px 0 24px rgba(60, 40, 50, 0.05);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.panel__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.version {
  margin-left: 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  vertical-align: 0.35em;
}

.panel__tagline {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.panel__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px 8px;
}

.panel__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}

/* The three actions do not fit on one row at the panel's width, so they wrap
   onto a second line rather than pushing the last button off the edge. */
.panel__actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel--viewer .panel__foot { justify-content: stretch; }
.panel--viewer .panel__foot .btn { width: 100%; }

.lang {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.lang:hover { border-color: var(--ink-faint); color: var(--ink); }

/* --------------------------------------------------------------- fields -- */

.field { margin-bottom: 22px; }

.field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.field__label {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field__note {
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- groups -- */

.groups { display: flex; flex-direction: column; gap: 10px; }

.group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px 11px;
  background: #fdfbf8;
}

.group__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-2);
}
.stepper button {
  width: 26px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.stepper button:disabled { color: var(--line); cursor: default; }
.stepper output {
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.group__remove {
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.group__remove:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------- swatches -- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.stepper--wide {
  width: 100%;
  justify-content: space-between;
}
.stepper--wide output {
  flex: 1 1 auto;
  font-size: 13px;
}

.privacy {
  margin: 9px 0 0;
  padding-left: 11px;
  border-left: 2px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.share__note {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
}

.swatches--wrap .swatch {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------- textarea -- */

.textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.qrinfo {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.qrwarn {
  margin: 7px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #fdf3e5;
  color: #8a5a1c;
  font-size: 12px;
}

/* -------------------------------------------------------------- buttons -- */

.btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-faint); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: #9c3b53; border-color: #9c3b53; }

.btn--ghost {
  width: 100%;
  background: transparent;
  border-style: dashed;
  color: var(--ink-soft);
}
.btn--ghost:hover { color: var(--accent); border-color: var(--accent); }

.btn--sm { padding: 6px 11px; font-size: 12px; width: auto; }

.btn:disabled { opacity: 0.45; cursor: default; }

/* ---------------------------------------------------------------- error -- */

.error {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--paper);
  z-index: 10;
}
.error__title { margin: 0; font-family: var(--serif); font-size: 21px; }
.error__hint { margin: 0 0 8px; color: var(--ink-soft); max-width: 34ch; }

/* --------------------------------------------------------------- mobile -- */

@media (max-width: 860px) {
  body { flex-direction: column; overflow: auto; }
  .stage { flex: 0 0 auto; height: 58vh; min-height: 320px; }
  .panel {
    flex: 1 1 auto;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: none;
  }
  /* Leave room for the sticky footer so the last controls stay reachable. */
  .panel__body { overflow: visible; padding-bottom: 96px; }
  .panel__foot { position: sticky; bottom: 0; }
  .hint { bottom: 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .hint, .received { transition: none; }
}
