:root {
  --ink: #f6ead2;
  --dim: #b7b2c8;
  --gold: #ffc46b;
  --gold-2: #ff9a3c;
  --glass: rgba(14, 16, 40, .62);
  --line: rgba(255, 214, 150, .22);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070a1c; color: var(--ink); font-family: "IBM Plex Sans KR", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#c:active { cursor: grabbing; }
button, input, textarea { font: inherit; color: inherit; }

#top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px 0; pointer-events: none; }
#top > * { pointer-events: auto; }
.home { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--glass); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 1.5rem; line-height: 1; backdrop-filter: blur(8px); }
.ttl { flex: 1; text-align: center; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); }
.ttl h1 { margin: 0; font-family: "Gowun Batang", serif; font-weight: 700; font-size: clamp(1.25rem, 4.2vw, 1.9rem); letter-spacing: .06em; color: #ffe2ad; }
.ttl p { margin: 2px 0 0; font-size: .82rem; color: var(--dim); }

.ghost { background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; backdrop-filter: blur(8px); font-size: .88rem; white-space: nowrap; }
.ghost b { color: var(--gold); margin-left: 2px; }
.ghost:hover { border-color: rgba(255, 214, 150, .5); }

#wish, #after { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(440px, calc(100% - 32px)); background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 16px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 16px 50px rgba(0, 0, 0, .45); transition: opacity .5s, transform .5s; }
#wish.out { opacity: 0; transform: translate(-50%, 24px); pointer-events: none; }
.lbl { display: block; font-size: .85rem; color: var(--dim); margin-bottom: 8px; }
textarea { width: 100%; resize: none; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 10px 12px; font-family: "Gowun Batang", serif; font-size: 1.08rem; line-height: 1.5; color: #fff6e4; outline: none; }
textarea:focus, #wName:focus { border-color: var(--gold); }
textarea::placeholder, input::placeholder { color: #8c88a3; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
#wName { flex: 1; min-width: 0; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 8px 11px; font-size: .92rem; outline: none; }
.colors { display: flex; gap: 7px; }
.colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset; }
.colors button[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 12px rgba(255, 200, 120, .7); }
.colors [data-c="0"] { background: radial-gradient(circle at 50% 70%, #fff1c9, #f2b35a); }
.colors [data-c="1"] { background: radial-gradient(circle at 50% 70%, #ffc29e, #e2452b); }
.colors [data-c="2"] { background: radial-gradient(circle at 50% 70%, #ffd6e2, #ea6f9a); }
.colors [data-c="3"] { background: radial-gradient(circle at 50% 70%, #f0ffc9, #8cbf4a); }
.cnt { flex: 1; font-size: .8rem; color: #8c88a3; }
#go, #again, #mineClose { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #2a1503; font-weight: 600; border: 0; border-radius: 999px; padding: 10px 22px; cursor: pointer; box-shadow: 0 4px 22px rgba(255, 160, 60, .45); }
#go:hover, #again:hover { filter: brightness(1.06); }
#go:disabled { opacity: .5; cursor: default; }

#after { text-align: center; }
#after[hidden] { display: none; }
#afterMsg { margin: 2px 0 4px; font-family: "Gowun Batang", serif; font-size: 1.02rem; line-height: 1.6; }
#afterMsg b { color: var(--gold); }
#after .row { justify-content: center; }

#mine { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(3, 4, 14, .55); padding: 16px; }
#mine[hidden] { display: none; }
.sheet { width: min(420px, 100%); max-height: 80vh; overflow: auto; background: #12142e; border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.sheet h2 { margin: 0 0 12px; font-family: "Gowun Batang", serif; font-size: 1.2rem; color: #ffe2ad; }
#mineList { margin: 0; padding-left: 1.4em; font-family: "Gowun Batang", serif; line-height: 1.6; }
#mineList li { margin-bottom: 8px; }
#mineList small { display: block; color: #8c88a3; font-family: "IBM Plex Sans KR", sans-serif; font-size: .75rem; }
#mineList .empty { list-style: none; margin-left: -1.4em; color: var(--dim); }
.note { font-size: .78rem; color: #8c88a3; margin: 14px 0 0; }
.sheet .row { justify-content: flex-end; }

#toast { position: fixed; left: 50%; bottom: 14%; transform: translate(-50%, 8px); margin: 0; font-family: "Gowun Batang", serif; font-size: clamp(1rem, 3.6vw, 1.35rem); color: #fff2d6; text-shadow: 0 0 18px rgba(255, 170, 70, .8), 0 2px 8px rgba(0, 0, 0, .7); opacity: 0; transition: opacity .8s, transform .8s; pointer-events: none; text-align: center; width: calc(100% - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#nogl { position: fixed; inset: auto 16px 50% 16px; text-align: center; color: var(--ink); }
.hint { position: fixed; right: 16px; bottom: 8px; margin: 0; font-size: .72rem; color: rgba(183, 178, 200, .55); pointer-events: none; }
@media (max-width: 640px) { .hint { display: none; } }
