/* Layout idea: a night-time bar scene on top, a small "table chat" panel below, built mobile-first. */
:root {
  --night: #1b1530;
  --night-2: #261d42;
  --wood: #6b4430;
  --lamp: #ffc46b;
  --rose: #ff8fa3;
  --ink: #f4ecdf;
  --ink-dim: #b9aecb;
  --display: "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  color-scheme: dark;
  overflow: hidden;
}
#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }

header.top {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--night-2); border-bottom: 1px solid #ffffff14;
}
.logo { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--ink-dim); letter-spacing: 0; }
.online { margin-left: auto; font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.online i { width: 8px; height: 8px; border-radius: 50%; background: #6be39a; display: inline-block; }

.now {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: #00000033; font-size: 12px; color: var(--ink-dim);
}
.eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq b { width: 3px; background: var(--lamp); animation: eq 1s ease-in-out infinite; }
.eq b:nth-child(2) { animation-delay: .2s; } .eq b:nth-child(3) { animation-delay: .4s; } .eq b:nth-child(4) { animation-delay: .6s; }
@keyframes eq { 0%,100% { height: 3px; } 50% { height: 14px; } }
.now strong { color: var(--ink); font-weight: 600; }
.now span.tag { margin-left: auto; border: 1px solid #ffffff2a; padding: 2px 8px; border-radius: 99px; font-size: 11px; }

#stage { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hint {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  background: #000000a0; padding: 6px 12px; border-radius: 99px; font-size: 12px; color: var(--ink);
  pointer-events: none; white-space: nowrap; transition: opacity .4s;
}

.panel { background: var(--night-2); border-top: 1px solid #ffffff14; padding: 8px 12px 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); margin-bottom: 6px; min-height: 28px; }
.who b { color: var(--ink); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
button {
  font: inherit; color: var(--ink); background: #ffffff14; border: 1px solid #ffffff22;
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
}
button:hover { background: #ffffff24; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--lamp); color: #2a1c0a; border-color: var(--lamp); font-weight: 600; }

#log { height: 72px; overflow-y: auto; font-size: 13px; line-height: 1.45; padding: 6px 8px; background: #00000030; border-radius: 10px; margin-bottom: 8px; }
#log p { margin: 0 0 3px; }
#log .n { color: var(--lamp); font-weight: 600; }
#log .sys { color: var(--rose); }
form { display: flex; gap: 6px; }
input[type=text] {
  flex: 1; font: inherit; color: var(--ink); background: #00000040; border: 1px solid #ffffff22;
  border-radius: 10px; padding: 9px 12px; min-width: 0;
}

#menu {
  position: absolute; left: 12px; right: 12px; bottom: 8px; background: var(--night); border: 1px solid #ffffff2a;
  border-radius: 14px; padding: 10px; display: none; z-index: 5; box-shadow: 0 8px 28px #0008;
}
#menu.open { display: block; }
#menu h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
#menu .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#menu .close { margin-top: 8px; width: 100%; }
@media (prefers-reduced-motion: reduce) { .eq b { animation: none; height: 8px; } }

/* 3D overlay labels */
.tag3 { max-width: 66px; overflow: hidden; text-overflow: ellipsis; position: absolute; left: 0; top: 0; font-size: 10px; font-weight: 500; color: #ffffffd0; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.tag3.me { color: var(--lamp); font-weight: 600; }
.tbl3 { position: absolute; left: 0; top: 0; font-size: 10px; font-weight: 600; color: #ffffff88; text-shadow: 0 1px 3px #000; }
.bub3 { position: absolute; left: 0; top: 0; max-width: 150px; width: max-content; padding: 5px 9px; border-radius: 10px; background: #fff8ec; color: #2a1c14; font-size: 11px; line-height: 1.35; opacity: 0; transition: opacity .25s; }
.bub3.show { opacity: 1; }
.bub3.dim { opacity: .55; }
.bub3.sys { background: #ffd9e0; }

@media (max-width: 480px) { .now span.tag { font-size: 10px; padding: 1px 6px; } .now { padding: 6px 12px; } }

/* walking mode: hide the chat panel so the 3D view gets the space */
.walking .actions, .walking form { display: none; }
.joy { position: absolute; left: 16px; bottom: 16px; width: 116px; height: 116px; border-radius: 50%; background: #ffffff14; border: 1px solid #ffffff30; touch-action: none; user-select: none; -webkit-user-select: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: #ffffff55; border: 1px solid #ffffff80; pointer-events: none; }
.act { position: absolute; right: 16px; bottom: 36px; background: var(--lamp); color: #2a1c0a; border-color: var(--lamp); font-weight: 600; padding: 12px 18px; border-radius: 99px; box-shadow: 0 4px 16px #0006; z-index: 4; }
.act[hidden] { display: none; }
canvas { cursor: grab; }
body:not(.walking) .joy { display: none; }

.who { justify-content: space-between; }
.chip { padding: 4px 10px; font-size: 12px; border-radius: 99px; white-space: nowrap; }
.actions button.small { padding: 6px 10px; font-size: 12px; }
.actions .note { font-size: 12px; color: var(--ink-dim); align-self: center; }
.cnt { align-self: center; font-size: 11px; color: var(--ink-dim); min-width: 22px; text-align: right; }
.tag3.open { color: #bff5d0; }
.tag3.blk { color: #ff9aa2; opacity: .7; }
.bub3.out { opacity: 0; transition: opacity .8s; }
.toast { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); max-width: 86%; background: #000000b8; color: var(--ink); padding: 8px 14px; border-radius: 12px; font-size: 13px; text-align: center; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 6; }
.toast.show { opacity: 1; }
#entry { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 50% 30%, #3a2a66 0%, #14102a 70%); }
#entry.hide { display: none; }
.entry-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.entry-card h2 { margin: 0; font-size: 26px; font-weight: 800; }
.entry-card p { margin: 0 0 6px; color: var(--ink-dim); }
.entry-card small { color: var(--ink-dim); font-size: 12px; }
.opt { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 16px; border-radius: 14px; font-size: 15px; }
.opt span { font-size: 12.5px; font-weight: 400; opacity: .85; line-height: 1.4; }
.opt.primary { color: #2a1c0a; }
.actions { gap: 5px; }
.actions button { padding: 6px 10px; font-size: 12.5px; }
.actions button.primary { font-size: 13px; }

.gender { display: flex; gap: 10px; }
.gen { flex: 1; align-items: center; text-align: center; padding: 12px; }
.gen.sel { border-color: var(--lamp); background: #ffc46b2e; }
.opt:disabled { opacity: .4; cursor: default; }
.entry-card .q2 { margin-top: 6px; }

/* iOS zooms the page when a focused input has text smaller than 16px, which pushes the Send button off screen */
input[type=text] { font-size: 16px; }
html, body { overscroll-behavior: none; }

.privacy { display: none; margin-top: 6px; font-size: 11.5px; color: var(--ink-dim); text-align: center; }

.online { flex-direction: column; align-items: flex-end; gap: 4px; }
.online-row { display: flex; align-items: center; gap: 6px; }
#clock { padding: 3px 10px; font-size: 11.5px; border-radius: 99px; }

#muteBtn { padding: 2px 9px; font-size: 11px; border-radius: 99px; margin-left: 6px; }
#muteBtn[hidden] { display: none; }

/* No text selection / iOS long-press menu anywhere except the chat input */
html, body, body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
button, .chip { touch-action: manipulation; }
