/* 首頁上半部改版（2026-11-26）：頂部導覽列、開場區、功能入口。
 * 類別一律加 home- 前綴，不影響組牌區與目前牌組（那兩塊維持原版，只在 input-overrides.css 微調排版）。 */
:root{
  --home-ink:#16141c;
  --home-ink-2:#4a4654;
  --home-ink-3:#69636f;
  --home-accent:#d81f5f;
  --home-accent-ink:#b0164c;
  --home-line:#ddd5c6;
  --home-line-strong:#c9bfad;
  --home-surface:#fffdf9;
  --home-sunken:#efe9de;
  --home-shadow-1:0 1px 2px rgba(22,20,28,.06),0 2px 8px rgba(22,20,28,.05);
  --home-shadow-2:0 2px 4px rgba(22,20,28,.06),0 12px 32px rgba(22,20,28,.10);
  --home-ease:cubic-bezier(.16,1,.3,1);
  --home-serif:"Noto Serif TC","Noto Sans TC","Microsoft JhengHei",serif;
}
.home-icon{width:20px;height:20px;flex:none;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* ===== 頂部導覽列 ===== */
.home-topbar{position:sticky;top:0;z-index:30;background:rgba(245,241,232,.94);border-bottom:1px solid var(--home-line)}
.home-topbar-inner{display:flex;align-items:center;gap:28px;width:min(1440px,100%);height:64px;margin:auto;padding:0 clamp(18px,4vw,64px)}
.home-logo img{display:block;height:36px;width:auto}
.home-nav{display:flex;gap:4px;margin-right:auto}
.home-nav a{padding:8px 12px;border-radius:8px;color:var(--home-ink-2);font-size:14px;font-weight:700;text-decoration:none;transition:background .2s var(--home-ease),color .2s var(--home-ease)}
.home-nav a:hover{background:var(--home-sunken);color:var(--home-ink)}
.home-nav a[aria-current]{color:var(--home-ink);border-radius:0;box-shadow:inset 0 -2px 0 var(--home-accent)}
.home-member{display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:4px 16px 4px 12px;border:1px solid var(--home-line-strong);border-radius:8px;background:var(--home-surface);color:var(--home-ink);text-decoration:none;transition:border-color .2s var(--home-ease)}
.home-member:hover{border-color:var(--home-ink)}
.home-member-icon{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--home-ink);color:#fff;font-size:14px;line-height:1}
.home-member-text{display:flex;flex-direction:column;line-height:1.2;min-width:0}
.home-member-text small{color:var(--home-accent-ink);font-size:11px;font-weight:700}
.home-member-text small:empty{display:none}
.home-member-text span{max-width:12em;overflow:hidden;font-size:14px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}

/* ===== 開場區 ===== */
.home-intro{display:grid;grid-template-columns:1.1fr .9fr;gap:48px;align-items:center;padding:48px clamp(0px,2vw,24px) 36px}
.home-format{display:inline-flex;align-items:center;gap:8px;margin-bottom:16px;color:var(--home-ink-2);font-size:13px;font-weight:700}
.home-format::before{content:"";width:8px;height:8px;border-radius:50%;background:#2f7a2a}
.home-title{margin:0 0 16px;color:var(--home-ink);font:900 clamp(30px,3.6vw,46px)/1.2 var(--home-serif);letter-spacing:-.02em;text-wrap:balance}
.home-title em{color:var(--home-accent-ink);font-style:normal}
.home-lead{max-width:34em;margin:0 0 26px;color:var(--home-ink-2);font-size:16px;line-height:1.7}
.home-actions{display:flex;flex-wrap:wrap;gap:12px}
.home-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:48px;padding:0 22px;border:1px solid transparent;border-radius:8px;font-family:inherit;font-size:15px;font-weight:700;text-decoration:none;cursor:pointer;transition:background .2s var(--home-ease),border-color .2s var(--home-ease)}
.home-btn--accent{background:var(--home-accent);color:#fff}
.home-btn--accent:hover{background:var(--home-accent-ink)}
.home-btn--ghost{border-color:var(--home-line-strong);background:var(--home-surface);color:var(--home-ink)}
.home-btn--ghost:hover{border-color:var(--home-ink)}
.home-fan{position:relative;height:300px}
/* 卡圖還沒載入或載入失敗時，開場區改單欄 */
.home-fan:empty{display:none}
.home-intro:has(.home-fan:empty){grid-template-columns:1fr}
.home-fan a{position:absolute;top:50%;left:50%;width:180px;border-radius:9px;overflow:hidden;box-shadow:var(--home-shadow-2);transition:transform .45s var(--home-ease)}
.home-fan img{display:block;width:100%;aspect-ratio:300/438;object-fit:cover;background:var(--home-sunken)}
.home-fan a:nth-child(1){transform:translate(-112%,-46%) rotate(-9deg)}
.home-fan a:nth-child(2){z-index:2;transform:translate(-50%,-54%)}
.home-fan a:nth-child(3){transform:translate(12%,-46%) rotate(9deg)}
.home-fan a:nth-child(1):hover{transform:translate(-112%,-50%) rotate(-9deg)}
.home-fan a:nth-child(2):hover{transform:translate(-50%,-58%)}
.home-fan a:nth-child(3):hover{transform:translate(12%,-50%) rotate(9deg)}
.home-fan-note{position:absolute;right:0;bottom:-26px;margin:0;left:0;color:var(--home-ink-3);font-size:12px;text-align:center}

/* ===== 功能入口 ===== */
.home-features{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:16px}
.home-tile{position:relative;display:flex;flex-direction:column;justify-content:flex-end;min-height:200px;padding:22px;overflow:hidden;border-radius:16px;color:#fff;text-decoration:none;background:var(--tile-bg,#1c1a24);isolation:isolate;transition:transform .3s var(--home-ease),box-shadow .3s var(--home-ease)}
.home-tile:hover{transform:translateY(-3px);box-shadow:var(--home-shadow-2)}
.home-tile:focus-visible{outline:3px solid var(--home-accent);outline-offset:3px}
.home-tile h2{margin:0 0 6px;font:900 24px/1.25 var(--home-serif)}
.home-tile p{max-width:26em;margin:0;color:rgba(255,255,255,.86);font-size:14px;line-height:1.6}
.home-tile-tag{position:absolute;top:18px;left:22px;padding:4px 10px;border-radius:99px;background:rgba(255,255,255,.18);font-size:12px;font-weight:700}
/* 四個入口的原創美術圖（Codex 製作，2026-11-26）：主體在上半部中間，下方暗色區疊文字 */
.home-tile--top,.home-tile--battle,.home-tile--tutorial,.home-tile--cardlist{background-position:center 22%;background-size:cover;background-repeat:no-repeat}
.home-tile--top{--tile-bg:#140a1b url("img/home/feature-top-decks.webp")}
.home-tile--battle{--tile-bg:#120817 url("img/home/feature-battle.webp")}
.home-tile--tutorial{--tile-bg:#120c19 url("img/home/feature-tutorial.webp")}
.home-tile--cardlist{--tile-bg:#0f0617 url("img/home/feature-cardlist.webp")}

/* 我的牌組：沿用原本的輪播牆 */
#myDeckCarousel.home-mydecks{grid-row:span 2;justify-content:space-between;min-height:432px;padding:22px 0 16px;background:radial-gradient(120% 80% at 50% 55%,#2d2440 0%,#17141f 70%)}
#myDeckCarousel.home-mydecks:hover{transform:none;box-shadow:none}
.home-mydecks-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:0 22px}
.home-mydecks-head h2{margin:0}
.home-mydecks-head a{display:inline-flex;align-items:center;gap:4px;color:#ece6f3;font-size:14px;font-weight:700;text-decoration:none}
.home-mydecks-head a:hover{color:#fff}
.home-mydecks-head .home-icon{width:16px;height:16px}
#myDeckCarousel .mdc-stage{flex:1;height:auto;min-height:260px;touch-action:pan-y}
#myDeckCarousel .mdc-card{width:170px;height:248px;margin:-124px 0 0 -85px;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.5)}
#myDeckCarousel .mdc-card-name{padding:32px 8px 10px;font-size:14px}
#myDeckCarousel .mdc-card-price{font-size:12px}
#myDeckCarousel .mdc-dots{padding-top:4px}
#myDeckCarousel .mdc-dot{width:7px;height:7px;background:rgba(255,255,255,.3)}
#myDeckCarousel .mdc-dot.active{background:#fff}
.home-mydecks-empty{display:none;flex:1;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:24px;text-align:center}
.home-mydecks-empty p{max-width:22em;margin:0;color:#e4dded;font-size:15px;line-height:1.7}
.home-mydecks-empty .home-btn{height:44px}
#myDeckCarousel[data-state="guest"] .home-mydecks-empty--guest,
#myDeckCarousel[data-state="empty"] .home-mydecks-empty--none{display:flex}
#myDeckCarousel:not([data-state="decks"]) .mdc-stage,
#myDeckCarousel:not([data-state="decks"]) .mdc-dots,
#myDeckCarousel:not([data-state="decks"]) .home-mydecks-all{display:none}

/* 其他功能：一排小連結 */
.home-more{display:grid;grid-template-columns:repeat(6,1fr);margin-top:16px;overflow:hidden;border:1px solid var(--home-line);border-radius:16px;background:var(--home-surface)}
.home-more>a,.home-more>button{display:flex;flex-direction:column;gap:10px;min-width:0;padding:18px 16px;border:0;border-right:1px solid var(--home-line);background:none;color:var(--home-ink);font-family:inherit;font-size:14px;font-weight:700;text-align:left;text-decoration:none;cursor:pointer;transition:background .2s var(--home-ease)}
.home-more>:last-child{border-right:0}
.home-more>a:hover,.home-more>button:hover{background:var(--home-sunken)}
.home-more .home-icon{color:var(--home-accent-ink)}
.home-more small{display:block;margin-top:2px;color:var(--home-ink-3);font-size:12px;font-weight:400}
.home-more .price-wave-count{color:var(--home-accent-ink)}

.home-mode-switch{margin-top:48px}

@media (prefers-reduced-motion:reduce){.home-tile,.home-fan a,.home-nav a{transition:none}}

/* ===== 平板 ===== */
@media (max-width:1080px){
  .home-intro{grid-template-columns:1fr}
  .home-fan{display:none}
  .home-features{grid-template-columns:1fr 1fr}
  #myDeckCarousel.home-mydecks{grid-column:1/-1;grid-row:auto;min-height:360px}
  .home-more{grid-template-columns:repeat(3,1fr)}
  .home-more>:nth-child(3){border-right:0}
  .home-more>:nth-child(-n+3){border-bottom:1px solid var(--home-line)}
}
@media (max-width:860px){.home-nav{display:none}.home-logo{margin-right:auto}}
/* ===== 手機 ===== */
@media (max-width:640px){
  .home-topbar-inner{height:56px;gap:12px}
  .home-logo img{height:30px}
  .home-member{min-height:38px;padding:3px 12px 3px 8px}
  .home-member-text span{max-width:8em;font-size:13px}
  .home-intro{padding:28px 0 22px}
  .home-lead{margin-bottom:20px;font-size:15px}
  .home-actions .home-btn{flex:1}
  .home-features{grid-template-columns:1fr;gap:12px}
  .home-tile{min-height:128px;padding:18px}
  .home-tile h2{font-size:21px}
  /* 手機區塊比較扁：圖案貼齊上緣、文字放在圖案下方，避免疊在一起 */
  .home-tile--top,.home-tile--battle,.home-tile--tutorial,.home-tile--cardlist{min-height:196px;background-size:100% auto;background-position:center -16px}
  #myDeckCarousel.home-mydecks{min-height:320px;padding:18px 0 12px}
  #myDeckCarousel.home-mydecks:not([data-state="decks"]){min-height:210px}
  .home-mydecks-head{padding:0 18px}
  #myDeckCarousel .mdc-stage{min-height:220px}
  #myDeckCarousel .mdc-card{width:136px;height:198px;margin:-99px 0 0 -68px}
  .home-more{grid-template-columns:1fr 1fr}
  .home-more>a,.home-more>button{flex-direction:row;align-items:center;gap:12px;padding:14px;border-bottom:1px solid var(--home-line)}
  .home-more>:nth-child(odd){border-right:1px solid var(--home-line)}
  .home-more>:nth-child(even){border-right:0}
  .home-more>:nth-last-child(-n+2){border-bottom:0}
  .home-mode-switch{margin-top:32px}
}
