/* 參考競選主視覺：看板主色黃、粗黑大字、留白的減法美學 */
:root {
  --yellow: #ffc928;
  --sky: #5eaeec;       /* 晴空藍：本頁主色 */
  --sky-l: #eaf6fd;
  --ink: #1b2c52;
  --ink-2: #5a6685;
  --line: #e3e0d6;
  --bg: #f7f5ef;
  --panel: #ffffff;
  --strong: #1b2c52;
  --on-strong: #ffc928;
  --hero-ink: #1b2c52;
  --poster: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-family: "Huninn", var(--poster);
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; padding-top: var(--bar-h, 46px); background: linear-gradient(180deg, #dff1fb 0, #fff9e6 640px) var(--bg); line-height: 1.55; }
h1, h2, .num, .lede { font-family: var(--poster); }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* 頁首：滿版黃 */
.hero { background: var(--sky); color: var(--hero-ink); position: relative; overflow: hidden; padding: 14px 0 44px; border-bottom: 3px solid #1b2c52; }
.hero h1 { font-size: clamp(40px, 7vw, 76px); line-height: 1.12; margin: 28px 0 14px; font-weight: 900; letter-spacing: -.01em; position: relative; z-index: 1; }
.hl { background: linear-gradient(transparent 62%, #fff 62%, #fff 92%, transparent 92%); }
.lede { margin: 0; font-weight: 500; font-size: 17px; max-width: 34em; position: relative; z-index: 1; }
.hero-motif { position: absolute; right: max(16px, calc(50% - 590px)); bottom: 8px; width: min(420px, 55vw); color: rgba(255, 255, 255, .55); }

.friend {
  margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  border: 3px solid var(--sky); border-radius: 22px; background: var(--panel); padding: 14px 16px; max-width: 1148px;
}
.friend[hidden] { display: none; }

/* 主版面 */
.maker { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; margin-top: 32px; align-items: start; }
.steps { min-width: 0; }
.step { padding: 0 0 36px; }
.step h2 {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  font-size: 22px; font-weight: 900; margin: 0 0 16px; padding-top: 14px; border-top: 4px solid var(--sky);
}
.num { font-size: 44px; line-height: 1; font-weight: 900; color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.count { font-weight: 500; color: var(--ink-2); font-size: 16px; }
.hint { margin: -8px 0 14px; color: var(--ink-2); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 15px;
  transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--strong); border-color: var(--strong); color: var(--on-strong); }
.chip.swatch::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
  background: var(--swatch-bg); border: 2px solid var(--swatch-ink);
}
.tabs { display: flex; gap: 0; overflow-x: auto; margin-bottom: 14px; border-bottom: 1.5px solid var(--line); scrollbar-width: thin; }
.tabs .chip { flex: none; border: 0; border-bottom: 4px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--ink-2); }
.tabs .chip.active { color: var(--ink); border-bottom-color: var(--sky); background: none; }

/* 身份 */
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role {
  text-align: left; cursor: pointer; border: 1.5px solid var(--line); background: var(--panel);
  border-radius: 14px; padding: 14px 16px; transition: border-color .12s, background .12s;
}
.role:hover { border-color: var(--ink); }
.role b { display: block; font-size: 18px; font-weight: 900; }
.role small { color: var(--ink-2); font-size: 13px; }
.role.active { background: var(--sky); border-color: var(--sky); color: #1b2c52; }
.role.active small { color: rgba(27, 44, 82, .7); }

/* 政見列 */
.policies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pol { position: relative; }
.pol-main {
  width: 100%; height: 100%; text-align: left; cursor: pointer; display: block;
  border: 1.5px solid var(--line); background: var(--panel); border-radius: 14px;
  padding: 12px 56px 14px 16px; transition: border-color .12s, opacity .12s;
}
.pol-main:hover { border-color: var(--ink); }
.pol.picked .pol-main { border-color: var(--ink); box-shadow: inset 6px 0 0 var(--sky); }
.pol.full .pol-main { opacity: .45; }
.pol-cat { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: .05em; }
.pol-text b { display: block; font-size: 17px; font-weight: 900; line-height: 1.35; }
.pol-stat { display: inline-block; font-weight: 900; font-size: 14px; background: var(--strong); color: var(--on-strong); padding: 1px 8px; margin: 4px 0; }
.pol-text small { display: block; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.pol-check {
  position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 13px; font-weight: 900; pointer-events: none;
}
.pol.picked .pol-check { background: var(--sky); border-color: var(--sky); color: #1b2c52; }
.pol-src { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.pol-src:hover { color: var(--ink); }

/* 選填 */
.field { margin-bottom: 18px; }
.label { display: block; font-weight: 900; margin-bottom: 8px; font-size: 15px; }
.field input { width: 100%; max-width: 440px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 14px; padding: 10px 14px; font-size: 16px; }
.field input:focus { outline: 3px solid var(--sky); border-color: var(--ink); }
.small-note { display: block; font-size: 12px; color: var(--ink-2); margin-top: 4px; }

/* 預覽：深色面板 */
.preview { position: sticky; top: 16px; }
.preview-inner { background: #fff; color: var(--ink); padding: 22px; border-radius: 22px; border: 3px solid var(--sky); box-shadow: 0 8px 0 #9ccbee, 0 14px 28px rgba(27, 127, 184, .18); }
.canvas-box { margin: 0 auto; max-width: 330px; }
.canvas-box[data-format="story"] { max-width: 250px; }
.canvas-box[data-format="square"] { max-width: 356px; }
#card { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 12px 32px rgba(27, 44, 82, .3); }
.status { text-align: center; font-weight: 900; margin: 16px 0; }
.status.ready { color: var(--site-sea, #1b7fb8); }

.share { display: grid; gap: 8px; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-row.social { grid-template-columns: repeat(4, 1fr); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid #d5eaf8; background: #fff; color: var(--ink); border-radius: 999px;
  padding: 11px 14px; cursor: pointer; text-decoration: none; font-size: 15px; letter-spacing: .03em;
  box-shadow: 0 3px 0 #9ccbee, 0 5px 10px rgba(27, 127, 184, .15); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #9ccbee; }
.btn.primary { background: linear-gradient(180deg, #ffdb5c, #ffc928); color: #1b2c52; font-size: 18px; padding: 13px; box-shadow: 0 5px 0 #d99a00, 0 8px 16px rgba(217, 154, 0, .3); }
.btn.primary:active { box-shadow: 0 1px 0 #d99a00; }
.btn.small { padding: 6px 14px; font-size: 14px; }
.friend .btn, .mobile-bar .btn:not(.primary) { color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; border: 2px dashed #1b7fb8; color: #1b7fb8; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.sns { font-size: 14px; padding: 10px 4px; }
.tip { font-size: 12.5px; color: #3d5a6b; margin: 14px 0 0; line-height: 1.65; }

.mobile-bar { display: none; }

/* 友站：台南應援 */
.ally {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 32px; padding: 18px 20px; background: var(--panel); border: 3px solid var(--sky); border-radius: 22px; box-shadow: 0 5px 0 #9ccbee;
}
.ally div { display: flex; flex-direction: column; gap: 4px; }
.ally strong { font-size: 20px; font-weight: 900; }
.ally div > span:last-child { color: var(--ink-2); font-size: 14px; }
.ally-tag { align-self: flex-start; background: var(--yellow); color: #1b2c52; font-weight: 900; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.ally .btn { color: var(--ink); text-decoration: none; }
.ally.wrap { width: calc(100% - 32px); }
.ally + .ally { margin-top: 12px; }

.foot { padding: 24px 16px 100px; color: var(--ink-2); font-size: 14px; border-top: 3px solid var(--ink); margin-top: 24px; }
.foot strong { color: var(--ink); }
.foot ul { columns: 2; padding-left: 18px; }
.foot li { margin-bottom: 4px; break-inside: avoid; }
.foot summary { cursor: pointer; font-weight: 900; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 20px); opacity: 0; border-radius: 999px;
  background: var(--yellow); color: #1b2c52; padding: 10px 18px; font-weight: 900; border: 2px solid #1b2c52;
  pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, a:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

@media (max-width: 980px) {
  .maker { grid-template-columns: 1fr; gap: 8px; }
  .preview { position: static; margin: 0 -16px; }
  .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobile-bar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 10; border-radius: 999px;
    justify-content: space-between; align-items: center; gap: 12px;
    background: #1b2c52; color: #fff; padding: 10px 10px 10px 18px; font-weight: 900;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: transform .2s, opacity .2s;
  }
  .mobile-bar.hide { transform: translateY(130%); opacity: 0; pointer-events: none; }
}
@media (max-width: 640px) {
  .hero { padding-bottom: 72px; }
  .lede { font-size: 15px; }
  .policies { grid-template-columns: 1fr; }
  .foot ul { columns: 1; }
  .chip { padding: 6px 11px; font-size: 14px; }
}

/* 卡片版型選擇 */
.templates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tpl {
  text-align: left; cursor: pointer; border: 1.5px solid var(--line); background: var(--panel);
  border-radius: 14px; padding: 12px; transition: border-color .12s;
}
.tpl:hover { border-color: var(--ink); }
.tpl b { display: block; font-size: 17px; font-weight: 900; margin-top: 10px; }
.tpl small { color: var(--ink-2); font-size: 13px; line-height: 1.4; display: block; }
.tpl.active { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
/* 縮圖：用色塊示意各版型 */
.tpl-thumb { display: grid; gap: 4px; aspect-ratio: 4 / 5; background: var(--yellow); padding: 10px; align-content: start; }
.tpl-thumb i { display: block; background: #1b2c52; height: 6px; }
.tpl-list .tpl-thumb i { height: 10px; box-shadow: 0 14px 0 -2px rgba(27,44,82,.35); margin-bottom: 14px; }
.tpl-list .tpl-thumb i:first-child { width: 70%; }
.tpl-spotlight .tpl-thumb i:nth-child(1) { width: 40%; }
.tpl-spotlight .tpl-thumb i:nth-child(2) { height: 34px; margin-top: 14px; }
.tpl-spotlight .tpl-thumb i:nth-child(3) { width: 80%; height: 10px; }
.tpl-voice .tpl-thumb i:nth-child(1) { width: 24px; height: 18px; background: #fff; }
.tpl-voice .tpl-thumb i:nth-child(2) { height: 30px; margin-top: 6px; }
.tpl-voice .tpl-thumb i:nth-child(3) { width: 50%; }
.tpl-countdown .tpl-thumb i:nth-child(1) { width: 60%; }
.tpl-countdown .tpl-thumb i:nth-child(2) { width: 55%; height: 44px; margin-top: 6px; }
.tpl-countdown .tpl-thumb i:nth-child(3) { width: 90%; margin-top: 12px; }
.field[hidden] { display: none; }
.step .field .roles { margin-top: 0; }
@media (max-width: 640px) {
  .templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.friend.wrap { width: calc(100% - 32px); }
@media (max-width: 640px) {
  .tpl-thumb { aspect-ratio: 4 / 3; }
}
/* 桌機：預覽固定在畫面上，卡片高度跟著視窗縮放，避免限動尺寸超出畫面 */
@media (min-width: 981px) {
  .canvas-box { max-width: none; display: flex; justify-content: center; }
  .canvas-box[data-format] { max-width: none; }
  #card { width: auto; max-width: 100%; max-height: calc(100vh - 400px); min-height: 300px; }
}

/* 已選的政見 */
.picked { margin-bottom: 16px; border: 1.5px solid var(--ink); background: var(--panel); border-radius: 14px; padding: 8px 10px; }
.picked-empty { margin: 4px 6px; color: var(--ink-2); font-size: 14px; }
.picked-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.picked-item { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.picked-item + .picked-item { border-top: 1px solid var(--line); padding-top: 8px; }
.picked-num {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--sky); color: #1b2c52; font-size: 13px; font-weight: 900;
}
.picked-text { flex: 1; min-width: 0; }
.picked-text b { display: block; font-size: 15px; font-weight: 900; line-height: 1.35; }
.picked-cat {
  border: 0; background: none; padding: 0; cursor: pointer; font-size: 12px; font-weight: 700;
  color: var(--ink-2); letter-spacing: .05em; text-decoration: underline; text-underline-offset: 2px;
}
.picked-cat:hover { color: var(--ink); }
.picked-btn {
  flex: none; width: 32px; height: 32px; border: 1.5px solid var(--line); background: var(--panel);
  border-radius: 14px; cursor: pointer; font-weight: 900; font-size: 14px;
}
.picked-btn:hover { border-color: var(--ink); }

/* 從遊戲過來的提示 */
.friend.game { border-color: var(--sky); background: var(--sky-l); }
.game-icons { display: inline-flex; gap: 4px; }
.game-icons b { font-size: 22px; line-height: 1; }

/* 圓潤一點，和遊戲的按鈕質感接近 */
.pol-stat { border-radius: 999px; padding: 1px 10px; }
.pol-check, .picked-num { border-radius: 50%; }
.picked-btn { border-radius: 50%; }
