/* 留言廣場：一片空白、走來走去的礦石小人、中間一顆慢慢轉的黑曜石 */
:root {
  --bg: #fbfaf7; --ink: #2b2a28; --muted: #8a857c; --line: #e6e0d4; --card: #ffffff;
  --accent: #c2603a; --note-bg: #faf1df; --note-ink: #7a5212; --done-bg: #e6f2ea; --done-ink: #2f6b47; --err: #b2412a;
  --font: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; -webkit-tap-highlight-color: transparent; }

#stage { position: fixed; left: 0; right: 0; bottom: 0; top: var(--sitebar-h, 0px); overflow: hidden; }
#ground { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
#cube-shadow { fill: var(--ink); opacity: .26; }
.walker { cursor: pointer; }
.walker .hit { fill: transparent; }
.walker.mine .bubble path { stroke: var(--accent); }

/* the obsidian cube (CSS 3D) */
#cube-view { position: absolute; left: 0; top: 0; perspective: 800px; pointer-events: none; }
#cube { position: absolute; inset: 0; transform-style: preserve-3d; border: 0; padding: 0; background: none; cursor: pointer; pointer-events: auto; }
#cube:focus-visible { outline: none; }
#cube:focus-visible .f { box-shadow: inset 0 0 0 2px var(--accent); }
#cube .f { position: absolute; inset: 0; backface-visibility: hidden; background-size: 300% 300%; }
#cube .f i { position: absolute; inset: 0; background: #000; pointer-events: none; }

/* the 3D square (plaza3d.js): the flat plaza's ground and cube are hidden */
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
body.three { background: #e9e2d5; }
body.three #ground, body.three #cube-view { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr-only:focus-within { position: fixed; left: 50%; top: calc(var(--sitebar-h, 0px) + 60px); transform: translateX(-50%); width: auto; height: auto; margin: 0; clip: auto; z-index: 7; display: flex; gap: 8px; }
body:not(.three) .sr-only, body:not(.three) .all-btn { display: none; }
/* 3D square: the moai talks when tapped, so the list of every message has its own button */
.all-btn { position: absolute; top: 18px; right: 16px; z-index: 4; font: inherit; font-size: 13px; letter-spacing: .08em; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .85); color: var(--ink); cursor: pointer; backdrop-filter: blur(6px); }
.all-btn:hover { border-color: var(--ink); }
/* speech bubbles over the 3D square: real page text so it stays sharp; plaza3d.js moves each one onto its stone */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
#labels > div { position: absolute; left: 0; top: 0; will-change: transform; }
#labels .bub { translate: -50% calc(-100% - 8px); background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; line-height: 18px; white-space: nowrap; }
#labels .bub::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 8px; height: 8px; margin-left: -5px; background: #fff;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); }
#labels .bub.mine, #labels .bub.mine::after { border-color: var(--accent); }
#labels .quote { white-space: normal; width: max-content; max-width: 240px; text-wrap: balance; text-align: center; font-size: 13px; line-height: 1.6; padding: 7px 14px; border-radius: 16px; }
#labels .bang { translate: -50% -100%; color: var(--accent); font-weight: 800; font-size: 22px; line-height: 1; }
.credit { position: absolute; left: 12px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); margin: 0; z-index: 3; font-size: 10px; color: var(--muted); letter-spacing: .02em; }
.credit a { color: inherit; }
body:not(.three) .credit { display: none; }

.head { position: absolute; top: 18px; left: 20px; pointer-events: none; }
.head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .24em; }
.head p { margin: 6px 0 0; font-size: 13px; color: var(--muted); letter-spacing: .08em; }

/* the panel: one message, the form, or every message (from the cube) */
.panel { position: absolute; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(460px, calc(100% - 28px)); max-height: min(62%, 560px); overflow: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 14px 40px rgba(43, 42, 40, .14); padding: 20px 20px 18px; z-index: 5; }
.panel .close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; border-radius: 10px; }
.panel .close:hover { background: #f3efe7; color: var(--ink); }
.panel .who { font-size: 12px; color: var(--muted); letter-spacing: .08em; padding-right: 36px; }
.panel .msg { font-size: 16px; line-height: 1.8; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.panel h2 { margin: 0 36px 4px 0; font-size: 16px; letter-spacing: .14em; font-weight: 600; }
.panel .sub { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.note { margin-top: 10px; font-size: 13px; line-height: 1.7; padding: 8px 12px; border-radius: 10px; background: var(--note-bg); color: var(--note-ink); white-space: pre-wrap; word-break: break-word; }
.done-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--done-bg); color: var(--done-ink); margin-left: 6px; vertical-align: 1px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { font: inherit; font-size: 14px; letter-spacing: .08em; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #45423e; }
.btn:disabled { opacity: .5; cursor: default; }

.form label { display: block; font-size: 12px; color: var(--muted); letter-spacing: .08em; margin: 12px 0 6px; }
.form input, .form textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.form input:focus, .form textarea:focus { border-color: var(--ink); }
.form textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.form .count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 4px; }
.form .count.over { color: var(--err); }
.form .tip { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 10px 0 0; }
.err { color: var(--err); font-size: 13px; margin-top: 8px; }
.err:empty { display: none; }

.list { margin-top: 4px; }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item .t { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.item .m { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.tabs button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.tabs button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

.toast { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 999px; z-index: 6; letter-spacing: .06em; }

@media (max-width: 560px) {
  .head { top: 14px; left: 16px; }
  .head h1 { font-size: 18px; }
  .panel { max-height: 70%; padding: 18px 16px 16px; }
}

/* 列表打開時像捲軸一樣由上往下展開，項目依序出現 */
@keyframes ck-unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ck-item { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.unroll { animation: ck-unroll .55s cubic-bezier(.3, .7, .2, 1) both; }
.unroll > * { animation: ck-item .35s ease both; animation-delay: .62s; }
.unroll > :nth-child(1) { animation-delay: 0.080s; }
.unroll > :nth-child(2) { animation-delay: 0.125s; }
.unroll > :nth-child(3) { animation-delay: 0.170s; }
.unroll > :nth-child(4) { animation-delay: 0.215s; }
.unroll > :nth-child(5) { animation-delay: 0.260s; }
.unroll > :nth-child(6) { animation-delay: 0.305s; }
.unroll > :nth-child(7) { animation-delay: 0.350s; }
.unroll > :nth-child(8) { animation-delay: 0.395s; }
.unroll > :nth-child(9) { animation-delay: 0.440s; }
.unroll > :nth-child(10) { animation-delay: 0.485s; }
.unroll > :nth-child(11) { animation-delay: 0.530s; }
.unroll > :nth-child(12) { animation-delay: 0.575s; }
