/* ==========================================================================
   BOBIKU · CITY CUBE — 設計系統
   方向：「城市紙本 × 街頭貼紙」——暖紙底、墨黑硬邊、硬陰影、紅陶＋橄欖綠，
   與舊 BIBA 深紫霓虹介面完全唔同。AR／掃描頁轉深色，作為「鏡頭模式」。
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --paper:      #F1EADB;
  --paper-2:    #FBF6EC;
  --paper-3:    #E7DECD;
  --ink:        #17130E;
  --ink-2:      #453E34;
  --ink-3:      #7B7264;
  --line:       #17130E;
  --terra:      #C4553A;
  --terra-soft: #E8B9A8;
  --olive:      #5B6141;
  --olive-soft: #C9CDB2;
  --gold:       #C9A24A;
  --mint:       #12BFA6;
  --navy:       #1B2734;

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --shadow:    4px 4px 0 var(--ink);
  --shadow-lg: 7px 7px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);

  --sans: "Noto Sans TC", "Noto Sans HK", "Microsoft JhengHei", "PingFang HK", system-ui, -apple-system, sans-serif;
  --serif: "Noto Serif TC", "Noto Serif HK", "Songti TC", "PMingLiU", Georgia, serif;

  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 3px solid var(--terra); outline-offset: 2px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 紙紋 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(196,85,58,.06), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(91,97,65,.07), transparent 38%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.055'/></svg>");
}

/* ---------- app shell ---------- */
.app {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto; min-height: 100vh;
  padding: 0 16px calc(92px + var(--safe-b));
  display: flex; flex-direction: column;
}

/* 桌面：左右分欄 */
@media (min-width: 1080px) {
  body { background: var(--paper-3); }
  .desk {
    display: grid; grid-template-columns: minmax(380px, 460px) 520px;
    gap: 56px; justify-content: center; align-items: start;
    max-width: 1180px; margin: 0 auto; padding: 40px 24px 0;
  }
  .desk__aside { position: sticky; top: 40px; }
  .app { margin: 0; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-xl);
         box-shadow: var(--shadow-lg); overflow: hidden; padding-bottom: 24px; min-height: auto; }
  .tabbar { position: sticky; }
  .desk-only { display: block !important; }
}
.desk-only { display: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--paper) 78%, rgba(241,234,219,0));
}
@media (min-width: 1080px) { .topbar { background: var(--paper); } }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; margin-right: auto; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: var(--ink); color: var(--paper-2);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 17px;
  box-shadow: var(--shadow-sm);
}
.brand__txt { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: .04em; line-height: 1.1; }
.brand__txt small { display: block; font-family: var(--sans); font-size: 9.5px; letter-spacing: .26em; color: var(--ink-3); font-weight: 600; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--ink);
  background: var(--paper-2); display: grid; place-items: center; font-size: 17px;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

/* ---------- bottom tabs ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  padding: 0 10px calc(8px + var(--safe-b));
  background: linear-gradient(rgba(241,234,219,0), var(--paper) 42%);
}
@media (min-width: 1080px) { .tabbar { position: sticky; padding-bottom: 8px; } }
.tabbar__inner {
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; gap: 2px;
  width: 100%; max-width: 500px;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: 20px;
  box-shadow: var(--shadow); padding: 7px 6px;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px 5px; border-radius: 13px; text-decoration: none;
  color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  border: 0; background: none;
}
.tab i { font-style: normal; font-size: 19px; line-height: 1; filter: grayscale(1) opacity(.55); transition: filter .15s, transform .15s; }
.tab[aria-current="page"] { background: var(--ink); color: var(--paper-2); }
.tab[aria-current="page"] i { filter: none; transform: translateY(-1px); }
.tab--scan {
  position: relative; margin-top: -22px;
  background: var(--terra) !important; color: #fff !important;
  border: 2px solid var(--ink); border-radius: 18px;
  box-shadow: 0 3px 0 var(--ink); padding: 9px 2px 7px;
}
.tab--scan i { filter: none; font-size: 22px; }
.tab--scan[aria-current="page"] { background: var(--terrra, #a63f27) !important; }

/* ---------- typography helpers ---------- */
.kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.display { font-family: var(--serif); font-size: 30px; line-height: 1.18; letter-spacing: .01em; }
.display em { font-style: normal; color: var(--terra); }
.lead { color: var(--ink-2); font-size: 14px; }
.muted { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- card ---------- */
.card {
  position: relative; background: var(--paper-2);
  border: 2px solid var(--ink); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px;
}
.card--flat { box-shadow: none; }
.card--ink { background: var(--ink); color: var(--paper-2); }
.card--ink .muted, .card--ink .kicker, .card--ink .lead { color: rgba(251,246,236,.66); }
.card + .card { margin-top: 14px; }
.card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card__head h2, .card__head h3 { font-size: 17px; }
.card__head .spacer { margin-left: auto; }

/* washi 貼紙角 */
.tape {
  position: absolute; top: -11px; left: 22px; z-index: 2;
  padding: 3px 12px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em;
  background: var(--gold); color: var(--ink); border: 1.5px solid var(--ink);
  transform: rotate(-2.5deg); box-shadow: 3px 3px 0 rgba(23,19,14,.25);
}
.tape--right { left: auto; right: 22px; transform: rotate(2.5deg); background: var(--mint); }
.tape--olive { background: var(--olive-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 11px 18px; border-radius: 14px;
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper-2);
  font-weight: 800; font-size: 14.5px; letter-spacing: .02em; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--block { display: flex; width: 100%; }
.btn--terra { background: var(--terra); }
.btn--paper { background: var(--paper-2); color: var(--ink); }
.btn--mint  { background: var(--mint); color: #06231F; }
.btn--ghost { background: transparent; box-shadow: none; }
.btn--ghost:active { transform: none; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.btn--lg { min-height: 54px; font-size: 16px; border-radius: 16px; }

/* ---------- chips / pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--paper-2); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.chip--ink { background: var(--ink); color: var(--paper-2); }
.chip--terra { background: var(--terra-soft); }
.chip--olive { background: var(--olive-soft); }
.chip--gold { background: #F0DCA8; }
.chip--mint { background: #B7EDE3; }
.chip--outline { background: transparent; border-style: dashed; color: var(--ink-3); }
.chip--sm { padding: 2px 8px; font-size: 10.5px; }

.r-n   { background: #E4DCCC; }
.r-r   { background: #BFDBE6; }
.r-sr  { background: #E9CFA0; }
.r-ssr { background: var(--ink); color: var(--gold); border-color: var(--ink); }

/* ---------- grid ---------- */
.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { margin-left: auto; }

/* ---------- section title ---------- */
.sect { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 12px; }
.sect h2 { font-size: 20px; }
.sect .more { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--terra); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; margin-top: 4px; padding: 20px 18px 16px;
  border: 2px solid var(--ink); border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 82% 0%, rgba(201,162,74,.55), transparent 62%),
    radial-gradient(90% 70% at 0% 100%, rgba(196,85,58,.3), transparent 60%),
    var(--paper-2);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -40px -70px auto; width: 210px; height: 210px;
  border-radius: 50%; border: 2px dashed rgba(23,19,14,.18);
}
.hero__stage { position: relative; height: 178px; display: grid; place-items: center; margin: 2px 0 4px; }
.hero__stage::before {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 50% 46%, rgba(255,255,255,.9), rgba(201,162,74,.32) 58%, rgba(196,85,58,.12) 78%, transparent 80%);
  box-shadow: inset 0 0 0 1.5px rgba(23,19,14,.08);
}
.hero__name { display: flex; align-items: center; gap: 8px; justify-content: center; }
.hero__lv { font-size: 10.5px; letter-spacing: .18em; color: var(--ink-3); font-weight: 800; }

/* 角色 */
.bk { width: 170px; height: 170px; position: relative; z-index: 1;
      filter: drop-shadow(0 9px 12px rgba(23,19,14,.22)) drop-shadow(0 2px 3px rgba(23,19,14,.14)); }
.bk svg, .bk img { width: 100%; height: 100%; }
.bk--float { animation: bob 3.4s ease-in-out infinite; }
.bk--talk  { animation: talkbob .5s ease-in-out infinite; }
.bk--happy { animation: hop .62s cubic-bezier(.3,.8,.3,1) infinite; }
.bk--think { animation: tilt 2.6s ease-in-out infinite; }
@keyframes bob   { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }
@keyframes talkbob { 0%,100% { transform: translateY(0) scale(1) } 50% { transform: translateY(-3px) scale(1.012) } }
@keyframes hop   { 0%,100% { transform: translateY(0) rotate(0) } 40% { transform: translateY(-12px) rotate(-2deg) } 70% { transform: translateY(-2px) rotate(2deg) } }
@keyframes tilt  { 0%,100% { transform: rotate(-2deg) } 50% { transform: rotate(2.5deg) } }

/* 講話泡泡 */
.bubble {
  position: relative; background: var(--paper-2); border: 2px solid var(--ink);
  border-radius: 16px; padding: 10px 13px; font-size: 13.5px; line-height: 1.55;
  box-shadow: var(--shadow-sm); max-width: 100%;
}
.bubble--ink { background: var(--ink); color: var(--paper-2); }
.bubble + .bubble { margin-top: 8px; }

/* ---------- hero 角色（MP4 ＋ 口型層，沿用 bibabuddy 做法） ---------- */
.hero__media {
  position: relative; z-index: 1;
  width: 180px; height: 180px; border-radius: 24px; overflow: hidden;
  border: 2px solid var(--ink); background: #0F1720;
  box-shadow: var(--shadow);
}
.hero__media .hero__still {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero__media .bk { width: 100%; height: 100%; filter: none; }

/* ---------- 對話（avatar ＋ 打字點） ---------- */
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg--me { flex-direction: row-reverse; }
.msg .av {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--ink); background: url("../elf/avatar.webp") center/cover;
  box-shadow: 0 2px 0 rgba(23,19,14,.2);
}
.msg .bubble { max-width: 86%; }
.msg--me .bubble { background: var(--ink); color: var(--paper-2); }
.dots { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; animation: dotb 1.1s infinite; }
.dots i:nth-child(2) { animation-delay: .16s; }
.dots i:nth-child(3) { animation-delay: .32s; }
@keyframes dotb { 0%,60%,100% { opacity: .3; transform: translateY(0) } 30% { opacity: 1; transform: translateY(-3px) } }
.kb-src { margin-top: 5px; font-size: 10.5px; color: var(--ink-3); line-height: 1.5; }
.kb-src-label { font-weight: 800; }
.typing { color: var(--ink-2); }

/* ---------- 進度 ---------- */
.bar { height: 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--terra) 0 7px, #D97757 7px 14px); }
.bar--olive > i { background: repeating-linear-gradient(135deg, var(--olive) 0 7px, #7C8460 7px 14px); }
.bar--gold > i { background: repeating-linear-gradient(135deg, var(--gold) 0 7px, #DCBB77 7px 14px); }

.stat { display: flex; flex-direction: column; gap: 1px; }
.stat b { font-family: var(--serif); font-size: 21px; line-height: 1.1; }
.stat span { font-size: 10.5px; color: var(--ink-3); font-weight: 700; letter-spacing: .06em; }

/* ---------- 動態片段橫向捲動 ---------- */
.reel { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.reel figure { flex: 0 0 118px; margin: 0; scroll-snap-align: start;
  border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: #0E1418; box-shadow: var(--shadow-sm); }
.reel video { width: 100%; aspect-ratio: 1; object-fit: cover; }
.reel figcaption { padding: 5px 8px; background: var(--paper-2); border-top: 2px solid var(--ink);
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; display: flex; align-items: center; gap: 5px; }
.reel figcaption i { font-style: normal; color: var(--terra); }

/* ---------- cube tile ---------- */
.cube {
  position: relative; display: block; width: 100%; padding: 0; text-align: left;
  border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden;
  background: var(--paper-2); box-shadow: var(--shadow-sm); text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease;
}
.cube:active { transform: translate(2px, 2px); box-shadow: 0 0 0; }
.cube__art { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.cube__art img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.cube__badge {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  padding: 2px 7px; border-radius: 6px; border: 1.5px solid var(--ink);
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
}
.cube__lock {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(23,19,14,.72); backdrop-filter: blur(5px) grayscale(1);
  color: var(--paper-2); font-size: 11px; font-weight: 800; letter-spacing: .1em;
}
.cube__lock span { border: 1.5px solid rgba(251,246,236,.6); border-radius: 999px; padding: 5px 11px; }
.cube__meta { padding: 8px 9px 9px; border-top: 2px solid var(--ink); }
.cube__meta b { display: block; font-family: var(--serif); font-size: 14.5px; line-height: 1.3; }
.cube__meta small { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 700; }

/* ---------- 掃描 ---------- */
.scanpage { background: var(--navy); color: var(--paper-2); min-height: 100vh; }
.scanpage::before { opacity: .25; }
.scanpage .app { max-width: 560px; }
.scanpage .topbar { background: linear-gradient(var(--navy) 78%, rgba(27,39,52,0)); }
.scanpage .brand__mark { background: var(--mint); color: var(--navy); }
.scanpage .brand__txt small { color: rgba(251,246,236,.55); }
.scanpage .icon-btn { background: rgba(251,246,236,.08); border-color: rgba(251,246,236,.35); color: var(--paper-2); box-shadow: none; }
.scanpage .tabbar { background: linear-gradient(rgba(27,39,52,0), var(--navy) 42%); }
.scanpage .tabbar__inner { background: #223244; border-color: rgba(251,246,236,.28); box-shadow: none; }
.scanpage .tab { color: rgba(251,246,236,.55); }
.scanpage .tab[aria-current="page"] { background: var(--mint); color: var(--navy); }

.viewport {
  position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: var(--r-lg);
  overflow: hidden; border: 2px solid rgba(251,246,236,.3); background: #0B131C;
  box-shadow: 0 12px 36px rgba(0,0,0,.45);
}
.viewport video { width: 100%; height: 100%; object-fit: cover; }
.viewport__hud { position: absolute; inset: 0; pointer-events: none; }
.frame { position: absolute; width: 26px; height: 26px; border: 2.5px solid var(--mint); }
.frame:nth-child(1) { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 7px 0 0 0; }
.frame:nth-child(2) { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 7px 0 0; }
.frame:nth-child(3) { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 7px; }
.frame:nth-child(4) { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 7px 0; }
.scanline {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--mint), transparent);
  box-shadow: 0 0 14px var(--mint); animation: scanmove 2.4s ease-in-out infinite;
}
@keyframes scanmove { 0%,100% { top: 14% } 50% { top: 86% } }
.viewport__hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 6px 13px; border-radius: 999px; background: rgba(11,19,28,.72);
  border: 1px solid rgba(18,191,166,.5); color: var(--mint);
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em; white-space: nowrap;
}
.scanpage .card { background: #223244; border-color: rgba(251,246,236,.28); box-shadow: 6px 6px 0 rgba(0,0,0,.35); color: var(--paper-2); }
.scanpage .card--flat { box-shadow: none; }
.scanpage .kicker, .scanpage .muted, .scanpage .lead { color: rgba(251,246,236,.6); }
.scanpage .btn--paper { background: rgba(251,246,236,.1); color: var(--paper-2); border-color: rgba(251,246,236,.4); }

/* ---------- 收藏格 ---------- */
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
@media (max-width: 380px) { .shelf { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- 模態 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(23,19,14,.45); backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
@media (min-width: 700px) { .sheet { align-items: center; } }
.sheet[hidden] { display: none; }
.sheet__panel {
  width: 100%; max-width: 500px; max-height: 88vh; overflow: auto;
  background: var(--paper-2); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -8px 0 rgba(23,19,14,.18); padding: 18px 18px calc(20px + var(--safe-b));
  animation: rise .26s cubic-bezier(.2,.9,.25,1.1);
}
@media (min-width: 700px) { .sheet__panel { border-radius: var(--r-xl); padding-bottom: 20px; } }
.sheet__bar { width: 44px; height: 5px; border-radius: 99px; background: var(--paper-3); margin: 0 auto 12px; }
.sheet__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet__head h2 { font-size: 22px; }
.sheet__x { margin-left: auto; flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper); font-weight: 800; }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { transform: translateY(28px); opacity: .4 } }

/* toast */
.toasts { position: fixed; left: 50%; bottom: calc(104px + var(--safe-b)); z-index: 95; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--paper-2); border: 2px solid var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(23,19,14,.3); animation: toastin .22s ease;
  max-width: 88vw; text-align: center;
}
.toast--mint { background: var(--mint); color: #06231F; border-color: #06231F; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0 } }

/* ---------- quiz ---------- */
.quiz__q { font-family: var(--serif); font-size: 19px; line-height: 1.45; margin-bottom: 12px; }
.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 9px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--paper-2);
  font-size: 14.5px; font-weight: 700; box-shadow: var(--shadow-sm);
  transition: transform .1s ease, background .15s;
}
.opt:active { transform: translate(2px,2px); box-shadow: none; }
.opt span.k { width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 7px; font-size: 11.5px; }
.opt.is-right { background: #C9E9CE; }
.opt.is-wrong { background: #F0C6BE; }
.opt[disabled] { pointer-events: none; }
.opt.is-right span.k { background: #2F7D3E; color: #fff; border-color: #2F7D3E; }
.opt.is-wrong span.k { background: #A33B2A; color: #fff; border-color: #A33B2A; }

/* ---------- 上載區 ---------- */
.drop {
  display: grid; place-items: center; gap: 8px; padding: 26px 16px; text-align: center;
  border: 2.5px dashed var(--ink); border-radius: var(--r-lg); background: var(--paper);
  cursor: pointer; transition: background .15s;
}
.drop:hover, .drop.is-over { background: #EDE3D0; }
.drop i { font-style: normal; font-size: 30px; }
.preview { position: relative; border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; background: #000; }
.preview canvas { width: 100%; height: auto; }
.preview__tag { position: absolute; top: 8px; left: 8px; padding: 3px 9px; border-radius: 7px; background: var(--ink); color: var(--paper-2); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; }

.seg { display: flex; gap: 6px; border: 2px solid var(--ink); border-radius: 13px; padding: 4px; background: var(--paper); }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 4px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper-2); }

.clipgrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.clipcard { border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow-sm); }
.clipcard video { width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.clipcard__meta { padding: 7px 9px; border-top: 2px solid var(--ink); display: flex; align-items: center; gap: 6px; }
.clipcard__meta b { font-size: 12.5px; letter-spacing: .04em; }

/* ---------- 詳細頁 / 卡片全圖 ---------- */
.cube-hero { border: 2px solid var(--ink); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); background: var(--paper-2); }
.cube-hero img { width: 100%; }
.trivia { font-size: 14.5px; line-height: 1.85; color: var(--ink-2); }
.trivia + .trivia { margin-top: .8em; }

/* ---------- 桌面左欄 ---------- */
.aside-card { border: 2px solid var(--ink); border-radius: var(--r-lg); background: var(--paper-2); box-shadow: var(--shadow); padding: 22px; }
.aside-card + .aside-card { margin-top: 16px; }
.aside-title { font-family: var(--serif); font-size: 34px; line-height: 1.15; }
.aside-title em { font-style: normal; color: var(--terra); }
.aside-kicker { font-size: 10.5px; letter-spacing: .22em; font-weight: 800; color: var(--ink-3); text-transform: uppercase; margin-bottom: 10px; }
.feature { display: flex; gap: 10px; padding: 9px 0; border-top: 1.5px dashed rgba(23,19,14,.2); }
.feature:first-of-type { border-top: 0; }
.feature b { font-size: 13.5px; }
.feature p { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.feature .no { font-family: var(--serif); font-size: 15px; color: var(--terra); width: 22px; flex: none; }

/* ---------- misc ---------- */
.hr { height: 2px; background: var(--ink); border: 0; margin: 18px 0; opacity: .12; }
.note { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.spin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(23,19,14,.25); border-top-color: var(--ink); animation: sp .8s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg) } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 99; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}


