/* 流浪音乐人 — theme tokens：暖色黄昏 / 纸张与木纹 / 青绿+芥黄+陶土红 */
:root {
  --c-ink: #3a2a22;
  --c-paper: #f6e8c9;
  --c-paper-2: #ecd7a8;
  --c-wood: #7a4e2d;
  --c-teal: #2f7f7a;
  --c-mustard: #e2a93b;
  --c-terra: #c4583a;
  --c-night: #1d1a2b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 18px rgba(40, 22, 10, .38);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 140ms;
  --t-mid: 320ms;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #1d1a2b; color: var(--c-ink); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

.title-font { font-family: var(--yoroll-font-title); font-weight: 700; }

/* 木牌/纸条按钮（共享组件，所有页面复用） */
.btn {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; min-width: 96px; padding: 0 20px; box-sizing: border-box;
  font: 600 17px/1 var(--yoroll-font-body); color: var(--c-paper);
  background: linear-gradient(180deg, #8d5c36, var(--c-wood)); border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 0 rgba(255, 230, 180, .35), inset 0 -3px 0 rgba(0, 0, 0, .25), var(--shadow);
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast);
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(2px) scale(.97); filter: brightness(.95); }
.btn.primary { background: linear-gradient(180deg, #e8b44a, #c98a1f); color: var(--c-ink); }
.btn.ghost { background: rgba(246, 232, 201, .9); color: var(--c-ink); }
.btn[disabled] { filter: grayscale(.8) brightness(.8); cursor: not-allowed; }

/* ───────── 玩法 UI ───────── */
[hidden] { display: none !important; }
.hud { position: absolute; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; gap: 8px; align-items: center; pointer-events: none; font-family: var(--yoroll-font-body); }
.hud > * { pointer-events: auto; }
.hud .grow { flex: 1; pointer-events: none; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: var(--radius-sm); background: rgba(246, 232, 201, .92); border: 2px solid var(--c-wood); box-shadow: var(--shadow); color: var(--c-ink); font-size: 15px; white-space: nowrap; }
.chip small { font-size: 12px; opacity: .7; }
.chip b { font-size: 17px; }
.coin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b0, #e2a93b 60%, #a8741a); align-self: center; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.btn.sm { min-height: 40px; min-width: 64px; padding: 0 12px; font-size: 14px; }
.bar { position: absolute; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); display: flex; gap: 8px; align-items: stretch; justify-content: center; flex-wrap: wrap; pointer-events: none; padding: 8px; border-radius: var(--radius); background: rgba(58, 42, 34, .78); box-shadow: var(--shadow); }
.bar > * { pointer-events: auto; }
.bar .sel { flex-direction: column; gap: 3px; min-height: 52px; min-width: 104px; align-items: flex-start; text-align: left; }
.bar .sel small { font-size: 11px; opacity: .75; font-weight: 500; }
.bar .sel b { font-size: 16px; }
.bar .go { min-width: 128px; min-height: 52px; font-size: 19px; }
.np { flex: 1; min-width: 180px; display: flex; flex-direction: column; justify-content: center; gap: 6px; color: var(--c-paper); }
.np-t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.np-t b { font-size: 18px; } .np-t small { font-size: 13px; }
.prog-bar { height: 8px; border-radius: 6px; background: rgba(246, 232, 201, .25); overflow: hidden; }
.prog-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c-mustard), var(--c-terra)); }
#toasts { position: absolute; top: calc(64px + var(--safe-t)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { max-width: min(92vw, 520px); padding: 9px 16px; border-radius: var(--radius-sm); background: var(--c-paper); border: 2px solid var(--c-wood); box-shadow: var(--shadow); color: var(--c-ink); font: 600 14px/1.4 var(--yoroll-font-body); animation: tin .3s var(--ease); transition: opacity .5s; }
.grp-h { margin: 12px 0 4px; padding: 3px 8px; font: 700 13px/1.4 var(--yoroll-font-body); color: var(--c-paper); background: var(--c-wood); border-radius: 6px; letter-spacing: .04em; }
.lang-chips, .lang-list { flex-wrap: wrap; }
.toast.warn { border-color: #b5503c; background: #f6dccf; }
.hud .btn.env { white-space: nowrap; background: rgba(246, 232, 201, .92); color: var(--c-ink); border: 2px solid var(--c-wood); }
.toast.good { border-color: var(--c-teal); } .toast.out { opacity: 0; }
@keyframes tin { from { transform: translateY(-10px); opacity: 0; } }
#floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -50%); font: 700 22px var(--yoroll-font-body); color: #fff4c8; text-shadow: 0 2px 0 #7a4e2d, 0 0 8px rgba(0,0,0,.5); animation: fup 1.4s ease-out forwards; }
.float.big { font-size: 32px; color: #ffd45a; } .float.note { color: #f6e8c9; } .float.heart { font-size: 28px; }
@keyframes fup { to { transform: translate(-50%, -150%); opacity: 0; } }
.cat { position: absolute; transform: translate(-50%, -50%); font-size: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.mask { position: absolute; inset: 0; background: rgba(29, 26, 43, .55); display: flex; align-items: center; justify-content: center; padding: 12px; box-sizing: border-box; pointer-events: auto; }
.modal { width: min(560px, 100%); max-height: min(86vh, 100%); display: flex; flex-direction: column; font-family: var(--yoroll-font-body); }
.m-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px 18px; border-bottom: 2px dashed var(--c-wood); flex: none; }
.m-title { font-size: 24px; color: var(--c-wood); }
.btn.x { min-width: 44px; min-height: 44px; padding: 0; }
.m-body { overflow-y: auto; padding: 12px 16px 16px; flex: 1 1 auto; }
.note { font-size: 13px; opacity: .8; margin: 0 0 10px; line-height: 1.5; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(122, 78, 45, .25); }
.row.locked .r-main b { opacity: .7; }
.r-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; } .r-main b { font-size: 16px; } .r-main small { font-size: 12.5px; opacity: .78; line-height: 1.4; }
.r-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tag { padding: 5px 10px; border-radius: 999px; background: var(--c-teal); color: var(--c-paper); font-size: 12px; white-space: nowrap; } .tag.dim { background: rgba(58,42,34,.3); }
.ok { color: var(--c-teal); font-weight: 700; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { border-radius: 8px; padding: 10px; min-height: 90px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; color: #fff7de; border: 4px solid #fff7e6; box-shadow: 0 3px 8px rgba(0,0,0,.3); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.photo small { font-size: 12px; } .photo.empty { background: rgba(58,42,34,.25); color: var(--c-ink); text-shadow: none; align-items: center; justify-content: center; }
.sum-big { font: 700 40px var(--yoroll-font-title); color: var(--c-terra); text-align: center; margin: 4px 0 8px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.sum-lines p { margin: 6px 0; font-size: 14.5px; line-height: 1.55; } .gain { color: var(--c-teal); font-weight: 700; }
.m-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.finale h3 { margin: 0 0 10px; font-size: 26px; color: var(--c-terra); } .finale p { line-height: 1.65; }
.veil { position: absolute; inset: 0; background: #1d1a2b; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--c-paper); opacity: 0; transition: opacity .45s; pointer-events: auto; padding: 20px; }
.veil.show { opacity: 1; } .veil-txt { font-size: 22px; } .veil-txt .title-font { font-size: 40px; margin-bottom: 10px; } .veil-txt small { font: 500 15px var(--yoroll-font-body); opacity: .9; display: block; max-width: 420px; line-height: 1.6; }
@media (max-height: 460px) {
  .chip { padding: 4px 10px; } .chip small { display: none; }
  .bar { padding: 5px; gap: 6px; flex-wrap: nowrap; } .bar .sel { min-width: 84px; min-height: 46px; } .bar .go { min-width: 108px; min-height: 46px; font-size: 17px; }
  #toasts { top: calc(50px + var(--safe-t)); } .modal { max-height: 94vh; } .m-title { font-size: 20px; }
}
@media (max-width: 560px) and (orientation: portrait) { .chip.prog small { display: none; } .bar .sel { min-width: 46%; flex: 1; } .bar .go { flex: 1 1 100%; } }

/* ───────── 登录 / 访客 / 选语言 ───────── */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); box-sizing: border-box; background: rgba(29, 26, 43, .5); font-family: var(--yoroll-font-body); overflow-y: auto; }
.login-card { width: min(440px, 100%); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; margin: auto; }
.login-card h2 { margin: 0; font-size: 30px; color: var(--c-wood); text-align: center; }
.login-card .note { text-align: center; margin: 0; }
.login-card .tabs { justify-content: center; margin: 4px 0 2px; }
.login-card .tabs .btn { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--c-wood); font-weight: 600; }
.field input { height: 46px; box-sizing: border-box; border-radius: var(--radius-sm); border: 2px solid var(--c-wood); background: #fffaf0; padding: 0 12px; font: 500 16px var(--yoroll-font-body); color: var(--c-ink); -webkit-user-select: text; user-select: text; outline: none; }
.field input:focus { border-color: var(--c-teal); box-shadow: 0 0 0 3px rgba(47, 127, 122, .25); }
.err { min-height: 18px; color: var(--c-terra); font-size: 13px; font-weight: 600; text-align: center; }
.btn.big { min-height: 52px; font-size: 18px; width: 100%; }
.note.small { font-size: 12px; opacity: .65; }
.guest-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0 2px; text-align: center; }
.guest-card p { margin: 0; font-size: 14px; line-height: 1.6; } .guest-ico { font-size: 44px; }
.lang-chips { position: absolute; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); display: flex; gap: 6px; }
.pick-h { margin: 6px 0 0; font-size: 15px; color: var(--c-wood); text-align: center; }
.lang-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.rec-sum { display: flex; gap: 8px; margin-bottom: 10px; }
.rec-sum > div { flex: 1; text-align: center; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--c-paper-2); border: 2px solid rgba(122, 78, 45, .35); display: flex; flex-direction: column; gap: 2px; }
.rec-sum small { font-size: 12px; opacity: .75; } .rec-sum b { font: 700 22px var(--yoroll-font-title); color: var(--c-terra); }
.rec-inc { display: inline-flex; align-items: center; gap: 6px; color: var(--c-terra); white-space: nowrap; }
small.dim { opacity: .55; }
.veil-txt .spot-n { margin-top: 6px; font-style: normal; opacity: .75; }
.hud { flex-wrap: wrap; row-gap: 6px; }
@media (max-width: 700px) { .chip.user { display: none; } .hud .btn.sm { min-width: 52px; padding: 0 9px; } #toasts { top: calc(104px + var(--safe-t)); } }
@media (max-width: 560px) { .lang-chips { left: 10px; justify-content: center; } .login-card { padding: 18px 16px; } .login-card h2 { font-size: 25px; } .chip.place small { display: none; } }

.panel {
  background: var(--c-paper); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 3px solid var(--c-wood); box-sizing: border-box; color: var(--c-ink);
}
