:root {
  --bg: #ece7de; --ink: #2a2622; --mute: #8a8178; --card: #fbfaf7; --line: #e3ddd2;
  --dark: #2c3934; --accent: #14a9ae;
  --serif: 'Instrument Serif', 'Gowun Batang', serif;
  --kserif: 'Gowun Batang', serif;
  --sans: 'IBM Plex Sans KR', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.brand { position: fixed; left: 36px; top: 30px; pointer-events: none; max-width: 340px; }
.kicker { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.kicker span { margin-left: 10px; letter-spacing: .1em; }
.brand h1 { font-family: var(--serif); font-weight: 400; font-size: 64px; line-height: .95; margin: 14px 0 12px; letter-spacing: -.01em; }
.brand h1 em { font-style: italic; display: block; }
.lede { font-family: var(--kserif); font-size: 13px; line-height: 1.7; color: #5a524a; margin: 0; }

.live { position: fixed; top: 30px; right: 36px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 10px; letter-spacing: .12em; color: #5a524a; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #2bbf6a; box-shadow: 0 0 0 3px #2bbf6a22; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.panel { position: fixed; right: 36px; top: 76px; width: 236px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px -12px #4a3c2a33; font-size: 11px; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 4px; font-size: 10px; letter-spacing: .18em; color: var(--mute); font-weight: 600; }
.ph button { border: 0; background: none; font-size: 16px; line-height: 1; color: var(--mute); padding: 0 2px; }
.body { padding: 6px 14px 14px; }
.panel.folded .body { display: none; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.acts button, .wide { border: 0; border-radius: 6px; padding: 8px 4px; font-weight: 600; font-size: 11px; }
.dark { background: var(--dark); color: #f4f1ea; transition: transform .1s, background .2s; }
.dark:hover { background: #3c4c46; }
.dark:active, .wide:active { transform: scale(.96); }
.dark:disabled { background: #b9b3a8; cursor: default; }
.wide { width: 100%; margin-top: 5px; background: #f1ece3; border: 1px solid var(--line) !important; color: var(--ink); }
.wide:hover { background: #ebe4d7; }
.stats { display: flex; justify-content: space-between; color: var(--mute); margin: 10px 1px 2px; font-size: 10px; }
.stats b { color: var(--ink); font-weight: 600; margin-left: 2px; }
.prog { margin: 8px 0 4px; }
.prog .row { display: flex; justify-content: space-between; color: var(--mute); font-size: 10px; margin-bottom: 4px; }
.bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width .3s; }
.sec { margin: 14px 0 7px; font-size: 10px; letter-spacing: .18em; color: var(--mute); font-weight: 600; }
.flav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.flav button { background: none; border: 1px solid var(--line); border-radius: 7px; padding: 8px 2px 6px; font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: #5a524a; }
.flav button i { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8 0 18%, transparent 30%), var(--c); box-shadow: inset 0 -2px 4px #0002; }
.flav button.on { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.sl { display: grid; grid-template-columns: 1fr auto; margin-top: 11px; color: #5a524a; font-size: 10.5px; }
.sl output { color: var(--mute); font-size: 10px; }
.sl input { grid-column: 1 / -1; width: 100%; margin: 6px 0 0; -webkit-appearance: none; appearance: none; height: 2px; background: var(--line); border-radius: 2px; outline: none; }
.sl input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--ink); cursor: pointer; }
.sl input::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--ink); }
.foot { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.foot button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 0; font-size: 9.5px; color: #5a524a; white-space: nowrap; }
.foot button:hover { background: #f1ece3; }
.foot button.on { background: var(--dark); color: #f4f1ea; border-color: var(--dark); }

.how { position: fixed; left: 36px; bottom: 28px; pointer-events: none; max-width: 520px; }
.how .big { font-family: var(--kserif); font-style: italic; font-size: 15px; margin: 6px 0 3px; }
.how .small { font-size: 10px; color: var(--mute); margin: 0; line-height: 1.6; }
.corner { position: fixed; right: 36px; bottom: 28px; text-align: right; font-family: var(--kserif); font-size: 12px; line-height: 1.5; color: #8a8178; pointer-events: none; }
.corner span { display: block; font-family: var(--sans); font-size: 9px; letter-spacing: .16em; margin-top: 6px; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(8px); background: #2c3934ee; color: #f4f1ea; padding: 9px 16px; border-radius: 99px; font-size: 12px; opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 3D 이름표 */
.tag { pointer-events: none; display: flex; flex-direction: column; align-items: center; transform: translateY(-12px); }
.tag .t { font-family: var(--kserif); font-weight: 700; font-size: 12px; color: var(--ink); background: #fbfaf7e8; border: 1px solid var(--line); padding: 3px 8px 2px; border-radius: 6px; white-space: nowrap; box-shadow: 0 4px 10px -6px #0004; }
.tag .t small { font-family: var(--sans); font-weight: 400; font-size: 9px; color: var(--mute); margin-left: 5px; }
.tag .ln { width: 1px; height: 14px; background: #2a262288; }
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.tags-off .tag { display: none; }

@media (max-width: 760px) {
  .brand { left: 16px; top: 14px; }
  .brand h1 { font-size: 38px; margin: 8px 0 6px; }
  .brand h1 em { display: inline; }
  .lede { display: none; }
  .live { top: 16px; right: 16px; }
  .panel { left: 16px; right: 16px; top: auto; bottom: 14px; width: auto; max-height: 52vh; overflow: auto; }
  .panel .sl { margin-top: 8px; }
  .how, .corner { display: none; }
  #toast { bottom: auto; top: 96px; }
}

/* ===== v2: 젤리 글자 ===== */
body { --jc: #2ec9d4; --jd: #0a8fa6; --jl: #c4f8f5; --jx: #06627a; }
body[data-flavour="deepsea"] { --jc: #2f80ee; --jd: #0b4cc0; --jl: #d2e4ff; --jx: #062f7c; }
body[data-flavour="yuzu"] { --jc: #f8c834; --jd: #dc9208; --jl: #fff2bd; --jx: #94590a; }
.brand h1.jtitle { margin: 10px 0 14px; font-size: 76px; line-height: .9; }
.jword { display: block; pointer-events: auto; white-space: nowrap; font-family: 'Fraunces', var(--serif); font-weight: 900;
  font-variation-settings: "SOFT" 100, "opsz" 144; letter-spacing: -.015em; }
.jword.alt { font-style: italic; margin-left: .12em; }
.jl { position: relative; display: inline-block; transform-origin: 50% 90%; cursor: default;
  animation: breathe 3.4s ease-in-out infinite; animation-delay: calc(var(--i) * -0.31s); }
/* 몸통: 반투명 젤리 그라데이션 */
.jl b { position: relative; z-index: 2; font-weight: inherit;
  background: radial-gradient(120% 70% at 35% 18%, #ffffffee 0 12%, transparent 34%),
              linear-gradient(175deg, var(--jl) 0%, var(--jc) 42%, var(--jd) 88%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--jd) 55%, transparent); }
.jword:not(.alt) .jl b { background: radial-gradient(120% 70% at 35% 18%, #ffffffee 0 12%, transparent 34%),
  linear-gradient(175deg, #fff 0%, var(--jl) 30%, color-mix(in srgb, var(--jc) 70%, #fff) 70%, var(--jc) 100%);
  -webkit-background-clip: text; background-clip: text; }
/* 두께(아랫면) + 색 그림자: 젤리가 빛을 머금은 느낌 */
.jl::before { content: attr(data-c); position: absolute; left: 0; top: 0; z-index: 1; color: var(--jx);
  transform: translate(.015em, .06em); opacity: .55;
  filter: drop-shadow(0 .08em .1em color-mix(in srgb, var(--jc) 60%, transparent)) blur(.4px); }
/* 반짝이 */
.jl::after { content: ''; position: absolute; z-index: 3; left: 28%; top: 24%; width: 16%; height: 9%; border-radius: 50%;
  background: #fff; opacity: .85; filter: blur(1px); transform: rotate(-22deg); pointer-events: none; }
.jl.dot::after, .jl.narrow::after { left: 30%; width: 30%; }
.jl.jig { animation: jig .95s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--d, 0) * 1s); }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .972); } }
@keyframes jig {
  0% { transform: scale(1, 1); } 16% { transform: scale(1.24, .74) translateY(4px); } 36% { transform: scale(.86, 1.18) translateY(-7px); }
  56% { transform: scale(1.08, .93); } 76% { transform: scale(.97, 1.03); } 100% { transform: scale(1, 1); } }

/* 지도 이름표: 젤리 구미 알약 */
.tag .t { font-family: 'Fraunces', var(--kserif); font-weight: 700; color: #fff; border: 0; padding: 4px 11px 3px; border-radius: 99px;
  background: radial-gradient(90% 60% at 30% 10%, #ffffffb0 0 22%, transparent 45%), linear-gradient(175deg, var(--jc), var(--jd));
  box-shadow: inset 0 -3px 5px color-mix(in srgb, var(--jx) 45%, transparent), inset 0 2px 2px #ffffff80,
              0 6px 12px -4px color-mix(in srgb, var(--jd) 60%, transparent);
  text-shadow: 0 1px 1px color-mix(in srgb, var(--jx) 60%, transparent); }
.tag .t small { color: #ffffffcc; }
.tag .ln { background: color-mix(in srgb, var(--jd) 70%, transparent); }
.tag .dot { background: var(--jd); box-shadow: 0 0 0 3px color-mix(in srgb, var(--jc) 35%, transparent); }
.tag .t { animation: tagbob 3s ease-in-out infinite; }
@keyframes tagbob { 50% { transform: translateY(-3px) scale(1.03, .97); } }

@media (max-width: 760px) { .brand h1.jtitle { font-size: 44px; } .jword { display: inline-block; } .jword.alt { margin-left: .2em; } }
body[data-flavour="yuzu"] .tag .t { color: #5a3404; text-shadow: 0 1px 0 #fff6; }
body[data-flavour="yuzu"] .tag .t small { color: #5a3404b0; }
