:root {
  --ink: #f7f3ea;
  --ink-dim: rgba(247, 243, 234, 0.72);
  --glass: rgba(20, 30, 46, 0.62);
  --glass-line: rgba(255, 255, 255, 0.14);
  --accent: #f2b880;
  --accent-ink: #2a1a0e;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
/* Operator-only coordinate tools: DOM pins keep a constant CSS pixel size. */
.coordinates-button { position: fixed; top: 124px; left: 16px; z-index: 7; background: var(--glass); border: 1px solid var(--glass-line); }
.coordinate-picking { cursor: crosshair; }
.coordinates-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.coordinate-pin { position: absolute; width: 28px; height: 28px; display: grid; place-items: center; transform: translate(-50%, -100%); border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: #c1366b; color: #fff; font: 700 12px system-ui, sans-serif; box-shadow: 0 2px 8px #0008; }
.coordinate-pin[hidden], .coordinates-overlay[hidden], .coordinates-panel[hidden], .coordinates-cursor[hidden], #coordinates-fallback[hidden] { display: none; }
.coordinates-cursor { position: fixed; margin: 0; z-index: 7; padding: 5px 8px; border-radius: 6px; background: #122235e8; color: #fff; font-size: 12px; pointer-events: none; white-space: nowrap; }
.coordinates-panel { position: fixed; left: 16px; bottom: calc(82px + var(--safe-b)); z-index: 7; width: min(630px, calc(100vw - 32px)); max-height: 33vh; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--glass-line); border-radius: 14px; background: #15243aeb; font-size: 12px; overscroll-behavior: contain; }
.coordinates-panel header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.coordinates-panel .chip { padding: 7px 10px; }
.coordinates-panel button:disabled { opacity: .4; cursor: default; }
.coordinates-panel ol { list-style: none; padding: 0; margin: 0; }
.coordinates-panel li { display: grid; gap: 5px; padding: 7px 0; border-top: 1px solid var(--glass-line); }
.coordinates-panel input, .coordinates-panel textarea { width: 100%; border: 1px solid #ffffff40; border-radius: 6px; padding: 6px 8px; background: #ffffff12; color: #fff; font: inherit; }
.coordinates-panel input::placeholder { color: #ffffffa8; }
.coordinates-panel textarea { margin-top: 8px; resize: vertical; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #16243a; color: var(--ink); font-family: "Noto Sans KR", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
canvas#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.hud-top { position: fixed; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; z-index: 5; }
.place, .walked { background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 14px; padding: 9px 14px; }
.place strong { display: block; font-family: "Noto Serif KR", serif; font-size: 17px; letter-spacing: 0.02em; }
.place span { font-size: 12.5px; color: var(--ink-dim); }
.walked { text-align: right; }
.walked span { display: block; font-size: 11px; color: var(--ink-dim); }
.walked strong { font-size: 16px; font-variant-numeric: tabular-nums; }

.intro { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: center; padding: 0 max(24px, 8vw); background: linear-gradient(90deg, rgba(12, 20, 34, 0.82) 0%, rgba(12, 20, 34, 0.45) 55%, rgba(12, 20, 34, 0) 100%); }
.intro[hidden] { display: none; }
.kicker { margin: 0 0 14px; font-size: 13px; color: var(--accent); letter-spacing: 0.04em; }
.intro h1 { margin: 0; font-family: "Noto Serif KR", serif; font-weight: 600; font-size: clamp(44px, 9vw, 92px); line-height: 1.04; }
.lead { margin: 18px 0 28px; max-width: 30em; color: var(--ink-dim); line-height: 1.7; font-size: 15px; }
.loading { font-size: 13px; color: var(--ink-dim); margin-top: 14px; }

.btn { border: 0; border-radius: 999px; padding: 13px 26px; font-weight: 700; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(242, 184, 128, 0.35); align-self: flex-start; }
.btn.primary:disabled { opacity: 0.5; cursor: wait; }
.btn.ghost { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--glass-line); }

.dock { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 6px; align-items: center; padding: 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 5; }
.chip { border: 0; background: transparent; padding: 9px 14px; border-radius: 999px; font-size: 13.5px; color: var(--ink-dim); white-space: nowrap; }
.chip.on { background: rgba(255, 255, 255, 0.92); color: #1b2638; font-weight: 700; }
.chip.camera { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.sep { width: 1px; height: 20px; background: var(--glass-line); margin: 0 2px; }
.help { position: fixed; left: 16px; bottom: calc(22px + var(--safe-b)); margin: 0; font-size: 12px; color: var(--ink-dim); z-index: 4; max-width: 30vw; }

.joy { position: fixed; left: 22px; bottom: calc(84px + var(--safe-b)); width: 118px; height: 118px; border-radius: 50%; background: rgba(20, 30, 46, 0.35); border: 1px solid var(--glass-line); z-index: 6; display: none; touch-action: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); transform: translate(-50%, -50%); }

.photo-panel { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 12px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 8; display: grid; gap: 6px; }
.photo-panel[hidden] { display: none; }
.photo-panel .row { display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.photo-panel .label { font-size: 12px; color: var(--ink-dim); width: 34px; flex: none; }
.photo-panel .actions { justify-content: flex-end; gap: 8px; margin-top: 4px; }

.toast { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); margin: 0; padding: 9px 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); font-size: 13.5px; z-index: 9; white-space: nowrap; }
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 20; }
.flash.go { animation: flash 0.45s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
.credit { position: fixed; right: 12px; bottom: calc(6px + var(--safe-b)); font-size: 10.5px; color: var(--ink-dim); z-index: 4; }
.credit a { color: inherit; }

body:not(.playing) .dock, body:not(.playing) .help, body:not(.playing) .hud-top .walked { visibility: hidden; }
body.photo .dock, body.photo .help, body.photo .joy, body.photo .hud-top { visibility: hidden; }
.overview-hint { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-line); font-size: 12.5px; z-index: 6; max-width: calc(100vw - 32px); text-align: center; }
.overview-hint[hidden] { display: none; }
/* overview hint sits where toasts appear, so move toasts to the bottom while it is open */
body.overview .toast { top: auto; bottom: calc(80px + var(--safe-b)); }
body.overview .help, body.overview .joy { visibility: hidden; }
.chip[hidden] { display: none; }

@media (hover: none) and (pointer: coarse), (max-width: 600px) {
  .help { display: none; }
  body.playing .joy { display: block; }
  .dock { left: auto; right: 12px; transform: none; bottom: calc(14px + var(--safe-b)); flex-direction: column; border-radius: 22px; }
  body.overview .toast { bottom: calc(24px + var(--safe-b)); max-width: calc(100vw - 96px); white-space: normal; text-align: center; }
  .dock .sep { width: 20px; height: 1px; }
  .chip { padding: 9px 12px; font-size: 13px; }
  .intro { background: linear-gradient(180deg, rgba(12, 20, 34, 0.15) 0%, rgba(12, 20, 34, 0.85) 70%); justify-content: flex-end; padding-bottom: calc(48px + var(--safe-b)); }
  .credit { right: auto; left: 12px; }
}
@media (prefers-reduced-motion: reduce) { .flash.go { animation: none; } }
.look-pick { display: flex; gap: 8px; margin: 0 0 14px; }
.look-pick .chip { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--glass-line); color: #fff; padding: 9px 18px; }
.look-pick .chip.on { background: rgba(255, 255, 255, 0.92); color: #1b2638; }
.place-wrap { position: relative; pointer-events: auto; }
button.place { display: block; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.place .caret { font-size: 10px; opacity: 0.7; }
.time-menu { position: absolute; top: calc(100% + 8px); left: 0; display: flex; flex-wrap: wrap; gap: 6px; width: max-content; max-width: min(300px, calc(100vw - 32px)); padding: 10px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.time-menu[hidden] { display: none; }
.time-title { width: 100%; margin: 0 0 2px 4px; font-size: 12px; color: var(--ink-dim); }
.time-menu .chip { background: rgba(255, 255, 255, 0.1); color: #fff; }
.time-menu .chip.on { background: rgba(255, 255, 255, 0.92); color: #1b2638; }
.intro { transition: opacity 0.6s ease; }
.intro.leaving { opacity: 0; pointer-events: none; }
.help { display: none !important; }
.time-menu { max-height: calc(100vh - 140px); overflow-y: auto; }
.hud-right { display: flex; gap: 8px; align-items: flex-start; pointer-events: auto; }
.me-button { width: 52px; height: 52px; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.85); background: #f4efe6; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); cursor: pointer; }
.me-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
body:not(.playing) .hud-top .me-button { visibility: hidden; }
.me-sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 14, 24, 0.45); }
.me-sheet[hidden] { display: none; }
.first-look { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.first-look-card h2 { margin: 2px 0 18px; text-align: center; font-size: 20px; font-weight: 700; }
.first-look-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.first-look-option { min-width: 0; padding: 0 0 12px; border: 1px solid #ded8cd; border-radius: 16px; background: #ece8df; color: #3d4a44; overflow: hidden; font-size: 16px; font-weight: 700; }
.first-look-option img { display: block; width: 100%; height: auto; aspect-ratio: 300 / 360; object-fit: contain; background: linear-gradient(180deg, #f1ece3, #e6dfd2); margin-bottom: 8px; }
.first-look-option:hover { border-color: #2f5a49; background: #e2e9e0; }
.first-look-option:focus-visible { outline: 3px solid #2f5a49; outline-offset: 3px; }
.me-card { width: min(360px, 100%); background: #faf7f1; color: #23302b; border-radius: 22px; padding: 18px 18px 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); }
.me-card { max-height: calc(100dvh - 32px); overflow-y: auto; }
#auth-panel { border-top: 1px solid #ded8cd; padding-top: 12px; margin-top: 12px; }
#google-signin { display: flex; justify-content: center; min-height: 40px; }
#auth-name { font-size: 14px; overflow-wrap: anywhere; }
#auth-member .chip { color: #344b48; border-color: #c9cfc8; background: #fff; }
.me-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.me-card header strong { font-size: 18px; }
.me-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #ece8df; color: #3d4a44; font-size: 15px; cursor: pointer; }
#me-preview { display: block; width: 100%; max-width: 300px; aspect-ratio: 300 / 360; height: auto; margin: 0 auto; border-radius: 16px; background: linear-gradient(180deg, #f1ece3, #e6dfd2); }
.me-looks { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.me-looks .chip { background: #ece8df; color: #3d4a44; padding: 10px 22px; font-size: 15px; }
.me-looks .chip.on { background: #2f5a49; color: #fff; }
.me-note { margin: 4px 0 0; text-align: center; font-size: 12px; color: #7a857f; }
.credit { display: flex; align-items: center; gap: 6px; flex-direction: row-reverse; }
.credit-toggle { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.25); color: rgba(255, 255, 255, 0.75); font-size: 13px; line-height: 22px; cursor: pointer; }
.credit-text { background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 8px; color: #e8edf2; }
.credit-text[hidden] { display: none; }
@media (max-width: 720px) { .credit { flex-direction: row; } }

/* Character equipment grid: original canvas portraits, no external icon assets. */
.dressup-card { width: min(840px, 100%); padding: 18px; overscroll-behavior: contain; }
.dressup-card button { min-height: 44px; min-width: 44px; }
.dressup-card button:focus-visible, .dressup-card canvas:focus-visible { outline: 3px solid #477b67; outline-offset: 2px; }
.dressup-card .me-close { width: 44px; height: 44px; flex: none; }
.dressup-layout { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 20px; }
.dressup-preview, .dressup-controls { min-width: 0; }
.dressup-card #me-preview { cursor: grab; touch-action: none; }
.dressup-card #me-preview:active { cursor: grabbing; }
.dressup-presets { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.dressup-card .chip { background: #e7e8df; color: #324b40; white-space: normal; }
.dressup-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.dressup-slot { min-width: 0; border: 1px solid #d9dfd3; border-radius: 13px; padding: 6px 3px; background: #edf0e8; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dressup-slot img { width: 52px; height: 52px; object-fit: contain; }
.dressup-slot strong { font-size: 12px; }
.dressup-slot span { font-size: 10px; overflow-wrap: anywhere; line-height: 1.4; }
.dressup-slot[aria-pressed="true"] { border-color: #2f5a49; box-shadow: inset 0 0 0 1px #2f5a49; background: #dae8d9; }
.dressup-empty { justify-content: center; min-height: 104px; }
.dressup-covered { opacity: .57; }
.dressup-editor { margin-top: 12px; border: 1px solid #d9dfd3; border-radius: 16px; background: #fffdf7; padding: 12px; }
.dressup-editor h3 { margin: 0 0 10px; font-size: 15px; }
.dressup-editor-heading { display: flex; justify-content: space-between; align-items: center; }
#dressup-editor-close { display: none; }
.dressup-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dressup-option { border: 1px solid #d9dfd3; border-radius: 10px; background: #f0f1ea; padding: 6px; font-size: 12px; overflow-wrap: anywhere; }
.dressup-option img { display: block; width: 52px; height: 52px; margin: 0 auto 4px; object-fit: contain; }
.dressup-option[aria-pressed="true"] { border-color: #2f5a49; background: #dcebd9; box-shadow: inset 0 0 0 1px #2f5a49; }
.dressup-face-group { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.dressup-face-group p { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.dressup-colors { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.dressup-colors:empty { display: none; }
.dressup-color { width: 44px; height: 44px; padding: 5px; border: 2px solid transparent; border-radius: 50%; background: transparent; }
.dressup-color::before { content: ''; display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #0002; }
.dressup-color[aria-pressed="true"] { border-color: #2f5a49; }
.dressup-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin: 16px 0 8px; }
.dressup-actions .btn { padding: 10px 24px; }
@media (max-width: 600px) {
  #me-sheet { padding: 8px; align-items: flex-start; padding-top: max(8px, env(safe-area-inset-top)); }
  .dressup-card { max-height: calc(100dvh - 16px - env(safe-area-inset-top)); padding: 12px; border-radius: 18px; }
  .dressup-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dressup-card #me-preview { max-width: 160px; }
  .dressup-presets { margin-top: 4px; }
  .dressup-presets .chip { font-size: 12px; padding: 6px 10px; }
  .dressup-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .dressup-slot img { width: 44px; height: 44px; }
  .dressup-empty { min-height: 96px; }
  .dressup-editor { display: none; position: fixed; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; right: 8px; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 18px 18px 10px 10px; box-shadow: 0 -8px 35px #283b3240; z-index: 3; }
  .dressup-editor.is-open { display: block; animation: dressup-rise .18s ease-out; }
  #dressup-editor-close { display: block; }
  .dressup-actions { position: sticky; bottom: -12px; background: #faf7f1; padding: 10px 0; margin-bottom: 0; z-index: 1; }
}
@keyframes dressup-rise { from { transform: translateY(18px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dressup-editor.is-open { animation: none; } }
