:root {
  --ink: #fff4ec;
  --soft: rgba(255, 236, 226, 0.66);
  --glass: rgba(40, 22, 44, 0.55);
  --line: rgba(255, 220, 210, 0.18);
  --glow: #ffb38a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a0f1f; color: var(--ink); overflow: hidden;
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
canvas#pile { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: manipulation; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex;
  align-items: baseline; justify-content: space-between; pointer-events: none; }
.word { margin: 0; font-weight: 600; font-size: 20px; letter-spacing: .02em; color: var(--ink); opacity: .9; }
.count { margin: 0; font-size: 14px; color: var(--soft); font-variant-numeric: tabular-nums; }

.door { position: fixed; inset: 0; display: grid; place-items: end center; padding: 0 16px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(26, 15, 31, .9), rgba(26, 15, 31, 0) 55%); }
.door[hidden] { display: none; }
.door-in { width: min(420px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; }
.glyph { margin: 0; font-size: 28px; letter-spacing: .1em; color: var(--glow); opacity: .85; }
.name-row { width: 100%; }
.name-row input, .say input { width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: var(--glass);
  border: 1px solid var(--line); border-radius: 999px; padding: 13px 18px; outline: none; backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); }
.name-row input { text-align: center; }
.name-row input:focus, .say input:focus { border-color: rgba(255, 179, 138, .6); }
.enter { width: 100%; font: inherit; font-size: 17px; font-weight: 600; color: #2a1420; border: 0; border-radius: 999px;
  padding: 14px 18px; background: linear-gradient(135deg, #ffd0a8, #ff9fb4); box-shadow: 0 10px 30px rgba(255, 150, 140, .25); cursor: pointer; }
.enter:active { transform: scale(.98); }
.hush { margin: 2px 0 0; font-size: 13px; color: var(--soft); max-width: 34ch; }

.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom));
  width: min(560px, calc(100vw - 32px)); display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.dock[hidden] { display: none; }
.g { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .06); color: var(--soft);
  display: grid; place-items: center; cursor: pointer; transition: background .2s, color .2s; }
.g svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.g svg .f { fill: currentColor; stroke: none; }
.g[aria-pressed="true"] { background: linear-gradient(135deg, #ffd0a8, #ff9fb4); color: #2a1420; }
.g:focus-visible, .enter:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.say { flex: 1; min-width: 0; margin: 0; }
.say input { padding: 11px 16px; font-size: 16px; background: rgba(255, 255, 255, .05); border-color: transparent; }

.g.new { position: relative; }
.g.new::after { content: ""; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--glow); }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 72px);
  width: min(560px, calc(100vw - 32px)); max-height: min(46dvh, 420px); display: flex; border-radius: 24px;
  background: rgba(36, 18, 40, .78); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.sheet[hidden] { display: none; }
.log { list-style: none; margin: 0; padding: 14px 18px; overflow-y: auto; width: 100%; display: grid; gap: 8px; align-content: start;
  overscroll-behavior: contain; }
.log:empty::before { content: "Nothing said yet. Say something and it floats over your head."; color: var(--soft); font-size: 14px; }
.log li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; font-size: 15px; line-height: 1.35; }
.log b { font-weight: 600; color: var(--glow); white-space: nowrap; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; }
.log li.mine b { color: #ff9fb4; }
.log span { overflow-wrap: anywhere; }
.log time { font-size: 11px; color: var(--soft); opacity: .7; font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 72px);
  margin: 0; padding: 9px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: 14px;
  color: var(--ink); opacity: 0; transition: opacity .3s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast, .g { transition: none; } }

/* the house build stamp sits quietly under the count, never over the word */
.build-stamp-row { position: fixed; top: calc(max(14px, env(safe-area-inset-top)) + 24px); right: 16px; padding: 0; text-align: right;
  color: var(--soft); pointer-events: auto; z-index: 1; }
.build-stamp-row .build-stamp { padding: 0; font-size: 10px; opacity: .4; }
