/* Layout: a floating rooftop diorama fills the screen; one dark control panel docks right (bottom on phones). The sky is the page, so there is one look. */
:root {
  color-scheme: light;
  --ink: #fff8f6;
  --ink-2: #ffecef;
  --line: #f6c3d2;
  --text: #55323f;
  --muted: #8d6474;
  --accent: #dc4474;
  --accent-ink: #ffffff;
  --focus: #c0700a;
  --calm: #2aa876;
  --rest: #3d8fd1;
  --away: #a3949a;
  --play: #7a5bd6;
  --danger: #c9304f;
  --say: #ffffff;
  --say-ink: #55323f;
  --shadow: 0 4px 0 rgba(220, 68, 116, .16), 0 10px 24px rgba(120, 60, 90, .14);
  --display: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--text); font: 14px/1.5 var(--body); overflow: hidden; }
button, input { font-family: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

#stage { position: fixed; inset: 0; overflow: hidden; }
#stage canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; }
#stage canvas.pick { cursor: pointer; }
#stage canvas.drag { cursor: grabbing; }
#tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--text);
  font-size: 12px; line-height: 18px; white-space: nowrap; will-change: transform;
}
.tag.me { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.say {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  width: max-content; max-width: 180px; padding: 5px 10px; border-radius: 10px;
  background: var(--say); color: var(--say-ink); font-size: 13px; font-weight: 400; line-height: 1.4;
  white-space: normal; overflow-wrap: anywhere;
}

#ui {
  position: fixed; inset: 0; pointer-events: none; display: flex; justify-content: space-between; gap: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px));
}
#head { display: flex; flex-direction: column; align-self: flex-start; min-width: 0; color: #4a2a38; text-shadow: 0 1px 0 rgba(255,255,255,.5); transition: color .8s; }
#head.dark { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
#head h1 { margin: 0; font: 400 34px/1.1 var(--display); letter-spacing: .04em; }
#head p { margin: 4px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }
#link {
  pointer-events: auto; margin-top: 8px; padding: 4px 10px; width: fit-content; max-width: 100%;
  border-radius: 4px; background: var(--ink); color: var(--focus); font-size: 12px; text-shadow: none;
}

#panel {
  position: relative; pointer-events: auto; align-self: flex-start; width: 320px; max-height: 100%; flex: none;
  display: flex; flex-direction: column; background: var(--ink); border-radius: 6px 18px 6px 18px; overflow: hidden;
}
#panel h2, #chatDock h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .08em; color: var(--muted); }
#sheet { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
#members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
#members li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; min-width: 0; }
.face { width: 26px; height: 26px; border-radius: 50%; }
.who { min-width: 0; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.who small { display: block; color: var(--muted); font-size: 11px; }
.state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg button {
  font-size: 13px; font-weight: 500; line-height: 1; color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 9px 2px; cursor: pointer; min-width: 0;
}
.seg button:hover { border-color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

.tab { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tab > h2:not(:first-child), .tab > .rowhead:not(:first-child) { margin-top: 8px; }
.rowhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.hint:empty { display: none; }
#chatDock {
  position: fixed; pointer-events: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px;
  left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: 340px; height: 250px; max-width: calc(100vw - 32px);
  background: var(--ink); border-radius: 18px 6px 18px 6px;
}
#chatBox { flex: 1; min-height: 0; position: relative; display: flex; background: var(--ink-2); border-radius: 4px; }
#chatLog { flex: 1; list-style: none; margin: 0; padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#chatLog li { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
#chatLog b { font-weight: 700; margin-right: 6px; color: var(--focus); }
#chatLog time { margin-left: 6px; font-size: 10px; color: var(--muted); }
#chatLog .del { margin-left: 6px; padding: 0 4px; border: 0; background: none; color: var(--danger); font-size: 11px; cursor: pointer; }
#chatEmpty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 8px; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }
#chatForm { display: flex; gap: 4px; flex: none; }
#chatInput {
  flex: 1; min-width: 0; padding: 8px 10px; font-size: 14px; color: var(--text);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 0 0 0 4px;
}
#chatSend {
  flex: none; padding: 0 14px; border: 0; border-radius: 0 0 4px 0; font-size: 13px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
#logout {
  align-self: flex-start; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--muted);
  font-size: 12px; text-decoration: underline; cursor: pointer;
}
#player { flex: none; display: flex; flex-direction: column; gap: 7px; padding: 12px 14px 10px; min-width: 0; }
#npHead { display: flex; align-items: center; gap: 8px; min-width: 0; }
#npText { flex: 1; min-width: 0; }
#npTitle { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#npSub { font-size: 11px; color: var(--muted); }
#npTrack { height: 4px; border-radius: 2px; background: var(--ink-2); overflow: hidden; }
#npBar { height: 100%; width: 0; background: var(--accent); }
#npRow { display: flex; align-items: center; gap: 8px; min-width: 0; }
#npTime { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
#npTime:empty { display: none; }
#vol { flex: 1; min-width: 40px; height: 16px; margin: 0; accent-color: var(--accent); }
.mini {
  flex: none; padding: 4px 8px; font-size: 12px; line-height: 1.2; color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.mini:disabled { opacity: .45; cursor: default; }
.mini.strong { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.mini.quiet { background: none; border-color: transparent; color: var(--muted); padding-inline: 4px; }
.mini.quiet:hover { color: var(--text); }
#unlock { padding: 8px; border: 0; border-radius: 4px; background: var(--focus); color: var(--accent-ink); font-size: 13px; font-weight: 700; cursor: pointer; }
#tabs { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
#tabs button {
  padding: 9px 2px; border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; min-width: 0;
}
#tabs button:hover { color: var(--text); }
#tabs button[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); font-weight: 700; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(12px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.songs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.songs:empty { display: none; }
.songs li { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 0; border-bottom: 1px solid var(--ink-2); }
.songs li:last-child { border-bottom: 0; }
.songs li.playing b { color: var(--accent); }
.songname { flex: 1; min-width: 0; }
.songname b { display: block; font-size: 13px; font-weight: 500; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.songname small { display: block; font-size: 11px; line-height: 1.3; color: var(--muted); }
.upload {
  position: relative; flex: none; padding: 5px 10px; border-radius: 4px; overflow: hidden;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; cursor: pointer;
}
.upload.busy { opacity: .6; pointer-events: none; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
#songSearch {
  padding: 7px 9px; font-size: 13px; color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; min-width: 0;
}
#roomList { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex: none; }
#roomList button {
  display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 8px 9px; font-size: 13px;
  color: var(--text); background: var(--ink-2); border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
}
#roomList button.here { border-color: var(--accent); }
#roomList small { color: var(--muted); font-size: 11px; }
.roomtag {
  position: absolute; left: 0; top: 0; padding: 1px 8px; border-radius: 3px; font-size: 11px; line-height: 16px;
  white-space: nowrap; background: rgba(18, 41, 47, .55); color: var(--text); letter-spacing: .08em; will-change: transform;
}

#auth { position: fixed; inset: 0; display: grid; place-items: center; overflow-y: auto; padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#authForm {
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; padding: 22px;
  background: var(--ink); border-radius: 6px 18px 6px 18px;
}
#authForm h2 { margin: 0; font: 400 28px/1.15 var(--display); letter-spacing: .04em; text-wrap: balance; }
#authForm .lead { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
#authForm .seg { grid-template-columns: 1fr 1fr; }
#authForm label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
#authForm input {
  padding: 9px 10px; font-size: 15px; color: var(--text); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; width: 100%;
}
#authHint { margin: 0; font-size: 12px; color: var(--muted); }
#authError { margin: 0; min-height: 18px; font-size: 13px; color: var(--danger); }
#authSubmit {
  padding: 11px; border: 0; border-radius: 4px; font-size: 15px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
#authSubmit:disabled { opacity: .6; cursor: wait; }

#toast {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px);
  background: var(--ink); color: var(--text); padding: 7px 14px; border-radius: 999px; font-size: 13px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#err { position: fixed; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; line-height: 1.7; }

/* ---------- round, soft and friendly ---------- */
#panel, #chatDock, #authForm, #modalCard, #eventsBox {
  border: 2px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
}
.tag {
  flex-direction: column; align-items: center; gap: 0; padding: 3px 11px 4px; border-radius: 14px;
  background: var(--say); color: var(--text); border: 2px solid var(--line); box-shadow: 0 2px 0 rgba(220, 68, 116, .18);
  font-size: 13px;
}
.tag::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 8px; height: 8px; margin-left: -4px;
  background: var(--say); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg);
}
.tag.me { background: #ffe3ec; color: var(--text); font-weight: 400; border-color: var(--accent); }
.tag.me::after { background: #ffe3ec; border-color: var(--accent); }
.tagline { display: flex; align-items: center; gap: 5px; }
.tagsign { max-width: 170px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; line-height: 15px; color: var(--muted); }
.say { bottom: calc(100% + 8px); border: 2px solid var(--line); border-radius: 14px; }
.pop { position: absolute; left: 50%; bottom: 100%; font-size: 26px; pointer-events: none; animation: pop 1.6s ease-out forwards; }
@keyframes pop {
  0% { transform: translate(-50%, 8px) scale(.5); opacity: 0; }
  20% { transform: translate(-50%, -6px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -46px) scale(1); opacity: 0; }
}
.roomtag { padding: 2px 10px; border-radius: 999px; background: rgba(255, 248, 246, .88); color: var(--text); font-size: 12px; }
.teamtag {
  position: absolute; left: 0; top: 0; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: #2b3050; color: #fff; will-change: transform;
}
.teamtag.full { background: var(--play); }
.boardtag {
  position: absolute; left: 0; top: 0; max-width: 280px; padding: 5px 12px; border-radius: 12px; font-size: 14px;
  background: #2f5b4b; color: #fff; border: 2px solid #f2efe6; will-change: transform;
}
.seg button { border-width: 2px; border-radius: 999px; background: var(--ink-2); border-color: var(--line); box-shadow: 0 2px 0 var(--line); font-weight: 400; }
.seg button[aria-pressed="true"] { font-weight: 400; box-shadow: 0 2px 0 #a92c55; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.mini { border-radius: 999px; border-width: 2px; border-color: var(--line); }
.mini.strong { font-weight: 400; }
#tabs { grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px 8px; }
#tabs button { border-radius: 999px; }
#tabs button[aria-expanded="true"] { font-weight: 400; }
#chatLog b { font-weight: 400; }
#npTitle { font-weight: 400; font-size: 15px; }
#chatInput, #songSearch, #signInput, #teachInput, #authForm input { border: 2px solid var(--line); border-radius: 999px; padding-inline: 12px; }
#chatBox { border-radius: 14px; }
#chatSend, #authSubmit, .upload, #unlock { border-radius: 999px; font-weight: 400; }
#chatForm { gap: 6px; }
#authForm h2 { color: var(--accent); }
#head h1 { color: inherit; }
.face { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--line); }
#members { gap: 10px; }
#members li { grid-template-columns: 26px 1fr auto; row-gap: 3px; }
.friendrow { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; }
.friendrow small { flex: none; color: var(--muted); font-size: 11px; }
.signline { color: var(--accent) !important; }
/* 成就 */
.achhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.achhead b { flex: none; font-size: 15px; }
.achgroup { margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.achgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.achcard { display: flex; gap: 7px; padding: 7px; border: 2px solid var(--line); border-radius: 12px; background: var(--ink-2); opacity: .55; }
.achcard.won { opacity: 1; border-color: var(--accent); }
.achcard.secret .achtext b { letter-spacing: 2px; }
.achemoji { font-size: 22px; line-height: 1.1; flex: none; filter: grayscale(1); }
.achcard.won .achemoji { filter: none; }
.achtext { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.achtext b { font-size: 13px; }
.achtext small { font-size: 10px; color: var(--muted); line-height: 1.3; }
.achbar { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.achfoot { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; }
.achrare.gold { color: var(--accent); font-weight: 700; }
@media (max-width: 760px) { .achgrid { grid-template-columns: 1fr; } }
/* 绑定关系 rows: who, what they are to you, and the buttons */
.bondrow { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.bondrow:last-child { border-bottom: 0; }
.bondwho { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.bondwho b { font-weight: 700; }
.bondwho small { color: var(--muted); font-size: 11px; }
#bondBox .hint { margin: 8px 0 2px; font-size: 11px; }
#bondBox .hint:first-child { margin-top: 0; }
.bar, #hungerBar { flex: 1; height: 8px; border-radius: 999px; background: var(--ink-2); overflow: hidden; border: 1px solid var(--line); }
.bar div { height: 100%; background: var(--accent); }
#hud { pointer-events: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
#wallet { display: flex; align-items: center; gap: 12px; padding: 5px 12px; background: var(--ink); color: var(--text); border: 2px solid var(--line); border-radius: 999px; text-shadow: none; }
#wallet b { font-weight: 400; font-variant-numeric: tabular-nums; }
.hunger { display: inline-flex; align-items: center; gap: 5px; }
#hungerBar { display: inline-block; flex: none; width: 70px; }
#hungerFill { display: block; height: 100%; width: 0; background: var(--calm); transition: width .3s; }
#hungerFill.low { background: var(--danger); }
#findMe { padding: 6px 12px; font-size: 13px; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; text-shadow: none; }
#findMe:hover { border-color: var(--accent); }
#adminBtn { padding: 6px 12px; font-size: 13px; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; text-shadow: none; }
#adminBtn:hover { border-color: var(--accent); }
.admintag { display: inline-block; margin: 0 4px; padding: 0 6px; font-size: .82em; line-height: 1.5; font-weight: 400; color: #5a3b00; background: #ffd465; border-radius: 999px; white-space: nowrap; vertical-align: 1px; text-shadow: none; }
.adminlist { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.adminuser { border: 2px solid var(--line); border-radius: 12px; }
.adminuser.open { border-color: var(--accent); }
.adminhead { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: 100%; padding: 8px 10px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.adminhead b { flex: 1 1 110px; min-width: 0; overflow-wrap: anywhere; font-weight: 400; }
.adminhead small { color: var(--muted); font-variant-numeric: tabular-nums; }
.adminbody { display: flex; flex-direction: column; gap: 10px; padding: 0 10px 10px; }
.adminrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adminrow > span:first-child { flex: 0 0 100%; font-size: 12px; color: var(--muted); }
.adminrow input[type=number] { width: 96px; min-height: 32px; padding: 4px 8px; font: inherit; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 10px; }
.adminrow .mini { min-height: 32px; }
#eventsBox { pointer-events: auto; width: 340px; max-width: 100%; margin-top: 8px; background: var(--ink); color: var(--text); text-shadow: none; overflow: hidden; }
#eventToggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px; border: 0; background: none; color: var(--text); font-size: 13px; cursor: pointer; text-align: left; }
.evtitle { flex: none; }
#eventLatest { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.evarrow { flex: none; margin-left: auto; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--muted); transition: transform .15s; }
#eventToggle[aria-expanded="true"] .evarrow { transform: rotate(180deg); }
#eventList { list-style: none; margin: 0; padding: 2px 12px 8px; max-height: 170px; overflow-y: auto; display: flex; flex-direction: column; }
#eventList li { display: flex; gap: 8px; padding: 4px 0; font-size: 12px; line-height: 1.4; border-top: 1px dashed var(--line); overflow-wrap: anywhere; min-width: 0; }
#eventList time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#emoteRow { display: flex; gap: 2px; }
#emoteRow button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 15px; line-height: 1; cursor: pointer; }
#emoteRow button:hover { background: var(--ink-2); transform: scale(1.15); }
#signForm { display: flex; gap: 6px; }
#signInput { flex: 1; min-width: 0; padding-block: 6px; font-size: 13px; color: var(--text); background: var(--ink-2); }
.swatchrow { display: flex; align-items: center; gap: 8px; }
.swatchrow small { flex: none; width: 28px; color: var(--muted); font-size: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.swatches button { width: 22px; height: 22px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
#teachBar {
  position: fixed; left: 50%; top: max(60px, env(safe-area-inset-top, 0px)); transform: translateX(-50%); width: min(420px, calc(100vw - 32px));
  padding: 8px 10px; background: var(--ink); border: 2px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
#teachForm { display: flex; gap: 6px; }
#teachInput { flex: 1; min-width: 0; padding-block: 5px; font-size: 13px; color: var(--text); background: var(--ink-2); }
#modal { position: fixed; inset: 0; display: grid; place-items: center; padding-block: 16px; background: rgba(85, 50, 63, .25); overflow-y: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#modalCard { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--ink); color: var(--text); }
#modalTitle { margin: 0; font-size: 18px; font-weight: 400; color: var(--text); }
#modalBody { display: flex; flex-direction: column; gap: 10px; }
.shopgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* 象棋 */
.xqboard { display: block; width: 100%; max-width: 420px; margin: 0 auto; background: #eccb8d; border: 2px solid #b98a4a; border-radius: 12px; touch-action: manipulation; user-select: none; }
.xqboard text { font-family: inherit; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.xqpiece, .xqdot { cursor: pointer; }
/* 麻将 */
.mjt { display: block; width: 100%; min-width: 0; aspect-ratio: 5 / 7; padding: 0; background-color: #fbf8ec; background-size: 100% 100%; background-repeat: no-repeat; border: 1px solid #d3c8a8; border-bottom: 4px solid #5f9a7d; border-radius: 5px; box-shadow: 1px 2px 3px rgba(70, 50, 30, .22); }
button.mjt { cursor: pointer; }
button.mjt:disabled { cursor: default; }
.mjt.lift { transform: translateY(-7px); border-color: var(--accent); }
.mjt.last { outline: 2px solid var(--accent); outline-offset: 0; }
.mjt.back { background: #4f9a6b; border-color: #35704b; }
button.mjt:disabled { filter: saturate(.75) brightness(.95); }
.mjt.small { display: inline-block; width: 22px; border-bottom-width: 2px; border-radius: 3px; box-shadow: none; }
.mjhand { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; padding-top: 8px; }
.mjhand .drawn { grid-column: 14; }
.mjmelds { display: flex; flex-wrap: wrap; gap: 6px; }
.mjmeld { display: flex; gap: 1px; }
.mjopps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mjseat { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 6px; font-size: 12px; background: var(--say); border: 2px solid var(--line); border-radius: 12px; }
.mjseat.turn { border-color: var(--accent); }
.mjseat b { font-weight: 400; overflow-wrap: anywhere; }
.mjseat small { color: var(--muted); }
.mjpools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.mjpool { min-width: 0; min-height: 44px; padding: 4px 6px; background: #eaf3ec; border-radius: 10px; }
.mjpool small { display: block; font-size: 11px; color: var(--muted); }
.mjpool div { display: flex; flex-wrap: wrap; gap: 1px; }
.mjresult { padding: 8px 10px; font-size: 13px; text-align: center; background: #fff3d6; border-radius: 12px; }
.mjresult b { display: block; margin-bottom: 2px; font-size: 15px; font-weight: 400; }
.tryonbox { position: sticky; top: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; background: linear-gradient(#ffeef3, #fff7ee); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.tryoncanvas { display: block; width: 100%; height: 200px; cursor: grab; touch-action: none; }
.tryoncanvas:active { cursor: grabbing; }
.tryonnote { padding: 0 8px 6px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-height: 700px) { .tryoncanvas { height: 150px; } }
.shopcard { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 10px 4px; text-align: center; background: var(--say); border: 2px solid var(--line); border-radius: 16px; }
.shopemoji { font-size: 30px; line-height: 1.2; }
.shopcard small { font-size: 11px; color: var(--muted); }
.shopcard .mini { margin-top: 4px; }
.picklist { display: flex; flex-direction: column; gap: 6px; }
.picklist button { padding: 9px 12px; text-align: left; font-size: 14px; color: var(--text); background: var(--ink-2); border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.picklist button:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .pop { animation-duration: .01s; } }
.statline { color: var(--play) !important; }
#myStats { display: flex; flex-direction: column; gap: 8px; }
.stattitle { margin: 0; font-size: 15px; color: var(--accent); }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.statgrid div { display: flex; flex-direction: column; align-items: center; padding: 7px 4px; background: var(--ink-2); border-radius: 14px; min-width: 0; }
.statgrid b { font-size: 17px; font-weight: 400; font-variant-numeric: tabular-nums; }
.statgrid small { font-size: 11px; color: var(--muted); }
.statedit { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: end; }
.statedit label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); min-width: 0; }
.statedit label.wide { grid-column: 1 / -1; }
.statedit input { width: 100%; padding: 5px 8px; font-size: 13px; color: var(--text); background: var(--ink-2); border: 2px solid var(--line); border-radius: 10px; }
.statedit button { grid-column: 1 / -1; padding: 6px; }
.bigbtn { padding: 10px; font-size: 15px; color: var(--text); background: var(--ink-2); border: 2px solid var(--line); border-radius: 999px; box-shadow: 0 2px 0 var(--line); cursor: pointer; }
.bigbtn:hover { border-color: var(--accent); }
.leader { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.leader li { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-bottom: 1px dashed var(--line); min-width: 0; }
.leader span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader small { flex: none; font-size: 11px; color: var(--muted); }
.leader b { flex: none; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--accent); }
.friendrow .mini { padding: 3px 7px; }
#pcBar { position: fixed; left: 50%; bottom: max(280px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); pointer-events: auto; }
#pcBar .mini { padding: 9px 16px; font-size: 14px; box-shadow: var(--shadow); }
#focusBtn { padding: 6px 12px; font-size: 13px; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; text-shadow: none; font-variant-numeric: tabular-nums; }
#focusBtn:hover { border-color: var(--accent); }
#focusBtn.on { background: #ffe3ec; border-color: var(--accent); }
#taskList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#taskList li { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.taskmark { flex: none; width: 16px; height: 16px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; font-size: 10px; color: #fff; line-height: 1; }
#taskList li.done .taskmark { background: var(--calm); border-color: var(--calm); }
#taskList li.done .tasktext { color: var(--muted); text-decoration: line-through; }
.tasktext { flex: 1; min-width: 0; }
#taskList small { flex: none; font-size: 11px; color: var(--muted); }
.settingrow { display: flex; gap: 6px; flex-wrap: wrap; }
.switch { align-self: flex-start; }
body.notags .tag:not(.me) .tagsign, body.notags .tag:not(.me) .tagline { display: none; }
body.notags .tag:not(.me) { padding: 0; border: 0; background: none; box-shadow: none; }
body.notags .tag:not(.me)::after { display: none; }
#hoverTip { position: fixed; left: 0; top: 0; z-index: 5; padding: 3px 10px; font-size: 12px; color: var(--text); background: var(--say); border: 2px solid var(--line); border-radius: 999px; pointer-events: none; white-space: nowrap; }
.dogpop { position: absolute; left: 0; top: 0; font-size: 22px; pointer-events: none; animation: dogpop 1.4s ease-out forwards; }
@keyframes dogpop { 0% { opacity: 0; margin-top: 6px; } 25% { opacity: 1; } 100% { opacity: 0; margin-top: -34px; } }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.calendar small { font-size: 11px; color: var(--muted); }
.day { aspect-ratio: 1; display: grid; place-items: center; font-size: 12px; border-radius: 50%; background: var(--ink-2); }
.day[data-level="1"] { background: #ffc7d6; }
.day[data-level="2"] { background: #ff9dba; }
.day[data-level="3"] { background: var(--accent); color: #fff; }
.day.today { box-shadow: 0 0 0 2px var(--focus); }
.gomokuinfo { margin: 0; font-size: 15px; text-align: center; }
.gomoku {
  display: grid; grid-template-columns: repeat(15, 1fr); aspect-ratio: 1; padding: 6px; border-radius: 14px;
  background-color: #e8c68f; border: 2px solid #c79a5e;
}
.pt { position: relative; padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; }
.pt:disabled { cursor: default; }
.pt::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #a67c45; }
.pt::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #a67c45; }
.pt:enabled:hover { background: rgba(220, 68, 116, .25); border-radius: 50%; }
.pt.b, .pt.w { z-index: 1; }
.pt.b::before, .pt.w::before { top: 8%; left: 8%; right: 8%; bottom: 8%; height: auto; border-radius: 50%; z-index: 1; }
.pt.b::before { background: #2b2630; }
.pt.w::before { background: #fffdf8; box-shadow: inset 0 0 0 1px #b9a98f; }
.pt.last::before { box-shadow: 0 0 0 2px var(--accent); }
#modalCard.wide { max-width: 620px; }
#dgBar { position: fixed; left: 50%; top: max(120px, env(safe-area-inset-top, 0px)); transform: translateX(-50%); pointer-events: auto; }
#dgBar .mini { padding: 9px 16px; font-size: 14px; box-shadow: var(--shadow); }
.dghead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dghead .gomokuinfo { text-align: left; min-width: 0; }
.dgtimer { flex: none; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--muted); }
.dgtimer.urgent { color: var(--danger); }
.dgscores { display: flex; flex-wrap: wrap; gap: 5px; }
.dgchip { padding: 2px 9px; font-size: 12px; background: var(--ink-2); border-radius: 999px; }
.dgchip.drawing { background: #ffe3ec; color: var(--accent); }
.dgchip.right { background: #d4f3e3; color: #16704c; }
.dgcanvas { display: block; width: 100%; height: auto; aspect-ratio: 800 / 560; background: #fff; border: 2px solid var(--line); border-radius: 14px; touch-action: none; }
.dgcanvas.mine { cursor: crosshair; }
.dgtools { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.dgcolor { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.dgcolor[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.dglog { list-style: none; margin: 0; padding: 6px 8px; height: 84px; overflow-y: auto; font-size: 12px; line-height: 1.5; background: var(--ink-2); border-radius: 12px; overflow-wrap: anywhere; }
.dglog li.ok { color: #16704c; }
.dgform { display: flex; gap: 6px; }
.dgguess { flex: 1; min-width: 0; padding: 7px 12px; font-size: 14px; color: var(--text); background: var(--ink-2); border: 2px solid var(--line); border-radius: 999px; }
.dgleave { align-self: flex-start; }
.wardrobetabs { grid-template-columns: repeat(4, 1fr); }
.cardbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; }
.cardbtns .mini { padding: 4px 8px; }
.profilehead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.face.big { flex: none; width: 48px; height: 48px; }
.profilewho { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.profilewho b { font-size: 17px; font-weight: 400; overflow-wrap: anywhere; }
.profilewho small { font-size: 12px; color: var(--muted); }
.profilesign { margin: 0; font-size: 14px; color: var(--accent); overflow-wrap: anywhere; }
.friendrow.solo { grid-column: auto; }
.face { background-size: cover; background-position: center; flex: none; }
.face.big { width: 72px; height: 72px; }
#trashLayer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.trash { position: absolute; left: 0; top: 0; padding: 0; width: 26px; height: 26px; font-size: 18px; line-height: 1; background: none; border: 0; cursor: pointer; pointer-events: auto; will-change: transform; }
.trash:hover { font-size: 22px; }
.tiprow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tiprow small { color: var(--muted); font-size: 12px; }
#pkBar { position: fixed; left: 50%; bottom: max(280px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); pointer-events: auto; }
#pkBar .mini { padding: 9px 16px; font-size: 14px; box-shadow: var(--shadow); }
.pkplayers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pkplayer { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; background: var(--ink-2); border: 2px solid transparent; border-radius: 12px; min-width: 0; }
.pkplayer.turn { border-color: var(--accent); }
.pkplayer.out { opacity: .55; }
.pkplayer b { font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
.pkplayer small { font-size: 11px; color: var(--muted); }
.pkhand { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-height: 26px; }
.pkcard { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 3px; font-size: 13px; color: #2b2630; background: #fff; border: 1px solid var(--line); border-radius: 5px; font-variant-numeric: tabular-nums; }
.pkcard.red { color: #d0263f; }
.pkcard.back { color: #fff; background: #a75b78; }
.pkhand.big .pkcard { min-width: 54px; height: 72px; font-size: 20px; border-width: 2px; border-radius: 9px; }
.pkmine { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pkmine small { font-size: 12px; color: var(--muted); }
.pkreveal { display: flex; flex-direction: column; gap: 4px; padding: 7px 9px; background: #fff3d8; border-radius: 12px; }
.pkreveal small { font-size: 12px; }
.pkreveal b { font-size: 12px; font-weight: 400; margin-inline: 4px; }
.pkactions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.pkactions .mini { padding: 7px 12px; font-size: 13px; }
.pkactions small { font-size: 12px; color: var(--muted); }
.pkbuy { display: flex; flex-direction: column; gap: 6px; }
.pkbuy label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.pkbuy input { padding: 7px 12px; font-size: 14px; color: var(--text); background: var(--ink-2); border: 2px solid var(--line); border-radius: 999px; }
.pkboard { justify-content: center; padding: 8px; background: #2f7f5b; border-radius: 14px; }
.pkcard.empty { background: rgba(255,255,255,.12); border: 2px dashed rgba(255,255,255,.3); }
.pkraise { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.pkraise span { flex: none; min-width: 84px; font-variant-numeric: tabular-nums; }
.pkraise input { flex: 1; min-width: 40px; accent-color: var(--accent); }
.pkgames button { padding-block: 7px; }
.ddzhand { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; row-gap: 6px; padding-top: 8px; }
.pkcard.pick { min-width: 34px; height: 46px; cursor: pointer; transition: transform .1s; }
.pkcard.pick.on { transform: translateY(-8px); border-color: var(--accent); box-shadow: 0 2px 0 var(--accent); }
.pkcard.joker { font-size: 11px; }
@media (max-width: 760px) {
  #ui { flex-direction: column; justify-content: flex-start; }
  #head { flex: 1; min-height: 0; }
  #eventsBox { width: 100%; }
  #eventList { max-height: 110px; }
  #head h1 { font-size: 26px; }
  #head p { font-size: 12px; margin-top: 2px; }
  #panel { width: 100%; align-self: stretch; max-height: none; overflow: visible; flex: none; }
  #player { padding: 8px 12px 6px; gap: 5px; }
  #npSub { display: none; }
  #sheet {
    position: absolute; left: 0; right: 0; bottom: 100%; flex: none; max-height: 48vh; margin-bottom: 8px;
    background: var(--ink); border: 1px solid var(--line); border-radius: 6px 18px 6px 18px;
  }
  #chatDock { position: static; width: 100%; max-width: none; height: 136px; flex: none; padding: 8px 10px; margin-top: 8px; }
  #chatDock h2 { display: none; }
}
@media (prefers-reduced-motion: reduce) { #toast, #head { transition: none; } }
@media (max-width: 760px) { #sheet { border: 2px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); } #panel { border-radius: 22px; } #chatDock { height: 150px; } }
@media (max-width: 760px) { #pcBar { bottom: auto; top: 150px; } }
@media (max-width: 760px) { #pkBar { bottom: auto; top: 150px; } }

/* pets */
.petname { margin: 8px 0 4px; font-weight: 700; text-align: center; }
.petmood { margin: 0 0 10px; flex: none; }
.petbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.petbtns button { min-height: 40px; }
.petrow { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.petrow input { flex: 1; min-width: 0; min-height: 36px; padding: 0 10px; font: inherit; font-size: 16px; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.petswatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; }
.petswatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.petrare { color: #b0820e; font-weight: 700; }
.petpick { justify-content: center; margin: 8px 0; }

/* tiny buttons that fold the chat and the music panel away */
.foldbtn {
  position: fixed; z-index: 3; pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  font-size: 20px; line-height: 1; color: var(--text); background: var(--ink); border: 2px solid var(--line); border-radius: 50%; box-shadow: var(--shadow); cursor: pointer;
}
.foldbtn[aria-expanded="true"] { font-size: 17px; color: var(--accent); border-color: var(--accent); }
.foldbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#chatToggle { left: max(12px, env(safe-area-inset-left, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
#panelToggle { right: max(12px, env(safe-area-inset-right, 0px)); top: max(12px, env(safe-area-inset-top, 0px)); }
#chatUnread {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  font-size: 11px; line-height: 18px; text-align: center; color: #fff; background: var(--danger); border-radius: 999px;
}
.chat-closed #chatDock, .panel-closed #panel { display: none; }
#chatDock { bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 52px); }
#panel { margin-top: 44px; max-height: calc(100% - 44px); }

/* a new message while the chat is closed */
#chatPop {
  position: fixed; z-index: 3; pointer-events: auto; display: flex; align-items: stretch; max-width: min(240px, calc(100vw - 24px));
  left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 52px);
  background: var(--ink); color: var(--text); border: 2px solid var(--line); border-radius: 16px 16px 16px 4px; box-shadow: var(--shadow);
  animation: chatpop .18s ease-out;
}
#chatPop[hidden] { display: none; }
#chatPop button { min-height: 40px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
#chatPopOpen { flex: 1; min-width: 0; padding: 7px 4px 7px 12px; font-size: 13px; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
#chatPopOpen b { margin-right: 6px; font-weight: 700; color: var(--focus); }
#chatPopClose { flex: none; width: 36px; padding: 0; font-size: 13px; color: var(--muted); }
@keyframes chatpop { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { #chatPop { animation: none; } }

@media (max-width: 760px) {
  /* upright phones: both buttons along the bottom, with any open panels stacked above them */
  #ui { padding-bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 52px); }
  #panelToggle { top: auto; bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  #panel { margin-top: 0; max-height: none; }
}
@media (max-height: 500px) and (min-width: 761px) {
  /* phones on their side: an open chat fits the short screen */
  #head h1 { font-size: 22px; }
  #chatDock { height: calc(100vh - 215px); min-height: 110px; width: 300px; }
}

/* the top-left corner folds down to one small row */
#headToggle {
  width: 34px; height: 34px; padding: 0; font-size: 18px; font-weight: 700; line-height: 1; color: var(--text);
  background: var(--ink); border: 2px solid var(--line); border-radius: 50%; cursor: pointer; text-shadow: none;
}
#headToggle:hover { border-color: var(--accent); }
#headToggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.head-closed #head h1, .head-closed #clock, .head-closed #eventsBox, .head-closed #adminBtn, .head-closed #focusBtn:not(.on) { display: none; }
.head-closed #hud { margin-top: 0; flex-wrap: nowrap; gap: 6px; }
.head-closed #findMe { width: 34px; height: 34px; padding: 0; }
.head-closed .findword { display: none; }
.head-closed #wallet { gap: 8px; padding: 4px 10px; font-size: 13px; }
.head-closed #hungerBar { width: 44px; }
.head-closed #focusBtn { padding: 5px 9px; white-space: nowrap; }

/* one-click Chinese / English switch, reachable on every screen */
#langBtn {
  font-size: 13px; font-weight: 700; z-index: 12;
  right: calc(max(12px, env(safe-area-inset-right, 0px)) + 52px); top: max(12px, env(safe-area-inset-top, 0px));
}
@media (max-width: 760px) {
  #langBtn { top: auto; bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
}

/* English labels beside the colour swatches are longer than Chinese ones */
.lang-en .swatchrow small { flex: none; width: 48px; white-space: nowrap; }

/* tapping someone: a little bar of things to do with them, floating over their head */
#actBar {
  position: fixed; left: 0; top: 0; z-index: 4; width: min(320px, calc(100vw - 24px)); padding: 7px 8px 8px;
  background: var(--ink); color: var(--text); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); pointer-events: auto;
}
#actBar[hidden] { display: none; }
.acthead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 6px; font-size: 13px; }
.acthead b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actclose { flex: none; width: 26px; height: 26px; padding: 0; font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.actgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.actgrid button {
  min-height: 32px; padding: 3px 9px; font: inherit; font-size: 12px; white-space: nowrap; color: var(--text);
  background: var(--paper, rgba(255,255,255,.6)); border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer;
}
.actgrid button:hover, .actgrid button:focus-visible { border-color: var(--accent); }
/* someone asks you to do something together */
#invitePop {
  position: fixed; left: 50%; top: max(64px, env(safe-area-inset-top, 0px)); z-index: 6; transform: translateX(-50%);
  max-width: min(340px, calc(100vw - 24px)); padding: 10px 14px; text-align: center;
  background: var(--ink); color: var(--text); border: 2px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow);
  animation: chatpop .18s ease-out;
}
#invitePop[hidden] { display: none; }
#invitePop p { margin: 0 0 8px; font-size: 14px; }
#invitePop b { margin-right: 4px; color: var(--accent); }
.invbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
/* small labels on things you can use: quiet, so they never cover the furniture */
.spottag {
  position: absolute; left: 0; top: 0; padding: 1px 6px; font-size: 10px; line-height: 1.4; white-space: nowrap;
  color: var(--muted); background: rgba(255, 250, 244, 0.72); border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 8px;
  opacity: 0.85; pointer-events: none;
}
.spottag[hidden] { display: none; }

/* fishing: a small panel at the bottom while you sit on a stool */
#fishPanel {
  position: fixed; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 4px); z-index: 4; transform: translateX(-50%);
  width: min(330px, calc(100vw - 120px)); padding: 9px 12px 10px; text-align: center;
  background: var(--ink); color: var(--text); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
#fishPanel[hidden] { display: none; }
#fishPanel p { margin: 0 0 8px; font-size: 13px; line-height: 1.35; }
.fishbtns { display: flex; justify-content: center; gap: 8px; }
#fishMain { min-width: 110px; }
#fishMain.pulse { animation: fishpulse .5s ease-in-out infinite alternate; }
@keyframes fishpulse { from { transform: scale(1); } to { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { #fishMain.pulse { animation: none; } }
/* the fish collection */
.fishdex { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fishcard { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; }
.fishcard.unknown { opacity: 0.55; }
.fishcard.rare:not(.unknown) { border-color: var(--accent); }
.fishcard .stars { color: #e0a93b; letter-spacing: 1px; }
.fishcard small { font-size: 11px; color: var(--muted); }

/* the fishing panel steps aside while a window is open */
body:has(#modal:not([hidden])) #fishPanel { display: none; }

/* the cinema: a bar at the bottom, and a big window to watch in */
#filmHolder { position: fixed; left: -9999px; top: 0; width: 4px; height: 4px; overflow: hidden; pointer-events: none; }
#cinemaPanel {
  position: fixed; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 4px); z-index: 4; transform: translateX(-50%);
  width: min(380px, calc(100vw - 120px)); padding: 9px 12px 10px; text-align: center;
  background: var(--ink); color: var(--text); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
#cinemaPanel[hidden] { display: none; }
#cinemaPanel p { margin: 0 0 8px; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
#cinemaPanel .fishbtns { flex-wrap: wrap; }
body:has(#modal:not([hidden])) #cinemaPanel, body:has(#cinemaView:not([hidden])) #cinemaPanel { display: none; }
#cinemaView { position: fixed; inset: 0; z-index: 7; display: grid; place-items: center; padding: 12px; background: rgba(10, 8, 14, 0.82); }
#cinemaView[hidden] { display: none; }
.cvbox { width: min(1100px, 100%); }
.cvhead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: #fff3d6; }
.cvhead b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvhead a { color: #f4c95d; font-size: 13px; }
.cvhead button { width: 36px; height: 36px; font: inherit; color: #fff3d6; background: rgba(255, 255, 255, 0.12); border: 0; border-radius: 50%; cursor: pointer; }
.cvstage { position: relative; aspect-ratio: 16 / 9; max-height: calc(100vh - 110px); margin: 0 auto; background: #000; border-radius: 10px; overflow: hidden; }
.cvstage video, .cvstage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
#cinemaView .hint { color: #b9c0d8; text-align: center; }
.filmlist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.filmlist li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 10px; }
.filmlist li > span { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
.filmlist small { color: var(--muted); font-size: 11px; }
.filmform { display: grid; gap: 6px; margin-bottom: 10px; }
.filmform input { min-height: 36px; padding: 4px 10px; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper, #fff); color: var(--text); }
#cinemaPanel b { margin: 0 4px; }

/* the Bilibili player lined up behind the cinema screen; the 3D view has a hole there */
#screenEmbed { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: 0 0; pointer-events: none; background: #000; }
#screenEmbed[hidden] { display: none; }
#screenEmbed iframe { width: 100%; height: 100%; border: 0; display: block; }

/* 熟练度 page */
.titlepicks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.skillgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.skillcard { display: grid; gap: 4px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; }
.skillcard.fresh { opacity: 0.6; }
.skilltop { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.skilltop span { color: var(--accent); font-weight: 700; }
.skillcard small { font-size: 11px; color: var(--muted); }
.skillcard .bar { height: 6px; }
.profskills { margin: 4px 0 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* the cinema volume slider */
.filmvol { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.filmvol input { width: min(200px, 60vw); accent-color: var(--accent); }
.cvhead .filmvol { margin: 0; }
.cvhead .filmvol input { width: 140px; }

/* the arcade */
.arcpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
@media (max-width: 520px) { .arcpick { grid-template-columns: 1fr; } }
.arcgame { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px; border-radius: 14px; border: 2px solid transparent; background: var(--ink-2); color: var(--text); }
.arcgame b { font-size: 17px; }
.arcgame small { line-height: 1.45; opacity: 0.85; }
.arcgame.on { border-color: var(--accent); }
.arcnames { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.arcchip { padding: 3px 10px; border-radius: 999px; background: var(--ink-2); color: var(--text); font-size: 14px; }
.archead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.archead b { flex: 1; }
.arctimer, .arcscore { font-variant-numeric: tabular-nums; font-weight: bold; }
.arcplay { display: flex; gap: 10px; justify-content: center; align-items: flex-start; }
.arcmain { border-radius: 12px; display: block; cursor: crosshair; }
.arcside { display: flex; flex-direction: column; gap: 8px; }
.arcmini { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.arcmini canvas { border-radius: 6px; }
.arcmini small { font-size: 11px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arcresult { padding-left: 22px; margin: 8px 0 12px; }
.arcresult li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
