:root {
  --night: #081310;
  --walnut: #3B2316;
  --brass: #C9A15B;
  --amber: #E39B2D;
  --paper: #EEE4CF;
  --smoke: #93A298;
  --glass: rgba(8, 19, 16, .82); /* controls floating over the lit shelves: dark enough to read, blurred so the bar still shows */
  --text: rgba(238, 228, 207, .9);
  --serif: 'Hahmlet', 'Nanum Myeongjo', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--night);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: progress; opacity: .7; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 3px; }
[hidden] { display: none !important; }
a { color: inherit; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.labels { position: fixed; inset: 0; pointer-events: none; }

.cta {
  background: var(--brass);
  color: #1D140C;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 18px rgba(0, 0, 0, .35);
  transition: background .2s;
}
.cta:hover:not(:disabled) { background: #DDB670; }
.ghost-btn { padding: 13px 18px; color: var(--smoke); }
.ghost-btn:hover { color: var(--paper); }

/* ---------- which overlay shows ---------- */
.cabinet-ui, .bar-ui, .pour-cap { display: none; }
body[data-view="cabinet"] .cabinet-ui,
body[data-view="bar"] .bar-ui,
body[data-view="pour"] .pour-cap { display: block; }
body:not([data-view="bar"]) .labels { visibility: hidden; }

/* ---------- header ---------- */
.top {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) 20px 0 24px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
/* a dark fade behind the header so its text never sits straight on bright bottles */
.top::before {
  content: ''; position: absolute; z-index: -1; inset: 0 0 -32px; pointer-events: none;
  background: linear-gradient(rgba(5, 11, 9, .85), rgba(5, 11, 9, .5) 60%, transparent);
}
.logo { margin-right: auto; color: var(--paper); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.status { font-size: 14px; color: var(--text); text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
.where { color: var(--paper); text-shadow: inherit; }
.where::after { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 2px 3px 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.where:hover { color: #E8C57F; }
.invite { font-size: 14px; font-weight: 600; padding: 7px 14px; border: 1px solid rgba(201, 161, 91, .75); border-radius: 4px; color: #E8C57F; background: var(--glass); backdrop-filter: blur(8px); }
.invite:hover, .menu-btn:hover { background: rgba(201, 161, 91, .14); }
.menu-btn { font-size: 14px; font-weight: 600; padding: 7px 14px; border: 1px solid rgba(201, 161, 91, .75); border-radius: 4px; color: var(--paper); background: var(--glass); backdrop-filter: blur(8px); }
body:not([data-view="cabinet"]) .menu-btn { display: none; }
.sound { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--paper); background: var(--glass); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .45); }
.sound svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sound path:first-child { fill: currentColor; stroke: none; }
.sound[aria-pressed="true"] .off, .sound[aria-pressed="false"] .wave { display: none; }
body:not([data-view="bar"]) .status,
body:not([data-view="bar"]) .invite { display: none; }
body[data-view="door"] .top { visibility: hidden; }

/* ---------- door ---------- */
.door {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-content: center; justify-items: center; gap: 22px;
  padding: 24px; text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, rgba(8, 19, 16, .25), rgba(8, 19, 16, .88) 80%);
  transition: opacity 1.1s, visibility 1.1s;
}
.door h1 {
  font-weight: 300; font-size: clamp(64px, 13vw, 148px); line-height: 1; letter-spacing: -.05em;
  color: #F6E7C8;
  text-shadow: 0 0 40px rgba(227, 155, 45, .35), 0 2px 0 rgba(0, 0, 0, .4);
}
.door-line { max-width: 24em; opacity: .85; font-size: 17px; line-height: 1.75; text-shadow: 0 1px 10px rgba(0, 0, 0, .8); }
.door .cta { margin-top: 10px; }
.credit {
  position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom));
  padding: 0 20px; font-size: 11.5px; line-height: 1.5; color: var(--smoke); opacity: .75;
}
body:not([data-view="door"]) .door { opacity: 0; visibility: hidden; }

/* ---------- cabinet ---------- */
.regions {
  position: fixed; z-index: 10; left: 0; right: 0; top: max(58px, calc(env(safe-area-inset-top) + 44px));
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 6px; padding: 0 16px;
}
.regions button { font-size: 14px; padding: 5px 12px; border-radius: 4px; color: var(--text); background: var(--glass); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .3); }
.regions button:hover { color: var(--paper); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .7); }
.regions button[aria-pressed="true"] { color: #1D140C; font-weight: 600; background: var(--brass); box-shadow: none; }
.nav {
  position: fixed; z-index: 10; top: 42%; width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--glass); color: var(--paper); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .5), 0 4px 14px rgba(0, 0, 0, .35);
}
.nav:hover:not(:disabled) { background: rgba(60, 46, 24, .9); }
.nav:disabled { opacity: .25; cursor: default; }
/* up and down sit above and below the pulled-out bottle */
.nav.up { top: max(112px, calc(env(safe-area-inset-top) + 98px)); left: calc(50% - 23px); }
.nav.down { position: absolute; top: 8px; left: calc(50% - 23px); }
.nav svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prev { left: 16px; }
.next { right: 16px; }
.info {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; align-items: center; gap: 28px;
  padding: 64px 24px max(26px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(8, 19, 16, .82) 38%, rgba(8, 19, 16, .95));
}
.w-text { max-width: 40em; text-align: center; }
.w-text .w-meta, .w-text .actions { justify-content: center; }

/* studio shot of the bottle model; dark until it has rendered */
.ph {
  position: relative; display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 3px;
  background: linear-gradient(#2f4d40, #0b1612); box-shadow: 0 8px 24px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(201, 161, 91, .25);
}
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph img:not([src]) { visibility: hidden; }
.w-name { font-weight: 300; font-size: clamp(28px, 4vw, 42px); line-height: 1.15; letter-spacing: -.02em; }
.w-ko { color: var(--smoke); font-size: 15px; margin-top: 4px; }
.w-meta { display: flex; gap: 28px; margin-top: 12px; }
.w-meta dt { font-size: 12px; color: var(--smoke); }
.w-meta dd { font-size: 15px; }
.w-note { margin-top: 10px; font-size: 16px; opacity: .88; }
.actions { margin-top: 16px; display: flex; gap: 8px; }

/* ---------- 메뉴판 ---------- */
.menu {
  margin: auto; width: min(1080px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 28px; border: 0; border-radius: 8px;
  background: rgba(10, 22, 18, .97); color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .35), 0 30px 80px rgba(0, 0, 0, .6);
}
.menu::backdrop { background: rgba(4, 10, 8, .6); backdrop-filter: blur(4px); }
.menu header { position: relative; padding-right: 48px; margin-bottom: 22px; }
.menu h2 { font-weight: 300; font-size: 30px; letter-spacing: -.02em; }
.menu header p { color: var(--smoke); font-size: 15px; }
.close { position: absolute; top: -6px; right: -6px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.close:hover { background: rgba(201, 161, 91, .16); }
.close svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.menu-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; }
.menu-card { display: grid; gap: 3px; width: 100%; text-align: left; }
.menu-card .ph { margin-bottom: 8px; transition: box-shadow .2s; }
.menu-card:hover .ph { box-shadow: 0 8px 24px rgba(0, 0, 0, .5), inset 0 0 0 2px var(--brass); }
.menu-card strong { font-weight: 600; font-size: 15px; line-height: 1.3; }
.menu-ko, .menu-meta { font-size: 13px; color: var(--smoke); }

#back { display: none; }
body.seated #back { display: inline-block; }

.pour-cap {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: max(36px, env(safe-area-inset-bottom));
  text-align: center; color: var(--paper); opacity: .8; font-size: 15px; text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

/* ---------- popups: the tip jar (a thank-you first, the payment page only from its button) and the invite ---------- */
.popup {
  margin: auto; width: min(380px, calc(100vw - 32px)); padding: 32px 26px 26px; border: 0; border-radius: 10px;
  text-align: center; background: rgba(10, 22, 18, .97); color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .45), 0 30px 80px rgba(0, 0, 0, .6);
}
.popup[open] { animation: tipin .28s ease-out; }
@keyframes tipin { from { opacity: 0; translate: 0 8px; } }
.popup::backdrop { background: rgba(4, 10, 8, .6); backdrop-filter: blur(4px); }
.tipbox img { display: block; width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(201, 161, 91, .5), 0 10px 30px rgba(0, 0, 0, .5); }
.popup h2 { font-weight: 300; font-size: 26px; line-height: 1.25; letter-spacing: -.02em; }
.popup p { margin-top: 12px; font-size: 15px; line-height: 1.75; color: var(--text); text-wrap: balance; }
:lang(ko) .popup p { word-break: keep-all; } /* Korean wraps between words; Japanese has no spaces to wrap at */
.tipbox .tipnote { margin-top: 8px; font-size: 13px; color: var(--brass); }
.tipbox .cta { display: inline-block; margin-top: 22px; text-decoration: none; }
.popup .close { top: 8px; right: 8px; }
.share-link { display: flex; margin-top: 22px; border-radius: 6px; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .45); text-align: left; }
#share-url { flex: 1; min-width: 0; padding: 11px 14px; font-size: 13px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; user-select: all; }
#share-copy { flex: none; padding: 0 18px; border-radius: 0 6px 6px 0; background: var(--brass); color: #1D140C; font-size: 14px; font-weight: 600; transition: background .2s; }
#share-copy:hover { background: #DDB670; }
.share-apps { display: flex; justify-content: center; gap: 20px; margin-top: 24px; }
.share-apps > * { display: grid; justify-items: center; gap: 8px; font-size: 13px; color: var(--text); text-decoration: none; }
.share-apps svg { width: 52px; height: 52px; padding: 15px; border-radius: 50%; fill: var(--paper); background: rgba(201, 161, 91, .08); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .45); transition: background .2s, box-shadow .2s; }
.share-apps > :hover svg { background: rgba(201, 161, 91, .2); box-shadow: inset 0 0 0 1px var(--brass); }

/* bar list: one row per bar, a dot per stool */
.barsbox { width: min(600px, calc(100vw - 32px)); }
.bar-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; margin-top: 18px; max-height: min(56vh, 480px); overflow-y: auto; text-align: left; }
.bar-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-align: left; border-radius: 6px; background: rgba(201, 161, 91, .06); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .2); transition: background .2s, box-shadow .2s; }
.bar-list button:hover:not(:disabled) { background: rgba(201, 161, 91, .16); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .6); }
.bar-list button:disabled { cursor: default; opacity: .5; }
.bar-list button[aria-current] { opacity: 1; box-shadow: inset 0 0 0 1px var(--brass); }
.bar-name { flex: 1; font-size: 15px; }
.stools { display: flex; gap: 4px; }
.stools i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .5); }
.stools i.on { background: var(--amber); box-shadow: none; }
.bar-note { min-width: 4.5em; text-align: right; font-size: 12px; color: var(--brass); }
.bar-fail { font-size: 14px; color: var(--text); text-align: center; }

/* ---------- bar: name tags and speech bubbles float over the 3D people ---------- */
.tag {
  white-space: nowrap; font-size: 12.5px; line-height: 1; padding: 6px 10px; border-radius: 12px;
  background: rgba(8, 19, 16, .72); color: var(--paper);
}
.tag.is-me { background: var(--brass); color: #1D140C; font-weight: 600; }
/* three.js positions these with `transform`, so the animation moves them with `translate` */
.bubble {
  white-space: nowrap; font-size: 15px; line-height: 1; padding: 9px 13px; border-radius: 14px 14px 14px 3px;
  background: var(--paper); color: #1D140C; opacity: 0;
}
.bubble.show { animation: bubble 1.6s ease-out; }
@keyframes bubble {
  0% { opacity: 0; translate: 0 6px; }
  12%, 80% { opacity: 1; translate: 0 0; }
  100% { opacity: 0; translate: 0 -6px; }
}

.hint {
  position: fixed; z-index: 10; left: 50%; top: max(64px, calc(env(safe-area-inset-top) + 50px)); transform: translateX(-50%);
  padding: 5px 12px; border-radius: 14px; white-space: nowrap; font-size: 13px; color: var(--text); background: var(--glass); backdrop-filter: blur(8px);
  animation: hint 6s ease-out forwards;
}
@keyframes hint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.dock {
  position: fixed; z-index: 10; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 2px; padding: 5px; border-radius: 10px;
  background: rgba(8, 19, 16, .88); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .55), 0 10px 30px rgba(0, 0, 0, .5);
}
.dock button { min-height: 44px; padding: 0 16px; border-radius: 6px; font-size: 15px; white-space: nowrap; color: var(--paper); }
.dock button:hover { background: rgba(201, 161, 91, .16); }
.dock [data-e="sip"] { color: #F3C67A; font-weight: 600; }
#change { color: var(--text); }
#fp[aria-pressed="true"] { background: rgba(201, 161, 91, .22); box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .55); }

/* an invitation to clink someone's raised glass, with a bar running down its six seconds */
.toast {
  position: fixed; z-index: 11; left: 50%; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px); overflow: hidden;
  padding: 9px 9px 9px 18px; border-radius: 10px;
  background: rgba(8, 19, 16, .88); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(201, 161, 91, .45), 0 10px 30px rgba(0, 0, 0, .45);
}
.toast p { font-size: 15px; }
.toast b { color: var(--brass); font-weight: 600; }
.toast .cta { padding: 9px 16px; white-space: nowrap; }
.toast:not(.lonely) .alone, .toast.lonely .ask { display: none; }
.toast::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brass); transform-origin: left; }
.toast.run::after { animation: countdown 6s linear forwards; }
@keyframes countdown { to { transform: scaleX(0); } }

.bar-msg {
  position: fixed; z-index: 12; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: rgba(8, 19, 16, .8); text-align: center;
}

@media (max-width: 640px) {
  .dock button { padding: 0 11px; font-size: 14px; }
  .nav { display: grid; width: 38px; height: 38px; }
  .prev, .next { top: 38%; }
  .prev { left: 8px; }
  .next { right: 8px; }
  .nav.up { top: max(132px, calc(env(safe-area-inset-top) + 118px)); left: calc(50% - 19px); }
  .nav.down { top: 6px; left: calc(50% - 19px); }
  .info { padding: 52px 16px max(18px, env(safe-area-inset-bottom)); }
  .w-name { font-size: 24px; }
  .w-meta { gap: 16px; margin-top: 8px; }
  .w-note { font-size: 14px; margin-top: 6px; }
  .actions { margin-top: 12px; }
  .menu { padding: 18px; }
  .menu-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px 12px; }
  .top { gap: 10px; padding-left: 16px; padding-right: 12px; }
  .top > * { white-space: nowrap; }
  body[data-view="bar"] .logo { display: none; }
  .status { font-size: 13px; margin-right: auto; }
  .invite, .menu-btn { padding: 6px 10px; font-size: 13px; }
  .tip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } /* just the glass on phones; still read out */
  .hint { top: max(100px, calc(env(safe-area-inset-top) + 86px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
  .bubble.show { opacity: 1; }
}
