/* Layout: full-screen 3D walk with floating, rounded "sticker" panels. */
:root {
  --paper: #fffaf1;
  --ink: #3b2f25;
  --ink-dim: #85715e;
  --accent: #ff8a3d;
  --accent-soft: #ffe7d3;
  --mint: #4fbf8f;
  --danger: #e84a5f;
  --line: rgba(59, 47, 37, 0.13);
  --glass: rgba(255, 250, 241, 0.9);
  --shadow: 0 6px 0 rgba(59, 47, 37, 0.12), 0 10px 24px rgba(40, 28, 16, 0.14);
  --round: "Jua", "M PLUS Rounded 1c", system-ui, sans-serif;
  --body: "Gowun Dodum", "M PLUS Rounded 1c", system-ui, sans-serif;
  color-scheme: light;
}
:root:lang(ja) { --round: "M PLUS Rounded 1c", "Jua", system-ui, sans-serif; --body: "M PLUS Rounded 1c", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe6f2; color: var(--ink); font-family: var(--body); }
/* The page itself never scrolls or zooms (in-app browsers such as Threads and Instagram otherwise take drags as
   page scrolls and pinches as page zoom, and the game loses the touch); only windows (sheets, lists) scroll. */
html, body { overscroll-behavior: none; touch-action: none; }
body { position: fixed; inset: 0; width: 100%; }
html.scroll-room { overflow-y: scroll; height: calc(100% + 2px); scrollbar-width: none; }
html.scroll-room::-webkit-scrollbar { display: none; }
canvas#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.center-msg { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--round); font-size: 28px; }

.sheet {
  background: var(--paper);
  border-radius: 26px;
  box-shadow: var(--shadow);
  border: 2px solid var(--line);
  padding: 22px;
  position: relative;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  touch-action: pan-y; overscroll-behavior: contain;
}
.sheet.wide { width: min(760px, calc(100vw - 32px)); }
.sheet.center { text-align: center; }
h1, h2 { font-family: var(--round); font-weight: 400; margin: 0 0 8px; text-wrap: balance; }
.logo { font-size: 40px; color: var(--accent); }
h2 { font-size: 24px; }
.sub { margin: 0 0 14px; color: var(--ink-dim); }
.fine { margin: 14px 0 0; font-size: 13px; color: var(--ink-dim); }
.eyebrow { margin: 0 0 4px; color: var(--ink-dim); font-size: 14px; }

.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(255, 246, 233, 0.25); }
.screen.bottom { place-items: end center; background: none; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.lang-list { display: grid; gap: 10px; margin-top: 12px; }
.lang-list.row { grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
.big-choice {
  padding: 14px; border-radius: 18px; border: 2px solid var(--line); background: #fff; font-family: var(--round); font-size: 22px;
  box-shadow: 0 4px 0 var(--line);
}
.big-choice:hover { border-color: var(--accent); }
.chip-btn { padding: 10px; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.chip-btn.sel { border-color: var(--accent); background: var(--accent-soft); }
.field-label { margin: 12px 0 0; color: var(--ink-dim); font-size: 14px; }

.match-card { display: grid; gap: 10px; }
.match-card > *, #name-form { min-width: 0; }
.row > .primary { flex: none; }
.breed-row { display: flex; align-items: center; gap: 10px; font-family: var(--round); font-size: 26px; }
.badge { font-family: var(--body); font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: #a34f12; }
.traits { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.traits dt { font-weight: 700; color: var(--mint); }
.traits dt:nth-of-type(2) { color: var(--danger); }
.traits dd { margin: 0; }
#name-form label { display: block; font-size: 14px; color: var(--ink-dim); margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
input {
  flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 11px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.primary {
  padding: 12px 18px; border: 0; border-radius: 16px; background: var(--accent); color: #fff;
  font-family: var(--round); font-size: 19px; box-shadow: 0 4px 0 #d9681f; white-space: nowrap;
}
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #d9681f; }
#btn-newdog { width: 100%; }
.link { border: 0; background: none; color: var(--ink-dim); padding: 0 0 8px; }

.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 10px; }
.map-card {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; text-align: left;
  padding: 12px; border-radius: 18px; border: 2px solid var(--line); background: #fff; box-shadow: 0 4px 0 var(--line);
}
.map-card:hover { border-color: var(--accent); }
.map-card .flag { font-size: 32px; grid-row: span 3; }
.map-card b { font-family: var(--round); font-weight: 400; font-size: 18px; }
.map-card small { color: var(--ink-dim); }
.map-card .meta { display: flex; gap: 8px; font-size: 12px; color: var(--ink-dim); flex-wrap: wrap; }
.mood { font-weight: 700; }
.mood.love { color: var(--mint); } .mood.chaos, .mood.suffer, .mood.shiver { color: var(--danger); }

.room-list { display: grid; gap: 8px; margin-top: 10px; }
.room { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: #fff; text-align: left; }
.room:hover { border-color: var(--accent); }
.room b { font-family: var(--round); font-weight: 400; font-size: 18px; }
.room small { color: var(--ink-dim); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > *, .top > * { pointer-events: auto; }
.top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); pointer-events: none;
}
.left-col { display: grid; gap: 8px; max-width: min(340px, 62vw); }
.top-right { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 999px; padding: 8px 14px; box-shadow: var(--shadow); border: 2px solid var(--line); font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.place-pill { font-family: var(--round); font-size: 17px; flex-wrap: wrap; white-space: normal; }
.count { color: var(--ink-dim); font-family: var(--body); font-size: 13px; }
.chip { font-size: 14px; color: var(--ink-dim); }
.chip.on { color: #2f8a5a; }
.dog-panel { background: var(--glass); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow); border: 2px solid var(--line); display: grid; gap: 6px; font-size: 13px; }
.dog-title { display: flex; gap: 8px; align-items: baseline; }
.dog-title b { font-family: var(--round); font-weight: 400; font-size: 17px; }
.meter { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; color: var(--ink-dim); }
.bar { height: 10px; border-radius: 999px; background: #eadfce; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--mint); border-radius: 999px; transition: width 0.3s, background 0.3s; }
.bar i.low { background: var(--danger); }
.stats { display: flex; gap: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.stats b { color: var(--ink); }

.status-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.status-log li {
  background: rgba(59, 47, 37, 0.78); color: #fff; padding: 6px 10px; border-radius: 12px; font-size: 13px; line-height: 1.35;
  animation: pop 0.25s ease-out; transition: opacity 0.6s;
}
.status-log li.old { opacity: 0.55; }
@keyframes pop { from { transform: translateY(-4px) scale(0.98); opacity: 0; } }

.chase {
  position: absolute; left: 50%; top: max(70px, calc(env(safe-area-inset-top) + 60px)); transform: translateX(-50%);
  background: var(--danger); color: #fff; padding: 10px 16px; border-radius: 16px; font-family: var(--round); font-size: 17px;
  box-shadow: var(--shadow); animation: blink 0.8s infinite alternate; max-width: calc(100vw - 32px); text-align: center;
}
@keyframes blink { to { transform: translateX(-50%) scale(1.04); } }
/* Points at the warden coming for you while it is off-screen: a red badge pinned to the screen edge. */
.warden-arrow {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none;
  width: 54px; height: 54px; border-radius: 50%; background: var(--danger); color: #fff;
  display: grid; place-items: center; box-shadow: 0 3px 12px rgba(0,0,0,0.35); border: 3px solid #fff;
}
.warden-arrow .wa-tip { position: absolute; inset: -17px; display: grid; justify-items: center; align-items: start; font-size: 16px; color: var(--danger); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.warden-arrow .wa-dist { font-family: var(--round); font-size: 14px; font-weight: 700; line-height: 1; }
.warden-arrow .wa-dist::before { content: '🚨'; display: block; text-align: center; font-size: 15px; margin-bottom: 1px; }
#hud > .warden-arrow { pointer-events: none; }
.warden-arrow.coming { animation: wa-pulse 0.6s infinite alternate; }
@keyframes wa-pulse { to { box-shadow: 0 0 0 8px rgba(217,54,62,0.35), 0 3px 12px rgba(0,0,0,0.35); } }

.emotes {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 6px; background: var(--glass); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); border: 2px solid var(--line);
}
.emotes button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; font-size: 19px; }
.emotes button:active { transform: scale(0.92); }

.actions {
  position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: flex-end;
}
.small-actions { display: grid; grid-template-columns: repeat(2, auto); gap: 8px; align-content: end; }
.bark-col { display: grid; gap: 8px; justify-items: center; }
.emote-toggle { display: none; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: var(--glass); box-shadow: var(--shadow); font-size: 22px; }
.emote-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.act {
  border: 2px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-family: var(--round); background: var(--paper);
}
.act b { font-weight: 400; font-size: 21px; }
.act small { font-family: var(--body); font-size: 11px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini small { max-width: calc(100% - 6px); white-space: normal; line-height: 1.15; text-align: center; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; }
.mini span { line-height: 1.1; }
.sniff { width: 112px; height: 70px; background: #ffd36b; color: #5a3a10; }
.sniff:disabled { background: var(--glass); color: var(--ink-dim); cursor: default; }
.bark { width: 70px; height: 70px; }
.bark b { font-size: 18px; white-space: nowrap; }
.clean { width: 76px; height: 70px; background: #bfeedd; color: #1f6a4a; animation: blink2 0.9s infinite alternate; }
@keyframes blink2 { to { transform: scale(1.06); } }
.mini { width: 70px; height: 52px; border-radius: 18px; }
.mini span { font-size: 18px; }
.give { background: #ffe0ea; }
.help {
  position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); margin: 0; font-size: 12px;
  background: var(--glass); padding: 7px 11px; border-radius: 12px; color: var(--ink-dim); max-width: 280px;
}
@media (hover: none), (max-width: 860px) { .help { display: none; } .lbl { display: none; } }
/* Phones: emotes fold into one toggle beside the bark button; actions sit in a compact 2-column grid in the thumb zone. */
@media (max-width: 560px) {
  .emote-toggle { display: block; }
  .emotes { display: none; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 136px); left: auto; right: 12px; transform: none; gap: 8px; }
  #hud.emotes-open .emotes { display: flex; animation: pop 0.18s ease-out; }
  .emotes button { width: 44px; height: 44px; font-size: 21px; }
  .actions { right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); gap: 8px; }
  .mini { width: 62px; height: 54px; }
  .mini small { font-size: 10px; letter-spacing: -0.01em; max-width: 56px; }
  .bark { width: 72px; height: 72px; }
  .dog-panel { font-size: 12px; }
  .status-log li { font-size: 12px; }
}

.joy {
  position: fixed; left: 0; top: 0; width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.3); border: 3px solid rgba(255, 255, 255, 0.7); pointer-events: none;
}
.knob { position: absolute; left: 32px; top: 32px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow); }

.scold { position: fixed; inset: 0; pointer-events: none; }
.scold .bar-top, .scold .bar-bottom { position: absolute; left: 0; right: 0; background: #111; }
.scold .bar-top { top: 0; height: 11vh; animation: slide-down 0.35s ease-out; }
.scold .bar-bottom { bottom: 0; min-height: 20vh; padding: 14px max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-bottom)); color: #fff; text-align: center; animation: slide-up 0.35s ease-out; }
@keyframes slide-down { from { transform: translateY(-100%); } }
@keyframes slide-up { from { transform: translateY(100%); } }
.scold-who { margin: 0; color: #ffd36b; font-family: var(--round); font-size: 16px; }
.scold-line { margin: 6px auto 0; font-family: var(--round); font-size: clamp(20px, 3.4vw, 30px); max-width: 30ch; text-wrap: balance; }
.scold-count { position: absolute; right: 18px; top: 12px; font-family: var(--round); font-size: 28px; color: #ff6a6a; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(30, 22, 14, 0.28); padding: 16px; }
.x { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f3e8d6; }
.card h2 { font-size: 28px; }
.card #card-text { font-size: 17px; line-height: 1.6; margin: 8px 0 16px; }
.card .primary { width: 100%; }

.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; border: 2px dashed var(--line); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; color: var(--ink-dim); filter: grayscale(1); opacity: 0.7; text-align: center; padding: 6px;
}
.stamp.done { border: 3px solid #d9363e; color: #d9363e; filter: none; opacity: 1; transform: rotate(-8deg); }
.stamp .flag { font-size: 28px; }
.stamp b { font-family: var(--round); font-weight: 400; font-size: 16px; }
.stamp small { font-size: 11px; }

.toast {
  position: fixed; left: 50%; top: max(76px, calc(env(safe-area-inset-top) + 66px)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 16px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; z-index: 5;
}
.map-card.soon { opacity: 0.55; cursor: default; filter: grayscale(0.6); box-shadow: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

.adpop {
  position: fixed; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px); transform: translateX(-50%);
  width: min(300px, calc(100vw - 32px)); background: var(--paper); border-radius: 18px; box-shadow: var(--shadow);
  border: 2px solid var(--line); padding: 8px; display: grid; gap: 6px; animation: pop 0.25s ease-out; z-index: 4;
}
.adpop canvas { width: 100%; max-height: 170px; object-fit: contain; border-radius: 12px; background: #f3ece0; }
.adpop canvas.tall { max-height: 220px; }
.adpop-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.adpop-sponsor { flex: 1; min-width: 0; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adpop-link { color: #2f6fb0; font-weight: 700; text-decoration: none; }
.adpop-skip { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--ink); color: #fff; font-size: 12px; }
.adpop-track { height: 4px; border-radius: 999px; background: #eadfce; overflow: hidden; }
.adpop-track i { display: block; height: 100%; width: 100%; background: var(--accent); }
@media (max-width: 560px) { .adpop { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 196px); left: 12px; transform: none; width: min(240px, 60vw); } }

/* Status line: one sentence at the top centre about the dog's behaviour. */
.status {
  position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 50px); transform: translateX(-50%);
  margin: 0; max-width: min(560px, calc(100vw - 32px)); width: max-content; text-align: center;
  background: rgba(59, 47, 37, 0.82); color: #fff; padding: 9px 14px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity 0.6s;
}
.status.show { opacity: 1; animation: pop 0.25s ease-out; }
.status.fade { opacity: 0; }
.top { justify-content: flex-end; }
.chase { top: calc(max(12px, env(safe-area-inset-top)) + 104px); }
@media (max-width: 560px) {
  .top-right { gap: 4px; flex-wrap: nowrap; }
  .top-right .chip { font-size: 12px; padding: 6px 8px; min-height: 44px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .top-right .event-chip:not([hidden]) ~ .chip { display: none; } /* during an event its chip matters more than solo/online */
  .top-right .btn:not(.event-chip) { width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 18px; flex-shrink: 0; }
  .top-right .event-chip { min-height: 44px; padding: 6px 10px; font-size: 12px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status { font-size: 13px; }
}

/* Photo mode */
.photo-img { display: block; width: min(100%, 360px, calc((100dvh - 260px) * 0.8)); margin: 4px auto 12px; border-radius: 14px; box-shadow: 0 6px 18px rgba(60, 40, 20, 0.18); }
.photo-actions { justify-content: center; }
.ghost-btn {
  padding: 12px 18px; border-radius: 16px; border: 2px solid var(--line); background: #fff; color: var(--ink);
  font-family: var(--round); font-size: 19px; text-decoration: none;
}
.hint { font-size: 13px; color: var(--ink-dim); margin: 10px 0 0; }
.flash { position: fixed; inset: 0; background: #fff; pointer-events: none; opacity: 0; }
.flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

/* Costume closet */
.closet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.closet-item {
  display: grid; justify-items: center; gap: 2px; padding: 10px 8px; border-radius: 16px;
  border: 2px solid var(--line); background: #fff; font: inherit; color: var(--ink); text-align: center;
}
.closet-item .ci { font-size: 30px; line-height: 1.2; }
.closet-item small { font-size: 12px; color: var(--ink-dim); }
.closet-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.closet-item.locked { opacity: 0.55; }
#btn-closet.new::after { content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #e8394a; }
#btn-closet { position: relative; }

.event-chip { font-size: 14px; background: #fff3d6; border-color: #f2c14e; }

/* Frisbee */
.fb-hud {
  position: fixed; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 78px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 4px 14px rgba(60, 40, 20, 0.15); font-size: 15px; white-space: nowrap;
}
.fb-power { width: 90px; height: 10px; border-radius: 5px; background: #f1e3cf; overflow: hidden; }
.fb-power i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #58b07a, #f2b84b, #ef5b5b); }
.fb-quit { border: 0; background: #f1e3cf; border-radius: 50%; width: 26px; height: 26px; font-size: 12px; }
.fb-line { font-size: 18px; margin: 8px 0; }
#btn-frisbee.on { outline: 3px solid var(--accent); }
#btn-frisbee { touch-action: none; user-select: none; -webkit-user-select: none; }
@media (max-width: 560px) { .fb-hud { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 140px); font-size: 13px; } }
@media (max-width: 460px) {
  .top-right { gap: 4px; }
  .top-right .pill { padding: 6px 8px; font-size: 13px; }
  .top-right .chip { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.music-btn { width: 100%; margin-bottom: 14px; }

/* Fast travel */
.travel-map { display: block; width: min(100%, 240px, calc((100dvh - 330px) * 0.71)); margin: 6px auto 10px; border-radius: 12px; background: #efe6d2; }
.travel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.travel-list button { padding: 9px 8px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: inherit; color: var(--ink); }
.travel-list button:hover { border-color: var(--accent); }

/* 멍 mode */
body.meong-on #hud { display: none; }
.meong-ui { position: fixed; inset: auto 0 0 0; padding: 0 16px calc(max(18px, env(safe-area-inset-bottom)) + 10px); text-align: center; color: #fff; pointer-events: none;
  background: linear-gradient(to top, rgba(20, 16, 12, 0.5), rgba(20, 16, 12, 0)); }
.meong-name { margin: 0 0 4px; font-family: var(--round); font-size: 20px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); animation: meongIn 2.5s ease-out; }
.meong-line { margin: 0 0 14px; font-size: 14px; opacity: 0.85; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); animation: meongIn 4s ease-out; }
.meong-actions { display: flex; justify-content: center; gap: 10px; pointer-events: auto; }
.meong-actions button { border: 0; border-radius: 999px; padding: 10px 16px; background: rgba(255, 255, 255, 0.85); font: inherit; color: #3a2d22; }
@keyframes meongIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.meong-btn { animation: meongPulse 1.6s ease-in-out infinite; }
@keyframes meongPulse { 50% { transform: scale(1.06); } }

/* Welcome card and sound rows */
.welcome .sheet { max-width: 380px; }
.welcome-flag { font-size: 42px; margin: 0; }
.welcome-text { color: var(--ink-dim); margin: 4px 0 10px; }
.welcome-tips { text-align: left; margin: 0 0 16px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.welcome-actions { display: grid; gap: 8px; }
.welcome-actions button { width: 100%; }
.sound-rows { display: grid; gap: 8px; margin: 4px 0 14px; }
.sound-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 8px; font-size: 14px; }
.sound-row input { width: 100%; accent-color: var(--accent); padding: 0; border: 0; background: none; }

.photo-thumbs { display: flex; justify-content: center; gap: 8px; margin: -4px 0 8px; }
.photo-thumbs img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; border: 3px solid transparent; cursor: pointer; }
.photo-thumbs img.sel { border-color: var(--accent); }
.photo-times { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.photo-times button { border: 2px solid var(--line); background: #fff; border-radius: 999px; width: 44px; height: 36px; font-size: 18px; }
.photo-times button.sel { border-color: var(--accent); background: var(--accent-soft); }
.photo-img { width: min(100%, 300px, calc((100dvh - 380px) * 0.8)) !important; }

/* Shouts, notices, treat sharing */
.banner { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 96px); transform: translateX(-50%); max-width: min(92vw, 520px);
  padding: 9px 16px; border-radius: 14px; background: linear-gradient(90deg, #ff8a3a, #e8394a); color: #fff; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,0.2); z-index: 5; text-align: center; }
.feed { position: fixed; left: 12px; top: calc(max(12px, env(safe-area-inset-top)) + 140px); display: grid; gap: 4px; pointer-events: none; z-index: 4; }
.feed p { margin: 0; padding: 5px 10px; border-radius: 10px; background: rgba(30, 24, 18, 0.55); color: #fff; font-size: 12px; max-width: 62vw; animation: feedIn 0.3s ease-out; transition: opacity 0.6s; }
.feed p.out { opacity: 0; }
@keyframes feedIn { from { opacity: 0; transform: translateX(-8px); } }
.shout-list { display: grid; gap: 6px; }
.shout-list button { padding: 11px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: inherit; text-align: left; }
.shout-list button:hover { border-color: var(--accent); }
body.meong-on .feed, body.meong-on .banner { display: none; }

.together { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 8px; }
.together div { background: #fff3e2; border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 12px; color: var(--ink-dim); }
.together b { display: block; font-family: var(--round); font-size: 18px; color: var(--ink); }
.together .cap { grid-column: 1 / -1; background: none; padding: 0; font-size: 12px; }

/* Top-centre messages never pile up: a toast hides the dog's status line and pushes the event banner down. */
.status { transition: opacity 0.25s; }
body:has(#toast:not([hidden])) .status { opacity: 0; }
body:has(#toast:not([hidden])) .banner { top: calc(max(12px, env(safe-area-inset-top)) + 150px); }

/* Palace stamp tour: a card of seven red seals, and the seal slammed onto the screen when you stamp. */
.tour-open { width: 100%; margin: 8px 0 4px; font-family: var(--round); font-size: 16px; }
.tour-card { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px; }
.tour-slot { aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px; color: var(--ink-dim); font-size: 11px; background: #fff; }
.tour-slot b { font-family: var(--round); font-weight: 400; font-size: 14px; line-height: 1.15; text-align: center; word-break: keep-all; }
.tour-slot.on { border: 3px solid #c0262a; color: #c0262a; background: #fff3ef; transform: rotate(-4deg); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px #c0262a; }
.tour-slot.prize { border-style: solid; border-color: var(--accent); color: var(--ink); background: var(--accent-soft); font-size: 22px; }
.seal-pop { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 8; }
.seal-inner { width: 170px; height: 170px; border: 9px solid #c0262a; border-radius: 18px; color: #c0262a; display: grid; place-items: center; align-content: center; gap: 4px;
  background: rgba(255, 248, 240, 0.92); box-shadow: inset 0 0 0 4px rgba(255,255,255,0.9), inset 0 0 0 9px #c0262a, 0 10px 30px rgba(0,0,0,0.25); transform: rotate(-8deg);
  animation: seal-slam 0.42s cubic-bezier(.2,1.6,.4,1) both; }
.seal-inner b { font-family: var(--round); font-weight: 400; font-size: 30px; line-height: 1.1; text-align: center; padding: 0 10px; word-break: keep-all; }
.seal-inner small { font-family: var(--round); font-size: 13px; opacity: 0.8; }
@keyframes seal-slam { from { transform: rotate(-8deg) scale(2.6); opacity: 0; } 60% { opacity: 1; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }

/* Privacy & terms link at the bottom of the menu */
.legal-link { display: block; margin-top: 14px; text-align: center; font-size: 13px; color: #8a7462; text-decoration: underline; }
.admin-links { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.admin-links a { font-size: 13px; padding: 6px 10px; border-radius: 10px; background: #f3e7d6; color: #5a4636; text-decoration: none; }
.share-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; color: #6a5646; }
.share-row input { width: 18px; height: 18px; accent-color: #e8793a; }
.people-box { margin-top: 10px; }
.people-list { display: grid; gap: 6px; max-height: 160px; overflow-y: auto; touch-action: pan-y; }
.people-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.people-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-row .chip-btn { padding: 4px 10px; font-size: 13px; }
.feedback-link { display: block; margin-top: 12px; text-align: center; font-size: 14px; color: #b4541f; }

/* Landmark story card: slides in under the top bar near a landmark, tap to close. */
.story {
  position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 104px); transform: translateX(-50%); z-index: 5;
  width: min(420px, calc(100vw - 32px)); display: grid; gap: 3px; text-align: left; padding: 11px 14px 12px;
  border: 2px solid #e2c48c; border-radius: 16px; background: #fffaf0; color: var(--ink); box-shadow: var(--shadow); font: inherit;
  animation: storyIn 0.35s ease-out;
}
.story small { font-size: 11px; color: #a0672a; font-weight: 700; }
.story b { font-family: var(--round); font-weight: 400; font-size: 18px; }
.story span { font-size: 13px; line-height: 1.45; color: var(--ink-dim); }
.story.out { opacity: 0; transition: opacity 0.5s; }
@keyframes storyIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.stories { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.stories summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.stories ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13px; line-height: 1.45; }
.stories li.locked { color: var(--ink-dim); }
.stories li b { display: block; }

/* Friends: the section in the places sheet, the invite button and a friend's call. */
.invite-btn { width: 100%; margin: 4px 0 10px; }
.friends { margin: 8px 0 10px; padding: 10px 12px; border-radius: 14px; background: #fff6e2; border: 2px solid #f0d9a8; font-size: 13px; }
.friends h3 { margin: 0 0 6px; font-size: 15px; }
.friends .fr-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed #ecd9b0; }
.friends .fr-row:first-of-type { border-top: 0; }
.friends .fr-name { flex: 1; min-width: 0; }
.friends .fr-name small { display: block; color: var(--ink-dim); }
.friends button { border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; background: var(--accent); color: #fff; }
.friends button.ghost { background: #efe4d2; color: var(--ink); }
.friends .fr-me { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.friends .fr-me code { font-size: 15px; letter-spacing: 0.12em; background: #fff; padding: 3px 8px; border-radius: 8px; }
.friends .fr-add { display: flex; gap: 6px; margin-top: 8px; }
.friends .fr-add input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 2px solid var(--line); font: inherit; text-transform: uppercase; letter-spacing: 0.1em; }
.friends .fr-link { width: 100%; margin-top: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; color: var(--ink-dim); background: #fff; }
.friends .fr-note { margin: 6px 0 0; color: var(--ink-dim); font-size: 12px; }
.fm-list { margin-bottom: 16px; }
.fm-list button { background: #fff6e2; }
.fcall { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 150px); transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(92vw, 460px); padding: 9px 10px 9px 16px; border-radius: 16px; word-break: keep-all;
  background: linear-gradient(90deg, #f2b632, #e8893a); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.2); font-size: 15px; animation: storyIn 0.3s ease-out; }
.fcall span { flex: 1; min-width: 0; }
.fcall button { border: 0; border-radius: 999px; padding: 7px 14px; background: #fff; color: #b0611a; font: inherit; font-weight: 700; white-space: nowrap; }

/* Window and button size: --ui is set by main.js (undoes text the browser enlarged on its own, e.g. Threads and
   Instagram follow the phone's font-size setting, times the player's choice in the menu). The 3D view is not zoomed. */
:root { --ui: 1; }
.sheet, .match-card, #hud .top, #hud .actions, #hud .emotes { zoom: var(--ui); }
