body {
  font-family: 'Segoe UI', system-ui, 'Microsoft JhengHei', Arial, sans-serif;
  background-color: var(--wx-bg);
  color: var(--wx-text);
  margin: 0;
  padding: 0;
}

/* ====== 版面容器 ====== */
.deck-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 4px solid var(--wx-accent);
}

/* ====== 牌組資訊卡 ====== */
.deck-hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  background: rgba(22, 25, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  margin-bottom: 36px;
}
.deck-hero__cover {
  flex: 0 0 230px;
  max-width: 230px;
}
.deck-hero__cover img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: block;
}
.deck-hero__info {
  flex: 1;
  min-width: 0;
}
.deck-title {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 16px;
  color: #fff;
  word-break: break-word;
}

/* stat 數據 chip */
.deck-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: var(--wx-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 18px;
}
.stat__num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f1f5f9;          /* 亮白 */
  line-height: 1;
}
.stat__label {
  font-size: 0.85rem;
  color: #94a3b8;
}
/* 價格那格：日元小字用金做點綴 */
.stat--price .stat__label {
  color: var(--wx-gold);
  font-weight: 600;
}

/* 思路分享 */
.deck-idea-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 22px;
}
.deck-idea-block h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: #cbd5e1;
}
#deck-idea {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 操作按鈕 */
.deck-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.deck-btn {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.deck-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
/* 極簡中性：按鈕一律深灰，只有主要動作「抄牌」用金色強調 */
.deck-btn--back   { background: #2a2f3e; color: var(--wx-text); }
.deck-btn--export { background: #2a2f3e; color: var(--wx-text); }
.deck-btn--copy   { background: linear-gradient(135deg, var(--wx-gold), #d97706); color: #1a1a1a; }
.deck-btn--comment {
  background: linear-gradient(135deg, var(--wx-gold), #d97706);
  color: #1a1a1a;
  margin-top: 10px;
}

/* ====== 牌組統計 ====== */
.deck-stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.stats-block {
  background: rgba(22, 25, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
}
.stats-h { font-size: 0.95rem; font-weight: 700; margin: 0 0 14px; color: #cbd5e1; }
/* 費用曲線 */
.cost-curve { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.cc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.cc-n { font-size: 0.8rem; font-weight: 800; color: #f1f5f9; }
.cc-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.cc-bar { width: 100%; min-height: 3px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--wx-gold), #d97706); }
.cc-k { font-size: 0.78rem; color: #94a3b8; }
/* 分布條 */
.dist-list { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.dist-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.dist-label { width: 28px; color: #cbd5e1; flex: 0 0 auto; }
.dist-label--wide { width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-track { flex: 1; height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.dist-fill { height: 100%; border-radius: 6px; }
.dist-n { width: 22px; text-align: right; color: #f1f5f9; font-weight: 700; flex: 0 0 auto; }

@media (max-width: 768px) {
  .deck-stats-panel { grid-template-columns: 1fr; }
  .cost-curve { height: 90px; }
}

/* ====== 卡片網格 ====== */
.deck-cards { margin-bottom: 40px; }
.deck-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 14px;
}
.deck-card {
  position: relative;
  aspect-ratio: 59 / 86;
  background-color: #1a1d2e;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.deck-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6);
  z-index: 2;
}
.deck-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 隱藏 JS 產生的名稱/能量文字，保持乾淨卡圖（保留數量、價格、缺貨、備註徽章） */
.deck-card > div:not(.card-count):not(.card-price):not(.card-soldout):not(.card-note) { display: none; }
/* 缺貨徽章：先隱藏（避免與右上角價格重疊；封面星號改放左上角） */
.deck-card .card-soldout { display: none; }
/* 單價徽章（移到右上角，把左上角讓給封面星號） */
.deck-card .card-price {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: rgba(13, 15, 26, 0.9);
  color: var(--wx-gold);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 2;
}
.deck-card .card-count {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background-color: rgba(13, 15, 26, 0.9);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 2;
}

/* ====== 備註模式 ====== */
/* 卡圖底部備註徽章（平常隱藏，備註模式才顯示；空備註自動不顯示） */
.deck-card .card-note {
  display: none;
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background-color: rgba(13, 15, 26, 0.92);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 備註模式：顯示備註欄（含空欄，方便點擊輸入）、價格隱藏、數量(x4)移到左上 */
.deck-container.note-mode .card-note { display: block; cursor: text; }
.deck-container.note-mode .card-note:focus {
  outline: none;
  border-color: var(--wx-accent);
  background-color: rgba(13, 15, 26, 0.98);
  white-space: normal; /* 編輯時可換行，不裁切 */
}
/* 空備註欄：虛線框 + placeholder 提示，引導點擊輸入 */
.deck-container.note-mode .card-note:empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.35);
  background-color: rgba(13, 15, 26, 0.55);
}
.deck-container.note-mode .card-note:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}
.deck-container.note-mode .card-price { display: none; }
.deck-container.note-mode .card-soldout { display: none; }
.deck-container.note-mode .card-count {
  top: 6px;
  left: 6px;
  right: auto;
  bottom: auto;
}
/* 截圖輸出時：只呈現已填的備註（隱藏空欄的虛線框/placeholder） */
.deck-container.exporting .card-note:empty { display: none; }
/* 備註模式輸出：省略統計面板/總金額，騰出空間把卡圖放大 */
.deck-container.note-mode.exporting {
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
}
/* 卡圖放大後，備註框也跟著加大才協調 */
.deck-container.note-mode.exporting .card-note {
  font-size: 1.15rem;
  padding: 6px 8px;
  bottom: 8px;
  left: 8px;
  right: 8px;
  border-radius: 10px;
}

.deck-btn--note { background: #2a2f3e; color: var(--wx-text); }
.deck-btn--note.is-active { background: var(--wx-accent); color: #fff; }

/* 備註模式操作提示橫幅 */
.note-hint {
  display: none;
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(233, 69, 96, 0.12);
  border: 1px solid rgba(233, 69, 96, 0.4);
  color: #f1f5f9;
  font-size: 0.88rem;
  line-height: 1.6;
}
.note-hint b { color: var(--wx-gold); }

/* ====== 留言區 ====== */
.comments-section {
  background: rgba(22, 25, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px 28px;
}
#comment-count { color: #94a3b8; font-size: 0.9rem; margin: 0 0 12px; }
#comments-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
#comments-list li {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 0.92rem;
}
#comments-list li strong { color: var(--wx-accent2); }
#comments-list li em { color: var(--wx-muted); font-size: 0.8rem; }
#comment-form { display: flex; flex-direction: column; }
#commentInput {
  width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  padding: 12px 14px;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--wx-bg);
  color: var(--wx-text);
  resize: vertical;
}
#commentInput:focus { outline: none; border-color: var(--wx-accent2); }
#comment-form .deck-btn { align-self: flex-start; }

/* ====== 卡片詳細 Modal（沿用） ====== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}
.modal-content {
  display: flex;
  background: #16192a;
  border-radius: 12px;
  padding: 0;
  width: 95%;
  max-width: 1000px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  position: relative;
}
.modal-left {
  flex: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #2a2e44;
}
.modal-left img { max-width: 100%; height: auto; border-radius: 8px; }
.modal-right { flex: 2; padding: 20px; color: var(--wx-text); }
.modal-right h3 { font-size: 24px; margin-bottom: 15px; color: #fff; }
.modal-right p { font-size: 16px; margin: 5px 0; }
.modal-right hr { border: 0; border-top: 1px solid #2a2e44; margin: 15px 0; }
.close-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: #ff5c5c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 35px; height: 35px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}
.close-btn:hover { background: #ff3b3b; }

/* ====== 響應式 ====== */
@media (max-width: 768px) {
  .deck-hero { flex-direction: column; align-items: center; text-align: center; padding: 20px; }
  .deck-hero__cover { flex-basis: auto; max-width: 200px; }
  .deck-stats, .deck-actions { justify-content: center; }
  .deck-title { font-size: 1.5rem; }
  .deck-container { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
  .deck-container.note-mode.exporting { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .modal-content { flex-direction: column; max-height: 85%; overflow-y: auto; }
}

/* 牌組詳情：擁有者可點卡左上星號設封面（☆ 設為封面 / ★ 目前封面） */
.deck-card .deck-cover-star {
  position: absolute; top: 4px; left: 4px; z-index: 6;
  width: 24px; height: 24px; padding: 0; line-height: 1;
  border: none; border-radius: 6px; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #cbd5e1; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
.deck-card .deck-cover-star:hover { background: rgba(0, 0, 0, .82); color: var(--wx-gold); transform: scale(1.12); }
.deck-card .deck-cover-star.is-cover { background: var(--wx-gold); color: #1e293b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .4); }
