:root {
  --ink: #0E1912;
  --ink-2: #172a1e;
  --ink-3: #24402d;
  --deep: #08110b;
  --line: rgba(242, 181, 68, 0.28);
  --gold: #F2B544;
  --gold-soft: #FFD98A;
  --gold-deep: #9A6512;
  --ember: #E07A4F;
  --text: #F4EEDC;
  --muted: #9DB3A2;
  --danger: #FF7B6B;
  --ok: #7BC47F;
  --r1: #7BC47F; --r2: #5BA8D0; --r3: #A985D6; --r4: #F2B544;
  --num: "Bungee", "Noto Serif TC", serif;
  --pixel: "Press Start 2P", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { background: var(--ink); color: var(--text); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 50% -160px, rgba(242,181,68,0.16), transparent 70%),
    radial-gradient(700px 500px at 110% 110%, rgba(224,122,79,0.10), transparent 70%),
    radial-gradient(600px 600px at -10% 60%, rgba(91,168,208,0.07), transparent 70%),
    linear-gradient(180deg, #13241a 0%, var(--ink) 45%, var(--deep) 100%) fixed;
}
/* 螢火蟲 */
body::before, body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(255,217,138,0.9), transparent 60%),
    radial-gradient(2px 2px at 78% 14%, rgba(255,217,138,0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 45% 68%, rgba(190,255,170,0.8), transparent 60%),
    radial-gradient(2px 2px at 88% 58%, rgba(255,217,138,0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 84%, rgba(190,255,170,0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 36%, rgba(255,217,138,0.6), transparent 60%);
  animation: drift 14s ease-in-out infinite alternate;
}
body::after { transform: translate(30px, 40px); animation-duration: 19s; animation-direction: alternate-reverse; opacity: .7; }
@keyframes drift { 0% { transform: translate(0,0); opacity: .5; } 50% { opacity: 1; } 100% { transform: translate(-24px,-36px); opacity: .6; } }

h1, h2, h3, .serif { font-family: "Noto Serif TC", "Songti TC", serif; font-weight: 900; letter-spacing: 0.04em; margin: 0; }
h1, h2 { text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; text-shadow: 0 2px 0 rgba(0,0,0,0.5), 0 0 24px rgba(242,181,68,0.18); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.wrap { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 20px 16px 104px; }

.eyebrow { font-family: var(--pixel); color: var(--gold); font-size: 9px; line-height: 1.8; letter-spacing: 0.08em; margin: 0 0 6px; overflow-wrap: anywhere; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* 面板：雙框金邊＋四角鉚釘 */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(36,64,45,0.92), rgba(18,33,23,0.95));
  border: 2px solid rgba(242,181,68,0.38);
  border-radius: 18px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: inset 0 0 0 4px rgba(8,17,11,0.55), inset 0 0 0 5px rgba(242,181,68,0.12), 0 10px 30px rgba(0,0,0,0.35);
}
.card::before, .card::after {
  content: ""; position: absolute; top: 8px; width: 7px; height: 7px; transform: rotate(45deg);
  background: var(--gold); box-shadow: 0 0 8px rgba(242,181,68,0.7); opacity: .8;
}
.card::before { left: 8px; }
.card::after { right: 8px; }

/* 遊戲按鈕：有厚度、按下會沉 */
.btn {
  display: block; width: 100%; position: relative;
  padding: 14px 18px; border-radius: 14px;
  font-weight: 900; font-size: 17px; letter-spacing: 0.08em;
  background: linear-gradient(180deg, #FFE29A 0%, var(--gold) 45%, #D98E1C 100%);
  color: #2A1A04;
  box-shadow: 0 5px 0 var(--gold-deep), 0 8px 18px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.6);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold-deep), 0 3px 8px rgba(0,0,0,0.4), inset 0 2px 0 rgba(255,255,255,0.6); }
.btn:disabled { filter: grayscale(0.85) brightness(0.65); cursor: default; }
.btn.ghost { background: rgba(8,17,11,0.5); color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 rgba(0,0,0,0.35); text-shadow: none; }
.btn.ghost:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--gold); }
.btn.quiet { background: transparent; color: var(--muted); font-weight: 400; font-size: 14px; padding: 10px; box-shadow: none; text-shadow: none; letter-spacing: .04em; }
.btn.quiet:active { transform: none; }
.btn + .btn { margin-top: 12px; }

label { display: block; font-size: 14px; color: var(--gold-soft); margin: 18px 0 8px; font-weight: 700; letter-spacing: .04em; }
.input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: rgba(8,17,11,0.75); border: 2px solid var(--ink-3); outline: none; font-size: 17px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.4);
}
.input:focus { border-color: var(--gold); box-shadow: inset 0 3px 8px rgba(0,0,0,0.4), 0 0 0 4px rgba(242,181,68,0.15); }
.pin { letter-spacing: 0.8em; text-align: center; font-size: 24px; }

.err { color: var(--danger); font-size: 14px; min-height: 22px; margin-top: 10px; }

/* 公會選擇：四面旗幟 */
.teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.teams button {
  position: relative; min-width: 0; padding: 14px 8px 12px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 22%, #0c1710), rgba(8,17,11,0.9));
  border: 2px solid color-mix(in srgb, var(--tc) 45%, transparent);
  box-shadow: 0 4px 0 rgba(0,0,0,0.35);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.teams button .crest { width: 64px; height: 68px; margin-bottom: 2px; }
.teams button b { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 17px; color: var(--tc); letter-spacing: .06em; }
.teams button small { color: var(--muted); font-size: 12px; }
.teams button.on { border-color: var(--tc); transform: translateY(-2px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 30%, transparent), 0 0 24px color-mix(in srgb, var(--tc) 55%, transparent), 0 6px 0 rgba(0,0,0,0.35); }
.teams button.on::after { content: "✓"; position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--tc); color: #111; font-weight: 900; font-size: 13px; display: grid; place-items: center; }

.crest { display: block; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.55)); }
.tchip .crest { width: 18px; height: 18px; filter: none; }
.crest-row { display: flex; justify-content: center; gap: 6px; }
.crest-row .crest { width: 58px; height: 62px; animation: float 3s ease-in-out infinite; }
.crest-row .crest:nth-child(2) { animation-delay: .4s; } .crest-row .crest:nth-child(3) { animation-delay: .8s; } .crest-row .crest:nth-child(4) { animation-delay: 1.2s; }
@keyframes float { 50% { transform: translateY(-6px); } }
.tchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  color: var(--tc); background: color-mix(in srgb, var(--tc) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
}

.avatars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.avatars button {
  aspect-ratio: 1; min-width: 0; padding: 0; line-height: 1;
  font-size: clamp(20px, 6.2vw, 28px); border-radius: 12px;
  background: rgba(8,17,11,0.75); border: 2px solid transparent; transition: transform .12s ease;
}
.avatars button.on { border-color: var(--gold); background: var(--ink-3); transform: scale(1.08); box-shadow: 0 0 16px rgba(242,181,68,0.45); }

/* 角色卡 */
.hero { display: flex; gap: 16px; align-items: center; }
.hero .face {
  width: 84px; height: 84px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 46px; position: relative;
  background: radial-gradient(circle at 35% 30%, #3c6a4a, #0b160f 75%);
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(8,17,11,0.8), 0 0 0 6px rgba(242,181,68,0.35), 0 0 26px rgba(242,181,68,0.35);
}
.hero .badge {
  position: absolute; right: -6px; bottom: -4px; font-size: 20px;
  background: var(--ink); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--gold);
}
.hero .who { min-width: 0; }
.hero .name { font-size: 24px; overflow-wrap: anywhere; line-height: 1.25; }
.hero .title { color: var(--gold-soft); font-size: 14px; }
.lv { font-family: var(--num); color: var(--gold); font-size: 15px; letter-spacing: .04em; text-shadow: 0 0 10px rgba(242,181,68,0.5); }

/* 經驗條：分格＋流光 */
.bar { position: relative; height: 18px; border-radius: 99px; background: rgba(8,17,11,0.9); border: 2px solid var(--ink-3); overflow: hidden; margin-top: 18px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.6); }
.bar i { position: relative; display: block; height: 100%; width: 0; background: linear-gradient(180deg, #FFE7A8, var(--gold) 50%, #C9800F); border-radius: 99px; transition: width .7s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 14px rgba(242,181,68,0.6); overflow: hidden; }
.bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.55) 45%, transparent 60%); transform: translateX(-100%); animation: shine 2.6s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(120%); } }
.bar .ticks { position: absolute; inset: 0; display: grid; pointer-events: none; }
.bar .ticks span { border-right: 2px solid rgba(8,17,11,0.75); }
.bar .ticks span:last-child { border-right: 0; }
.bar-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.bar-meta b { color: var(--gold); font-family: var(--num); font-weight: 400; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.stat { background: rgba(8,17,11,0.7); border: 1px solid rgba(242,181,68,0.14); border-radius: 12px; padding: 10px 4px 8px; text-align: center; min-width: 0; }
.stat b { display: block; font-size: clamp(18px, 5.4vw, 22px); font-family: var(--num); font-weight: 400; color: var(--gold); line-height: 1.25; }
.stat span { font-size: clamp(11px, 3.1vw, 12px); color: var(--muted); white-space: nowrap; }

/* 加分寶石：稀有度 */
.points { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, 2.4vw, 10px); margin-top: 14px; }
.points button {
  --rc: var(--r1);
  position: relative; aspect-ratio: 0.86; min-width: 0; padding: 4px 2px; border-radius: 16px;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--rc) 45%, transparent), transparent 70%), linear-gradient(180deg, color-mix(in srgb, var(--rc) 28%, #0e1912), #0b140e);
  border: 2px solid color-mix(in srgb, var(--rc) 70%, transparent);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--rc) 40%, #000), 0 0 16px color-mix(in srgb, var(--rc) 25%, transparent), inset 0 1px 0 rgba(255,255,255,0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .08s ease, box-shadow .08s ease;
}
.points button:nth-child(2) { --rc: var(--r2); }
.points button:nth-child(3) { --rc: var(--r3); }
.points button:nth-child(4) { --rc: var(--r4); animation: legend 2.4s ease-in-out infinite; }
@keyframes legend { 50% { box-shadow: 0 5px 0 color-mix(in srgb, var(--rc) 40%, #000), 0 0 28px color-mix(in srgb, var(--rc) 60%, transparent), inset 0 1px 0 rgba(255,255,255,0.25); } }
.points button:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--rc) 40%, #000), inset 0 1px 0 rgba(255,255,255,0.25); }
.points button b { font-family: var(--num); font-weight: 400; font-size: clamp(22px, 6.6vw, 28px); color: #fff; line-height: 1; text-shadow: 0 0 12px var(--rc), 0 2px 0 rgba(0,0,0,0.5); }
.points button span { font-size: clamp(10px, 2.9vw, 11px); color: var(--rc); white-space: nowrap; font-weight: 700; }
.points button em { font-family: var(--pixel); font-style: normal; font-size: 6px; letter-spacing: .04em; color: color-mix(in srgb, var(--rc) 80%, #fff); opacity: .85; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(242,181,68,0.12); font-size: 15px; align-items: baseline; }
.log li > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.log li:last-child { border-bottom: 0; }
.log .pt { flex: none; min-width: 44px; font-family: var(--num); color: var(--gold); }
.log .pt.neg { color: var(--danger); }
.log time { flex: none; margin-left: auto; color: var(--muted); font-size: 12px; }

.banner {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: linear-gradient(90deg, rgba(242,181,68,0.25), rgba(242,181,68,0.05));
  border: 2px solid var(--gold); border-radius: 14px; padding: 14px 16px; margin-top: 16px;
  animation: glow 2s ease-in-out infinite;
}
.banner b { color: var(--gold); }
@keyframes glow { 50% { box-shadow: 0 0 22px rgba(242,181,68,0.45); } }

/* 個人排行 */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; }
.rank li:nth-child(odd) { background: rgba(255,255,255,0.03); }
.rank li.me { background: rgba(242,181,68,0.16); outline: 2px solid var(--gold); }
.rank .no { width: 40px; text-align: center; font-family: var(--num); color: var(--muted); flex: none; }
.rank .no.top { font-size: 15px; }
.rank .fc { font-size: 26px; flex: none; }
.rank .nm { min-width: 0; flex: 1; }
.rank .nm div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank .nm small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .xp { flex: none; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rank .xp b { color: var(--gold); font-size: 16px; font-family: var(--num); font-weight: 400; }

.place { font-family: var(--num); color: var(--pc); text-shadow: 0 0 10px color-mix(in srgb, var(--pc) 60%, transparent), 0 2px 0 rgba(0,0,0,0.5); letter-spacing: .02em; }
.roomname { color: var(--gold-soft); font-size: 13px; font-weight: 700; letter-spacing: .08em; margin: 0 0 4px; }

/* 公會總分 */
.trank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trank li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 18%, transparent), rgba(8,17,11,0.4)); border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent); }
.trank li.me { border: 2px solid var(--tc); box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 40%, transparent); }
.trank .no { width: 40px; flex: none; text-align: center; font-family: var(--num); color: var(--muted); font-size: 18px; }
.trank .crest { width: 40px; height: 44px; flex: none; }
.trank .nm { flex: 1; min-width: 0; }
.trank .nm div { font-family: "Noto Serif TC", serif; font-weight: 900; color: var(--tc); letter-spacing: .05em; }
.trank .nm small { color: var(--muted); font-size: 12px; }
.trank .xp { flex: none; text-align: right; font-size: 11px; color: var(--muted); line-height: 1.2; }
.trank .xp b { font-family: var(--num); font-weight: 400; font-size: 22px; color: #fff; text-shadow: 0 0 10px var(--tc); }
.tbar { display: block; height: 6px; margin-top: 5px; border-radius: 99px; background: rgba(8,17,11,0.8); overflow: hidden; }
.tbar i { display: block; height: 100%; background: var(--tc); border-radius: 99px; box-shadow: 0 0 10px var(--tc); transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* 底部分頁 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(14,25,18,0.88), rgba(8,17,11,0.98)); border-top: 2px solid rgba(242,181,68,0.35);
  backdrop-filter: blur(8px);
}
.tabs button { flex: 1; max-width: 220px; padding: 11px; border-radius: 12px; color: var(--muted); font-weight: 900; letter-spacing: .06em; }
.tabs button.on { background: linear-gradient(180deg, var(--ink-3), #1a3022); color: var(--gold); box-shadow: inset 0 0 0 2px rgba(242,181,68,0.5), 0 0 16px rgba(242,181,68,0.2); }

/* 彈出層 */
.layer {
  position: fixed; inset: 0; z-index: 20; background: rgba(3, 8, 5, 0.8);
  display: flex; align-items: flex-end; justify-content: center; padding: 0 12px;
}
.layer.mid { align-items: center; padding: 16px; }
.sheet {
  position: relative; width: 100%; max-width: 480px;
  background: linear-gradient(180deg, #1f3727, #122017);
  border: 2px solid rgba(242,181,68,0.45);
  border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up .25s cubic-bezier(.2,.8,.2,1);
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: inset 0 0 0 4px rgba(8,17,11,0.5), 0 -10px 40px rgba(0,0,0,0.5);
}
.sheet .jobs, .sheet .chips { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sheet .jobs::-webkit-scrollbar, .sheet .chips::-webkit-scrollbar { display: none; }
.sheet .jobs { -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%); mask-image: linear-gradient(180deg, #000 82%, transparent 100%); }
.sheet .jobs.end { -webkit-mask-image: none; mask-image: none; }
.layer.mid .sheet { border-radius: 22px; animation: pop .4s cubic-bezier(.2,1.4,.4,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(0.75); opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips button { padding: 8px 14px; border-radius: 99px; background: rgba(8,17,11,0.75); border: 2px solid var(--ink-3); font-size: 15px; }
.chips button.on { border-color: var(--gold); color: var(--gold); background: var(--ink-3); }

.jobs { display: grid; gap: 8px; margin-top: 14px; }
.job { text-align: left; display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(8,17,11,0.75); border: 2px solid transparent; }
.job > span:last-child { min-width: 0; }
.job.on { border-color: var(--gold); background: var(--ink-3); box-shadow: 0 0 18px rgba(242,181,68,0.3); }
.job .ic { font-size: 34px; flex: none; }
.job h3 { font-size: 18px; }
.job .sk { color: var(--gold); font-size: 13px; }
.job p { margin: 3px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.job .path { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--gold-soft); }
.job .path span { white-space: nowrap; }
.job .path i { color: var(--muted); font-style: normal; margin: 0 3px; }

/* 升級 */
.levelup { text-align: center; overflow: hidden; }
.levelup::before {
  content: ""; position: absolute; left: 50%; top: 90px; width: 640px; height: 640px; margin: -320px 0 0 -320px; z-index: -1; pointer-events: none;
  background: repeating-conic-gradient(rgba(242,181,68,0.16) 0 10deg, transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 60%); mask-image: radial-gradient(circle, #000 0, transparent 60%);
  animation: rays 14s linear infinite;
}
.levelup { isolation: isolate; }
@keyframes rays { to { transform: rotate(360deg); } }
.levelup .big {
  font-family: var(--num); font-weight: 400; font-size: 60px; line-height: 1.1;
  background: linear-gradient(180deg, #FFF3CF, var(--gold) 55%, #C47A0C); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.55)) drop-shadow(0 0 22px rgba(242,181,68,0.5));
}
.levelup .big.cjk { font-family: "Noto Serif TC", serif; font-weight: 900; }
.levelup .star .crest.intro { width: 96px; height: 104px; margin: 0 auto; }
.levelup .star { font-size: 48px; animation: spin 1.2s ease-out; display: inline-block; filter: drop-shadow(0 0 16px rgba(242,181,68,0.7)); }
@keyframes spin { from { transform: rotate(-180deg) scale(0.2); } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); opacity: .9; } }

.floatxp {
  position: fixed; z-index: 35; pointer-events: none; transform: translate(-50%, -50%);
  font-family: var(--num); font-size: 44px; color: #fff; text-shadow: 0 0 18px var(--rc, var(--gold)), 0 3px 0 rgba(0,0,0,0.6);
  animation: floatup 1.1s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 30;
  background: linear-gradient(180deg, #FFE29A, var(--gold)); color: #2A1A04; font-weight: 900; padding: 10px 18px; border-radius: 99px;
  box-shadow: 0 4px 0 var(--gold-deep), 0 8px 24px rgba(0,0,0,0.45); animation: up .25s ease;
  max-width: calc(100vw - 32px); text-align: center; overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 小螢幕手機（iPhone SE 一代、矮螢幕） */
@media (max-width: 340px) {
  .avatars { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card { padding: 16px; }
}
@media (max-height: 640px) {
  .layer.mid .sheet { padding: 16px 14px; }
  .levelup .star .crest.intro { width: 64px; height: 70px; }
  .levelup .big { font-size: 44px; }
  .levelup .card { padding: 12px 14px; margin-top: 10px; }
  .levelup .star { font-size: 38px; }
  .levelup p { margin-top: 8px !important; font-size: 14px; }
  .levelup .btn { margin-top: 12px !important; }
}
