/* ============================================
   深空霓虹 · 遊戲帳號商店
   ============================================ */

:root {
  /* 顏色 */
  --bg: #08090f;
  --bg-2: #0d0f1a;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .05);

  --text: #edeff5;
  --text-2: #a8aec0;
  --text-3: #6d7488;

  --cyan: #5ee0f0;
  --violet: #a78bfa;
  --gold: #f5b43c;
  --green: #3ddc9a;
  --red: #ff6b6b;

  --glow-cyan: rgba(94, 224, 240, .3);
  --glow-violet: rgba(167, 139, 250, .25);

  /* 圓角走硬派一點，不要圓滾滾 */
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .5);
  --shadow-lift: 0 16px 48px rgba(0, 0, 0, .6);

  /* 動態 */
  --fast: 140ms cubic-bezier(.4, 0, .2, 1);
  --smooth: 320ms cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 背景光暈：兩團漸層 + 細網格，讓畫面不是死板的一片黑 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(94, 224, 240, .13), transparent 60%),
    radial-gradient(800px 560px at 88% 4%, rgba(167, 139, 250, .12), transparent 62%),
    radial-gradient(700px 500px at 50% 105%, rgba(94, 224, 240, .06), transparent 60%),
    var(--bg);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 100% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 100% 60% at 50% 0%, #000 20%, transparent 75%);
}

a { color: var(--cyan); text-decoration: none; transition: color var(--fast); }
a:hover { color: #fff; }

::selection { background: var(--glow-cyan); color: #fff; }

/* 捲軸 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .16); }

/* ============ 頂部列 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: rgba(8, 9, 15, .72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 800;
  letter-spacing: .06em;
}

/* 漸層只吃文字，圖片包在外面才不會被裁掉 */
.topbar h1 .name {
  background: linear-gradient(100deg, #fff 10%, var(--cyan) 55%, var(--violet) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar .sub { color: var(--text-3); font-size: 13px; }

/* ============ 版面 ============ */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 80px;
}

.hero {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3.5vw, 32px);
  padding: clamp(24px, 5vw, 48px) 0 clamp(16px, 3vw, 28px);
}

.hero-text { min-width: 0; }

/* 店招圖 */
.logo-lg {
  flex: 0 0 auto;
  width: clamp(84px, 13vw, 132px);
  height: clamp(84px, 13vw, 132px);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(94, 224, 240, .5);
  box-shadow: 0 0 0 6px rgba(94, 224, 240, .07), 0 14px 44px rgba(0, 0, 0, .55), 0 0 44px var(--glow-cyan);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.logo-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  vertical-align: middle;
  border: 1px solid rgba(94, 224, 240, .45);
  box-shadow: 0 0 14px var(--glow-cyan);
}

.hero h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5.5vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.hero h2 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p { margin: 0; color: var(--text-2); font-size: clamp(14px, 2vw, 16px); max-width: 54ch; }

.back-link { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.back-link:hover { color: var(--cyan); }

/* ============ 首頁的遊戲選擇 ============ */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform var(--smooth), border-color var(--fast), box-shadow var(--fast);
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: rgba(94, 224, 240, .5);
  box-shadow: var(--shadow-lift), 0 0 34px var(--glow-cyan);
}

.game-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(94, 224, 240, .16), rgba(167, 139, 250, .16));
  font-size: 46px;
  font-weight: 800;
  color: rgba(255, 255, 255, .45);
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--smooth);
}

.game-card:hover .game-cover img { transform: scale(1.06); }

/* 封面下緣壓一層黑，文字才壓得住圖 */
.game-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(transparent, rgba(8, 9, 15, .85));
  pointer-events: none;
}

.game-body { padding: 14px 16px 16px; }
.game-name { margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.35; }
.game-meta { font-size: 12px; color: var(--text-3); }

.game-card::after {
  content: "進入挑號 →";
  position: absolute;
  right: 14px;
  bottom: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--smooth), transform var(--smooth);
}

.game-card:hover::after { opacity: 1; transform: translateX(0); }

/* ============ 挑號頁的遊戲標題 ============ */
.game-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: clamp(20px, 3.5vw, 34px) 0 clamp(14px, 2vw, 22px);
}

.game-head h2 { margin: 0; font-size: clamp(22px, 3.6vw, 32px); font-weight: 800; letter-spacing: -.01em; }
.game-head p { margin: 4px 0 0; color: var(--text-3); font-size: 13.5px; }

.game-head-cover {
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(94, 224, 240, .18), rgba(167, 139, 250, .18));
  border: 1px solid var(--line);
  font-size: 26px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
}

.game-head-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 同一個框裡分區用的分隔線 */
.panel-divider {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.panel {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 3vw, 28px);
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

/* 面板頂端一道細光，做出玻璃邊緣感 */
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
}

.panel .hint { color: var(--text-3); font-size: 13px; margin: 0 0 20px; }

/* 精簡版面板：編碼查詢那種放在最上面的小條 */
.panel.slim { padding: 16px clamp(16px, 2.5vw, 22px); margin-bottom: 26px; }
.panel.slim h2 { font-size: 15px; }
.panel.slim .hint { margin-bottom: 14px; }

/* 步驟標籤 */
.step-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
}

.step-label .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--glow-cyan), var(--glow-violet));
  border: 1px solid rgba(94, 224, 240, .35);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.sel-info { font-size: 12.5px; color: var(--text-3); }
.sel-info strong { color: var(--cyan); font-weight: 800; }

/* ============ 表單 ============ */
label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover { border-color: rgba(255, 255, 255, .18); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(0, 0, 0, .45);
  box-shadow: 0 0 0 3px var(--glow-cyan);
}

input:disabled, select:disabled { opacity: .4; cursor: not-allowed; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8aec0' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

select option { background: var(--bg-2); color: var(--text); }

textarea { resize: vertical; min-height: 92px; line-height: 1.6; }

/* 數字輸入框：右邊掛一個單位字樣 */
.input-suffix { position: relative; }
.input-suffix input { padding-right: 74px; }
.input-suffix .suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-3);
  pointer-events: none;
}

/* 數字框的上下箭頭在深色底下很醜，直接拿掉 */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.row > * { flex: 1 1 200px; min-width: 0; }
.row.tight { margin-bottom: 0; }

/* ============ 按鈕 ============ */
button {
  position: relative;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #071016;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform var(--fast), box-shadow var(--fast), filter var(--fast);
}

button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--glow-cyan); filter: brightness(1.08); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
button:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(.6); }

button.ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-weight: 600;
}
button.ghost:hover { color: #fff; border-color: var(--cyan); box-shadow: 0 0 0 3px var(--glow-cyan); background: var(--surface-2); }

button.danger { background: transparent; border: 1px solid rgba(255, 107, 107, .4); color: var(--red); }
button.danger:hover { background: var(--red); color: #fff; box-shadow: 0 8px 24px rgba(255, 107, 107, .3); }

button.small { padding: 6px 12px; font-size: 12px; border-radius: 4px; }

/* ============ 角色選擇格（前台 + 後台共用） ============ */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
  margin: 0 -4px;
}

.char-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  user-select: none;
  transition: transform var(--smooth), border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

.char-card:hover { transform: translateY(-3px); border-color: rgba(94, 224, 240, .45); background: var(--surface-2); }

/* 選中就發光，命座另外用角標表示 */
.char-card.on {
  border-color: var(--cyan);
  background: linear-gradient(160deg, rgba(94, 224, 240, .16), rgba(167, 139, 250, .1));
  box-shadow: 0 0 0 1px var(--cyan), 0 10px 28px var(--glow-cyan);
}

.char-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* 右上角角標：0 命只打勾，1 命以上才寫數字。點它取消 */
.count-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--cyan);
  color: #06141a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -.02em;
  box-shadow: 0 2px 12px var(--glow-cyan);
  cursor: pointer;
  transition: background var(--fast), transform var(--fast);
}

.count-badge.zero {
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  background: rgba(94, 224, 240, .9);
  font-size: 11px;
}

.count-badge:hover { background: var(--red); color: #fff; transform: scale(1.12); }

.char-card .avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(150deg, rgba(94, 224, 240, .14), rgba(167, 139, 250, .14));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.char-card .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 沒上傳圖片時顯示名字第一個字 */
.char-card .avatar .initial {
  font-size: 26px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
}

.char-card .cname {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--text-2);
  word-break: break-all;
}

.char-card.on .cname { color: #fff; }

.empty-note {
  grid-column: 1 / -1;
  color: var(--text-3);
  font-size: 13px;
  padding: 22px 0;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--r);
}

/* ============ 帳號卡片：一排一個 ============ */
.cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  transition: transform var(--smooth), border-color var(--fast), box-shadow var(--fast);
  overflow: hidden;
}

/* 卡片左上角的光暈，hover 才亮起來 */
.card::before {
  content: "";
  position: absolute;
  top: -60px;
  left: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--glow-cyan), transparent 68%);
  opacity: 0;
  transition: opacity var(--smooth);
  pointer-events: none;
}

.card:hover { transform: translateY(-4px); border-color: rgba(94, 224, 240, .38); box-shadow: var(--shadow-lift); }
.card:hover::before { opacity: 1; }

/* 卡片頂端：左邊資訊、右邊編碼 */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.card-head .head-left { flex: 1 1 300px; min-width: 0; }

.card .meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--cyan);
  text-transform: uppercase;
}

.card .title { margin: 2px 0 0; font-size: 19px; font-weight: 700; line-height: 1.35; }

.card .desc {
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* 帳號卡上的角色大方圖，橫排、角色多就左右滑 */
.char-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
}

.char-tile {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  scroll-snap-align: start;
}

.char-tile .pic {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(94, 224, 240, .16), rgba(167, 139, 250, .16));
  border: 1px solid var(--line);
  font-size: 30px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
  transition: border-color var(--fast), transform var(--smooth);
}

.char-tile:hover .pic { border-color: rgba(94, 224, 240, .55); transform: translateY(-2px); }

.char-tile .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 帳號卡上的命座數，0 命不標 */
.char-tile .qty {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(6, 20, 26, .86);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: none;
}

.char-tile .cname {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--text-2);
  word-break: break-all;
}

.char-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .04em;
}

.card .price {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .01em;
}

/* 編碼區 */
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 10px 12px;
  background: rgba(0, 0, 0, .32);
  border: 1px dashed rgba(61, 220, 154, .32);
  border-radius: var(--r);
}

.code-box .code {
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--green);
  text-shadow: 0 0 18px rgba(61, 220, 154, .45);
  overflow-wrap: anywhere;
}

.code-box button.copy {
  background: rgba(61, 220, 154, .12);
  border: 1px solid rgba(61, 220, 154, .4);
  color: var(--green);
}
.code-box button.copy:hover { background: var(--green); color: #04120b; box-shadow: 0 6px 20px rgba(61, 220, 154, .35); }
.code-box button.copy.done { background: var(--green); color: #04120b; }

/* 結果列 */
.count-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
  font-size: 13px;
  color: var(--text-3);
}

.count-bar strong { color: var(--text); font-size: 15px; font-weight: 700; }

/* ============ 提示訊息 ============ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 14px);
  background: rgba(13, 15, 26, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--cyan);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6), 0 0 0 1px var(--glow-cyan);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--smooth), transform var(--smooth);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--red); color: #ffc9c9; box-shadow: 0 12px 40px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 107, 107, .3); }

/* ============ 後台專用 ============ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 9px;
  font-size: 14px;
  transition: border-color var(--fast), background var(--fast);
}

.list-item:hover { border-color: rgba(94, 224, 240, .32); background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(94, 224, 240, .18), rgba(167, 139, 250, .18));
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  color: rgba(255, 255, 255, .55);
}
.list-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 分頁標籤 */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
  flex-wrap: wrap;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  width: fit-content;
}

.tabs button {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-weight: 600;
  padding: 9px 18px;
}
.tabs button:hover { color: var(--text); transform: none; box-shadow: none; }
.tabs button.on {
  background: linear-gradient(135deg, rgba(94, 224, 240, .18), rgba(167, 139, 250, .16));
  border: 1px solid rgba(94, 224, 240, .4);
  color: #fff;
}

.hidden { display: none !important; }

.login-box { max-width: 380px; margin: clamp(40px, 12vh, 110px) auto; }

/* 圖片上傳區 */
.upload-zone {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: rgba(0, 0, 0, .25);
  border: 1px dashed var(--line);
  border-radius: var(--r);
  transition: border-color var(--fast), background var(--fast);
}

.upload-zone:hover, .upload-zone.dragover { border-color: var(--cyan); background: rgba(94, 224, 240, .06); }

.upload-preview {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(94, 224, 240, .14), rgba(167, 139, 250, .14));
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  text-align: center;
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.upload-info { flex: 1; min-width: 0; }
.upload-info .tip { font-size: 12px; color: var(--text-3); margin-top: 6px; }

input[type="file"] { display: none; }

/* ============ 右下角客服聊天 ============ */
.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #071016;
  font-weight: 800;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .5), 0 0 26px var(--glow-cyan);
}

.chat-launcher-icon { font-size: 17px; line-height: 1; }
.chat-launcher.open .chat-launcher-text { display: none; }
.chat-launcher.has-unread { animation: nudge 1.6s ease-in-out infinite; }

@keyframes nudge {
  0%, 88%, 100% { transform: translateY(0); }
  92% { transform: translateY(-5px); }
  96% { transform: translateY(-2px); }
}

.chat-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 300;
  width: min(370px, calc(100vw - 32px));
  height: min(510px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: rgba(13, 15, 26, .97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: chat-in var(--smooth);
}

@keyframes chat-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(94, 224, 240, .12), rgba(167, 139, 250, .1));
}

.chat-head strong { font-size: 15px; }
.chat-head-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.chat-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 17px;
  line-height: 1;
}
.chat-close:hover { color: #fff; border-color: var(--cyan); transform: none; box-shadow: none; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg { display: flex; flex-direction: column; max-width: 82%; }
.chat-msg.from-me { align-self: flex-end; align-items: flex-end; }
.chat-msg.from-admin { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: 9px 13px;
  border-radius: var(--r);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.from-me .chat-bubble {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #071016;
  font-weight: 600;
  border-bottom-right-radius: 2px;
}

.from-admin .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

.chat-time { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

.chat-notice {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  background: rgba(255, 255, 255, .03);
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 9px 12px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
}

.chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 110px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  resize: none;
}

.chat-send { flex: 0 0 auto; padding: 10px 16px; }

@media (max-width: 480px) {
  .chat-launcher { right: 14px; bottom: 14px; padding: 11px 16px; }
  .chat-panel {
    right: 10px;
    left: 10px;
    bottom: 74px;
    width: auto;
    height: min(70vh, 460px);
  }
}

/* ============ 後台客服面板 ============ */
.chat-admin {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}

.chat-list { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }

.chat-list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: inherit;
  font-weight: 400;
}
.chat-list-item:hover { border-color: rgba(94, 224, 240, .45); transform: none; box-shadow: none; background: var(--surface-2); }
.chat-list-item.on { border-color: var(--cyan); background: rgba(94, 224, 240, .1); }

.chat-list-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chat-list-name { font-size: 13.5px; font-weight: 700; }
.chat-list-when { font-size: 11px; color: var(--text-3); flex: 0 0 auto; }
.chat-list-preview {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  height: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.chat-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.chat-thread-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 後台視角：客服自己的話靠右 */
.chat-thread-body .chat-msg.from-admin { align-self: flex-end; align-items: flex-end; }
.chat-thread-body .chat-msg.from-me { align-self: flex-start; align-items: flex-start; }
.chat-thread-body .from-admin .chat-bubble {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #071016;
  font-weight: 600;
  border: none;
}
.chat-thread-body .from-me .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 400;
}

@media (max-width: 820px) {
  .chat-admin { grid-template-columns: 1fr; }
  .chat-list { max-height: 260px; }
  .chat-thread { height: 440px; }
}

/* ============ 開箱抽獎 ============ */

/* 稀有度：越後面越稀有 */
.rarity-common  { --r-color: #8f9bb3; }
.rarity-rare    { --r-color: #4a9eff; }
.rarity-epic    { --r-color: #a855f7; }
.rarity-legend  { --r-color: #ec4899; }
.rarity-mythic  { --r-color: #f5b43c; }

/* ============ 開箱寶箱 ============
   按下開箱後先演這一段：鑰匙滑進鎖孔 → 轉動 → 箱身震動 → 掀蓋爆光，
   演完才輪到輪盤。時間軸寫在 draw.js 的 CHEST_STEPS，改動畫要兩邊一起改。 */
.chest-stage {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height .45s cubic-bezier(.2, .85, .25, 1),
    opacity .35s ease,
    margin-top .45s cubic-bezier(.2, .85, .25, 1);
}

.chest-stage.open { max-height: var(--chest-h, 300px); opacity: 1; margin-top: 22px; }

/* 開完箱收起來時，讓它往上縮不要硬切 */
.chest-stage.done { max-height: 0; opacity: 0; margin-top: 0; }

.chest-wrap { text-align: center; padding: 6px 0 2px; }

/* 箱子的尺寸都從這裡算，改一個數字整個立體結構會跟著對齊 */
.chest-scene {
  --cw: 168px;   /* 寬 */
  --ch: 92px;    /* 箱體高 */
  --cd: 108px;   /* 深 */
  --lh: 46px;    /* 箱蓋高 */
  position: relative;
  height: 236px;
  display: grid;
  place-items: center;
  perspective: 900px;
  perspective-origin: 50% 42%;
}

/* 所有子元素都用「原點在箱子正中心」來擺，寬高設 0 讓座標乾淨 */
.chest3d {
  position: relative;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(-16deg) rotateY(-22deg);
}

.cbox { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.face {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(140, 160, 200, .35);
  background: linear-gradient(180deg, #3d4761, #1d2231);
}

/* --- 箱體六面 --- */
.bf-front, .bf-back {
  width: var(--cw); height: var(--ch);
  left: calc(var(--cw) / -2); top: calc(var(--ch) / -2);
}
.bf-front { transform: translateZ(calc(var(--cd) / 2)); }
.bf-back  { transform: translateZ(calc(var(--cd) / -2)) rotateY(180deg); filter: brightness(.7); }

.bf-left, .bf-right {
  width: var(--cd); height: var(--ch);
  left: calc(var(--cd) / -2); top: calc(var(--ch) / -2);
}
.bf-left  { transform: rotateY(-90deg) translateZ(calc(var(--cw) / 2)); filter: brightness(.78); }
.bf-right { transform: rotateY(90deg) translateZ(calc(var(--cw) / 2)); filter: brightness(.88); }

.bf-bottom, .bf-inside {
  width: var(--cw); height: var(--cd);
  left: calc(var(--cw) / -2); top: calc(var(--cd) / -2);
}
.bf-bottom { transform: rotateX(-90deg) translateZ(calc(var(--ch) / 2)); filter: brightness(.5); }

/* 內襯：往下縮一點當作箱子內部的底，開蓋後看得到 */
.bf-inside {
  transform: rotateX(90deg) translateZ(calc(var(--ch) / 2 - 12px));
  background: radial-gradient(ellipse at 50% 45%, rgba(94, 224, 240, .5), #0a0d15 70%);
  border-color: rgba(94, 224, 240, .3);
}

/* 正面的金屬條和鎖 */
.band {
  position: absolute; top: 0; bottom: 0; width: 10px;
  background: linear-gradient(180deg, #59637f, #333c52);
  box-shadow: inset 0 0 0 1px rgba(160, 180, 220, .25);
}
.band.left { left: 16px; }
.band.right { right: 16px; }

.lock {
  position: absolute; left: 50%; top: 50%;
  width: 34px; height: 40px; margin: -22px 0 0 -17px;
  border-radius: 5px;
  background: linear-gradient(180deg, #6b7699, #414b66);
  box-shadow: inset 0 0 0 1px rgba(190, 205, 235, .45);
}
.keyhole {
  position: absolute; left: 50%; top: 12px;
  width: 11px; height: 11px; margin-left: -5.5px;
  border-radius: 50%;
  background: #0d1018;
  box-shadow: 0 8px 0 -2px #0d1018;   /* 下面那截鎖孔 */
}

/* --- 箱蓋：pivot 放在箱體後上緣，整個節點繞 X 軸翻開 --- */
.lid-pivot {
  position: absolute; left: 0; top: 0;
  transform-style: preserve-3d;
  transform: translateY(calc(var(--ch) / -2)) translateZ(calc(var(--cd) / -2));
}
.lid-pivot .cbox.lid {
  transform: translateY(calc(var(--lh) / -2)) translateZ(calc(var(--cd) / 2));
}

.lf-front, .lf-back {
  width: var(--cw); height: var(--lh);
  left: calc(var(--cw) / -2); top: calc(var(--lh) / -2);
  background: linear-gradient(180deg, #55608099, #39425c);
}
.lf-front { transform: translateZ(calc(var(--cd) / 2)); }
.lf-back  { transform: translateZ(calc(var(--cd) / -2)) rotateY(180deg); filter: brightness(.7); }

.lf-left, .lf-right {
  width: var(--cd); height: var(--lh);
  left: calc(var(--cd) / -2); top: calc(var(--lh) / -2);
  background: linear-gradient(180deg, #4d5773, #333c52);
}
.lf-left  { transform: rotateY(-90deg) translateZ(calc(var(--cw) / 2)); filter: brightness(.8); }
.lf-right { transform: rotateY(90deg) translateZ(calc(var(--cw) / 2)); filter: brightness(.9); }

.lf-top {
  width: var(--cw); height: var(--cd);
  left: calc(var(--cw) / -2); top: calc(var(--cd) / -2);
  transform: rotateX(90deg) translateZ(calc(var(--lh) / 2));
  background: linear-gradient(180deg, #636f92, #46506c);
}

/* --- 鑰匙：貼在正面鎖孔外一點的平面上 --- */
.key-pos {
  position: absolute; left: 0; top: 0;
  transform-style: preserve-3d;
  transform: translateY(-8px) translateZ(calc(var(--cd) / 2 + 12px));
}
.key-slide { position: absolute; left: 0; top: 0; transform: translateX(120px); opacity: 0; }
.key-spin  { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.key-shaft, .key-bit, .key-bow { position: absolute; background: #e3b23c; }
.key-shaft { left: 0; top: -3.5px; width: 62px; height: 7px; border-radius: 3px; }
.key-bit { border-radius: 2px; }
.key-bit.a { left: 5px; top: 3px; width: 7px; height: 12px; }
.key-bit.b { left: 18px; top: 3px; width: 7px; height: 8px; }
.key-bow {
  left: 60px; top: -15px; width: 30px; height: 30px;
  background: none; border: 6px solid #e3b23c; border-radius: 50%;
}

/* 開蓋時往上噴的光柱 */
.chest-beam {
  position: absolute;
  left: -46px; top: -210px;
  width: 92px; height: 200px;
  transform-origin: 50% 100%;
  background: linear-gradient(to top, rgba(94, 224, 240, .6), rgba(94, 224, 240, 0));
  filter: blur(7px);
  opacity: 0;
  pointer-events: none;
}

.chest-shadow {
  position: absolute;
  left: 50%; bottom: 20px;
  width: 190px; height: 22px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), transparent 70%);
  pointer-events: none;
}

.chest-caption {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-3);
  transition: color .3s;
}

/* --- 動畫本體，加上 .go 才跑 --- */
.chest-stage.go .chest3d {
  animation:
    chest3dIntro .7s cubic-bezier(.2, .9, .3, 1) 0s both,
    chest3dShake .42s ease-in-out 1.32s;
}
.chest-stage.go .key-slide { animation: key3dIn .6s cubic-bezier(.25, .9, .3, 1) .25s both; }
.chest-stage.go .key-spin  { animation: key3dTurn .38s cubic-bezier(.6, 0, .35, 1) .9s both; }
.chest-stage.go .keyhole   { animation: keyholeLit .5s ease-out 1.3s both; }
.chest-stage.go .lid-pivot { animation: lid3dOpen .55s cubic-bezier(.34, -.2, .3, 1.25) 1.82s both; }
.chest-stage.go .chest-beam { animation: beam3d .8s ease-out 1.95s both; }

/* 基礎角度要寫進每一格，不然會蓋掉 .chest3d 上的 transform 變成正面平視 */
@keyframes chest3dIntro {
  from { transform: rotateX(-16deg) rotateY(-40deg) scale(.86); opacity: .3; }
  to   { transform: rotateX(-16deg) rotateY(-22deg) scale(1); opacity: 1; }
}
@keyframes chest3dShake {
  0%, 100% { transform: rotateX(-16deg) rotateY(-22deg) translateX(0); }
  25% { transform: rotateX(-16deg) rotateY(-22deg) translateX(-4px); }
  50% { transform: rotateX(-16deg) rotateY(-22deg) translateX(4px); }
  75% { transform: rotateX(-16deg) rotateY(-22deg) translateX(-3px); }
}
@keyframes key3dIn {
  from { transform: translateX(120px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes key3dTurn {
  from { transform: rotate(0deg); }
  to   { transform: rotate(90deg); }
}
@keyframes keyholeLit {
  to { background: var(--cyan); box-shadow: 0 8px 0 -2px var(--cyan), 0 0 14px var(--cyan); }
}
/* 注意角度是正的：CSS 的 Y 軸朝下，負值會讓蓋子往下翻進箱體裡穿模。
   正 122 度才是以後上緣為軸往後仰開。 */
@keyframes lid3dOpen {
  from { transform: translateY(calc(var(--ch) / -2)) translateZ(calc(var(--cd) / -2)) rotateX(0deg); }
  to   { transform: translateY(calc(var(--ch) / -2)) translateZ(calc(var(--cd) / -2)) rotateX(122deg); }
}
@keyframes beam3d {
  0%   { opacity: 0; transform: scaleY(.15); }
  40%  { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1.2); }
}

/* 手機版把箱子縮小一點，免得撐爆版面 */
@media (max-width: 560px) {
  .chest-scene { --cw: 132px; --ch: 74px; --cd: 86px; --lh: 38px; height: 200px; }
}

/* 會暈的人直接跳過整段動畫，draw.js 也會把等待時間設成 0 */
@media (prefers-reduced-motion: reduce) {
  .chest-stage { transition: none; }
  .chest-stage.go .chest3d,
  .chest-stage.go .key-slide,
  .chest-stage.go .key-spin,
  .chest-stage.go .keyhole,
  .chest-stage.go .lid-pivot,
  .chest-stage.go .chest-beam { animation: none; }
}

/* 抽卡區：平常收起來，按下開箱才往上展開。
   高度用 max-height 做動畫，實際值由 JS 量好寫進 --stage-h。
   （不要改用 grid-template-rows 0fr→1fr：裡面的 .reel-frame 是寫死高度的，
   固定高度的格線項目不會被 0fr 軌道壓縮，收不起來。） */
.reel-stage {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(28px);
  margin-top: 0;
  transition:
    max-height .55s cubic-bezier(.2, .85, .25, 1),
    opacity .4s ease,
    transform .55s cubic-bezier(.2, .85, .25, 1),
    margin-top .55s cubic-bezier(.2, .85, .25, 1);
}

.reel-stage.open {
  max-height: var(--stage-h, 320px);
  opacity: 1;
  transform: translateY(0);
  margin-top: 22px;
}

/* 有些人會暈，尊重系統設定直接不做位移動畫 */
@media (prefers-reduced-motion: reduce) {
  .reel-stage { transition: none; transform: none; }
}

.reel-frame {
  position: relative;
  height: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%),
    rgba(0, 0, 0, .35);
}

.reel-track {
  display: flex;
  gap: 12px;
  height: 100%;
  align-items: center;
  padding: 0 4px;
  will-change: transform;
}

/* 中間的指針 */
.reel-pointer {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  z-index: 3;
  background: linear-gradient(180deg, transparent, var(--cyan) 12%, var(--cyan) 88%, transparent);
  box-shadow: 0 0 14px var(--cyan), 0 0 28px var(--glow-cyan);
  pointer-events: none;
}

.reel-pointer::before,
.reel-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
}
.reel-pointer::before { top: -1px; border-top-color: var(--cyan); }
.reel-pointer::after { bottom: -1px; border-bottom-color: var(--cyan); }

/* 兩側淡出，讓視線集中在中間 */
.reel-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  z-index: 2;
  pointer-events: none;
}
.reel-fade.left { left: 0; background: linear-gradient(90deg, var(--bg) 10%, transparent); }
.reel-fade.right { right: 0; background: linear-gradient(270deg, var(--bg) 10%, transparent); }

.reel-item {
  position: relative;
  flex: 0 0 120px;
  height: 132px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: linear-gradient(170deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  /* 底部一條粗色帶標稀有度，CS:GO 的招牌做法 */
  box-shadow: inset 0 -4px 0 var(--r-color);
  display: flex;
  align-items: flex-end;
}

.reel-item-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 118%, var(--r-color), transparent 62%);
  opacity: .34;
}

.reel-item-body { position: relative; width: 100%; padding: 10px; text-align: center; }

.reel-item-value {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--r-color);
  text-shadow: 0 0 16px var(--r-color);
}

.reel-item-name {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  line-height: 1.3;
}

/* 停下來之後中獎那張跳出來 */
.reel-track.celebrate .reel-item.is-winner {
  animation: winner-pop .55s cubic-bezier(.16,1,.3,1) both;
  border-color: var(--r-color);
  box-shadow: inset 0 -4px 0 var(--r-color), 0 0 0 2px var(--r-color), 0 0 40px var(--r-color);
}
.reel-track.celebrate .reel-item.is-winner .reel-item-glow { opacity: .85; }

@keyframes winner-pop {
  0% { transform: scale(1); }
  55% { transform: scale(1.14) translateY(-6px); }
  100% { transform: scale(1.07) translateY(-3px); }
}

/* ---- 結果 ---- */
.result-box {
  position: relative;
  text-align: center;
  padding: 26px 20px;
  border-radius: var(--r);
  border: 1px solid var(--r-color, var(--line));
  background: radial-gradient(circle at 50% 130%, color-mix(in srgb, var(--r-color, #666) 26%, transparent), transparent 68%);
  animation: result-in .45s cubic-bezier(.16,1,.3,1) both;
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--text-3);
  text-transform: uppercase;
}

.result-name {
  margin: 8px 0 0;
  font-size: clamp(24px, 4.5vw, 34px);
  font-weight: 900;
  color: var(--r-color, var(--text));
  text-shadow: 0 0 30px var(--r-color, transparent);
}

.result-box .code-box { display: inline-flex; }
.result-note { margin-top: 14px; font-size: 13px; color: var(--text-2); }

/* ---- 獎池一覽 ---- */
.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.prize-card {
  padding: 14px 12px;
  text-align: center;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--r-color);
  transition: transform var(--fast), border-color var(--fast);
}
.prize-card:hover { transform: translateY(-3px); border-color: var(--r-color); }
.prize-card.sold-out { opacity: .4; filter: grayscale(.7); }

.prize-value { font-size: 20px; font-weight: 900; color: var(--r-color); }
.prize-name { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.prize-chance { font-size: 11px; color: var(--text-3); margin-top: 7px; font-weight: 700; }

.status-tag {
  flex: 0 0 auto;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-tag.ok { background: rgba(61, 220, 154, .16); color: var(--green); border: 1px solid rgba(61, 220, 154, .4); }
.status-tag.bad { background: rgba(255, 107, 107, .14); color: var(--red); border: 1px solid rgba(255, 107, 107, .35); }
.status-tag.warn { background: rgba(245, 180, 60, .16); color: var(--gold, #f5b43c); border: 1px solid rgba(245, 180, 60, .4); }

/* ============ 我的折價券 ============ */
.coupon-list { display: flex; flex-direction: column; gap: 10px; }

.coupon-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--r-color, var(--green));
  border-radius: var(--r);
  background: var(--surface-2);
  transition: border-color .18s, transform .18s;
}
.coupon-item:hover { transform: translateX(2px); }
/* 用掉或過期的壓暗，一眼就知道不能用 */
.coupon-item.spent { opacity: .5; border-left-color: var(--text-3); }

.coupon-value {
  flex: 0 0 auto;
  min-width: 74px;
  font-size: 21px;
  font-weight: 900;
  color: var(--r-color, var(--green));
  letter-spacing: -.02em;
}
.coupon-item.spent .coupon-value { color: var(--text-3); text-decoration: line-through; }

.coupon-main { flex: 1; min-width: 0; }
.coupon-code {
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 14px;
  letter-spacing: .09em;
  color: var(--text-1);
  word-break: break-all;
}
.coupon-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); }

.coupon-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.coupon-actions .icon-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-3);
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.coupon-actions .icon-btn:hover { color: var(--text-1); border-color: var(--text-3); background: var(--surface); }
.coupon-actions .icon-btn.danger:hover { color: var(--red); border-color: rgba(255, 107, 107, .5); }
.coupon-actions .icon-btn.done { color: var(--green); border-color: rgba(61, 220, 154, .5); }

@media (max-width: 560px) {
  .coupon-item { flex-wrap: wrap; gap: 10px; }
  .coupon-value { min-width: 0; font-size: 19px; }
  .coupon-main { flex: 1 1 100%; order: 3; }
}

/* 後台：活動概況數字 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.stat-cell {
  padding: 14px;
  text-align: center;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.02em;
  background: linear-gradient(100deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.rarity-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--r-color);
  box-shadow: 0 0 10px var(--r-color);
}

/* 首頁的抽獎入口 */
.draw-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 22px;
  margin-bottom: 22px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(245, 180, 60, .35);
  background: linear-gradient(120deg, rgba(245, 180, 60, .12), rgba(236, 72, 153, .1));
}
.draw-banner strong { font-size: 16px; }
.draw-banner p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.draw-banner .btn-wrap { flex: 0 0 auto; }

@media (max-width: 640px) {
  .reel-frame { height: 150px; }
  .reel-item { flex-basis: 108px; height: 118px; }
  .reel-fade { width: 52px; }
}

/* 骨架載入 */
.skeleton {
  border-radius: var(--r-lg);
  height: 216px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

.mono { font-family: "SF Mono", "Consolas", "Menlo", monospace; letter-spacing: .1em; color: var(--green); }

/* ============ 響應式 ============ */
@media (max-width: 640px) {
  .topbar .sub { display: none; }
  .card { padding: 18px 16px; }
  .card .title { font-size: 17px; }
  .code-box { width: 100%; justify-content: space-between; }
  .char-tile, .char-tile .pic { flex-basis: 84px; width: 84px; }
  .char-tile .pic { height: 84px; }
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 9px 10px; font-size: 13px; }
}

/* 尊重使用者的減少動態設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
