/* 電子名片產生器。設計 v2 品牌藍 kit（首屏由 kit heroize）；名片用品牌色 #02539C／#B3CBE1／#F2F6FA／#0E141B，琥珀 #E8A13A 只當點綴。
   字型沿用 kit 的 Noto Serif TC（姓名）＋Noto Sans TC。 */
:root { --accent: #02539C; --accent-soft: #E1ECF6; }

.ec-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; padding-top: 28px; padding-bottom: 28px; }
@media (max-width: 860px) { .ec-grid { grid-template-columns: 1fr; gap: 22px; } }
.ec-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.ec-form fieldset { border: 0; margin: 0 0 6px; padding: 0; }
.ec-form legend { font-weight: 700; color: var(--band); font-size: 15px; letter-spacing: .06em; margin: 10px 0 4px; }
.ec-form label small { font-weight: 400; color: var(--ink-soft); font-size: 13px; margin-left: 6px; }
.ec-form .err { color: var(--warn); }
.ec-form input[aria-invalid] { border-color: var(--warn); }
.ec-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ec-go { flex: 1 1 220px; font-size: 18px; padding: 14px; }

.ec-tabs { display: flex; gap: 6px; margin-bottom: 8px; border-bottom: 2px solid var(--mist); }
.ec-tab { font: inherit; font-weight: 700; background: none; border: 0; padding: 10px 14px; color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.ec-tab[aria-selected="true"] { color: var(--band); border-bottom-color: var(--band); }

.ec-stage { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 861px) { .ec-stage { position: sticky; top: 84px; } }   /* 84＝kit 頁首（sticky、約 66px）下方；原本 20px，捲下去「名片預覽」標籤跟名片上緣被頁首蓋住（10/18 量到） */
.ec-stage-lab { margin: 0; align-self: flex-start; background: #fff; color: var(--band); font-size: 14px; font-weight: 700; letter-spacing: .08em; padding: 4px 12px; border-radius: 999px; box-shadow: 0 0 0 1px var(--line); }

/* 名片 */
.ec-card { background: var(--paper); border-radius: 22px; overflow: hidden; color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 26px 50px -24px rgba(2, 40, 80, .5); max-width: 460px; width: 100%; }
.ec-card header { background: var(--band); color: #fff; display: flex; gap: 16px; align-items: center; padding: 24px 24px 22px; position: relative; }
.ec-card header:after { content: ""; position: absolute; right: 22px; top: 22px; width: 14px; height: 14px; background: #E8A13A; transform: rotate(45deg); border-radius: 2px; }
.ec-ini { flex: none; width: 58px; height: 58px; border-radius: 50%; background: #fff; color: var(--band); display: grid; place-items: center; font-family: var(--font-head); font-weight: 900; font-size: 28px; }
.ec-card h2 { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: 28px; line-height: 1.25; letter-spacing: .04em; overflow-wrap: anywhere; padding-right: 22px; }
.ec-card header p { margin: 4px 0 0; color: #DCE8F4; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.ec-card header p i { font-style: normal; opacity: .6; }
.ec-note { margin: 0; padding: 16px 24px 0; font-size: 16px; line-height: 1.6; color: var(--ink); }
.ec-card ul { list-style: none; margin: 0; padding: 12px 24px 20px; }
.ec-card li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--mist); font-size: 16px; align-items: baseline; }
.ec-card li:last-child { border-bottom: 0; }
.ec-card li b { font-size: 13px; color: var(--ink-soft); font-weight: 500; letter-spacing: .06em; }
.ec-card li a, .ec-card li span { overflow-wrap: anywhere; color: var(--ink); }
.ec-card li a { color: var(--band); font-weight: 500; }
.ec-none { margin: 0; padding: 18px 24px 22px; color: var(--ink-soft); font-size: 15px; }

/* 連結與 QR */
.ec-out { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 460px; }
.ec-qrbox { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 8px; }
.ec-qrbox canvas { width: 160px; height: 160px; border-radius: 10px; border: 1px solid var(--line); image-rendering: pixelated; }
.ec-qrbox .hint { grid-column: 1 / -1; margin: 0; }
.ec-qrmode { border: 0; padding: 0; margin: 0; }
.ec-qrmode legend { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.ec-qrmode label { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 16px; }
#ec-link { font-size: 14px; color: var(--ink-soft); }
.ec-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ec-acts .btn { flex: 1 1 auto; }

/* 名片模式（全螢幕給人掃） */
.ec-mode { position: fixed; inset: 0; z-index: 50; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.ec-mode[hidden] { display: none; }
.ec-mode canvas { width: min(82vw, 62vh, 520px); height: auto; aspect-ratio: 1; }
.ec-mode-name { margin: 0; font-family: var(--font-head); font-weight: 900; font-size: 30px; color: var(--band); }
.ec-mode-sub { margin: 0 0 8px; color: var(--ink-soft); }
.ec-mode-tip { margin: 6px 0 10px; color: var(--ink-soft); }
html.ec-lock { overflow: hidden; }

/* 別人打開的名片頁：只留名片，工具與說明收起來 */
html.ec-viewing .ec-editor, html.ec-viewing .ec-top, html.ec-viewing .kit-hero, html.ec-viewing .kit-faq, html.ec-viewing .kit-more, html.ec-viewing .kit-plans { display: none !important; }
#ec-view { padding-top: 28px; padding-bottom: 40px; }
.ec-vgrid { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ec-vgrid .ec-card { max-width: 480px; }
.ec-vgrid .ec-acts { width: 100%; max-width: 480px; display: grid; grid-template-columns: 1fr 1fr; }
.ec-vgrid .ec-acts > :last-child:nth-child(even) { grid-column: 1 / -1; }
.ec-vgrid .ec-acts > :first-child { grid-column: 1 / -1; font-size: 18px; padding: 14px; }
.ec-vgrid .btn.line { background: #06C755; border-color: #06C755; color: #fff; }
.ec-made { max-width: 480px; text-align: center; color: var(--ink-soft); font-size: 14px; line-height: 1.7; margin: 6px 0 0; }
.ec-bad { max-width: 560px; margin: 0 auto; text-align: center; }

/* ---- 付費：版型（0 經典藍＝上面的預設；1 簡約白；2 深夜藍） ---- */
.ec-card.ec-tpl-1 { background: #fff; }
.ec-card.ec-tpl-1 header { background: #fff; color: var(--ink); border-bottom: 3px solid var(--band); }
.ec-card.ec-tpl-1 header:after { background: var(--band); }
.ec-card.ec-tpl-1 .ec-ini { background: var(--band); color: #fff; }
.ec-card.ec-tpl-1 h2 { color: var(--band); }
.ec-card.ec-tpl-1 header p { color: var(--ink-soft); }
.ec-card.ec-tpl-2 { background: #0E141B; color: #F2F6FA; box-shadow: 0 0 0 1px #0E141B, 0 26px 50px -24px rgba(2, 20, 40, .7); }
.ec-card.ec-tpl-2 header { background: #0E141B; border-bottom: 1px solid rgba(179, 203, 225, .25); }
.ec-card.ec-tpl-2 .ec-ini { background: #E8A13A; color: #0E141B; }
.ec-card.ec-tpl-2 header p { color: #B3CBE1; }
.ec-card.ec-tpl-2 .ec-note, .ec-card.ec-tpl-2 li span, .ec-card.ec-tpl-2 li a { color: #F2F6FA; }
.ec-card.ec-tpl-2 li a { color: #B3CBE1; }
.ec-card.ec-tpl-2 li b { color: #B3CBE1; }
.ec-card.ec-tpl-2 li { border-bottom-color: rgba(179, 203, 225, .22); }
.ec-card.ec-tpl-2 .ec-none { color: #B3CBE1; }

.ec-tpl { display: flex; flex-wrap: wrap; gap: 8px; }
.ec-tpl legend { width: 100%; }
.ec-tpl label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 15px; background: #fff; }
.ec-tpl label:has(input:checked) { border-color: var(--band); box-shadow: 0 0 0 2px var(--band) inset; }
.ec-tpl input { position: absolute; opacity: 0; pointer-events: none; }
.ec-tpl label:has(input:focus-visible) { outline: 2px solid var(--band); outline-offset: 2px; }
.ec-tpl small { font-size: 12px; color: #8a5a10; background: #FBEBD2; border-radius: 6px; padding: 1px 6px; }
.ec-sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); }
.ec-sw-0 { background: linear-gradient(#02539C 0 55%, #F2F6FA 55%); }
.ec-sw-1 { background: linear-gradient(#fff 0 50%, #02539C 50% 60%, #fff 60%); }
.ec-sw-2 { background: #0E141B; border-color: #0E141B; }

/* ---- 付費：固定短網址 ---- */
.ec-pro { border-top: 1px dashed var(--mist); margin: 6px 0 14px; padding-top: 14px; }
.ec-pro h3 { margin: 0 0 6px; font-size: 17px; color: var(--band); display: flex; align-items: center; gap: 8px; }
.ec-pro h3 small { font-size: 12px; color: #8a5a10; background: #FBEBD2; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.ec-pro p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.ec-short b { font-size: 17px; overflow-wrap: anywhere; }
.ec-stat { color: var(--ink-soft); }
.ec-slug-row { display: flex; align-items: center; border: 1px solid var(--line-strong, var(--line)); border-radius: 12px; overflow: hidden; background: #fff; }
.ec-slug-row span { padding: 0 4px 0 12px; color: var(--ink-soft); font-size: 14px; white-space: nowrap; }
.ec-slug-row input { border: 0; border-radius: 0; min-width: 0; flex: 1; padding-left: 2px; }
.ec-days { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 12px; padding: 0; text-align: center; }
.ec-days li { background: var(--accent-soft); border-radius: 8px; padding: 4px 0; }
.ec-days span { display: block; font-size: 11px; color: var(--ink-soft); }
.ec-days b { font-size: 15px; color: var(--band); }
.ec-mylinks { margin-top: 10px; }
.ec-mylinks summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.ec-mylinks ul { list-style: none; padding: 0; margin: 8px 0 0; }
.ec-mylinks li { padding: 8px 0; border-bottom: 1px dashed var(--mist); display: grid; gap: 2px; font-size: 14px; }
.ec-mylinks li b { overflow-wrap: anywhere; }
.ec-mylinks li span { color: var(--ink-soft); }
.ec-mylinks .linkbtn { justify-self: start; }
.ec-mylinks .linkbtn { font: inherit; font-size: 14px; background: none; border: 0; padding: 4px 0; color: var(--band); text-decoration: underline; cursor: pointer; }
.ec-editor[data-paid="1"] .ec-tpl small { display: none; }

/* ---- 分數表 10/17（70.5）第一輪修：範例名片、欄位主次、手機預覽提前＋跟著捲的那一條 ---- */
/* 姓名是名片上最大的那行，表單上也放大；其他欄位標籤降一級 */
.ec-f-name label { font-size: 17px; }
.ec-f-name input { font-size: 19px; font-weight: 700; padding-top: 14px; padding-bottom: 14px; border-width: 2px; border-color: var(--band); }
.ec-form .field:not(.ec-f-name) label { font-weight: 500; }
/* 「更多」：公司電話、網站、地址、一句介紹 */
.ec-more { margin: 4px 0 8px; border: 1px dashed var(--line); border-radius: 12px; padding: 0 14px; background: var(--paper, #F7FAFD); }
.ec-more summary { cursor: pointer; padding: 12px 0; font-weight: 700; color: var(--band); font-size: 15px; }
.ec-more[open] { padding-bottom: 6px; }
/* 範例名片 */
.ec-sample-tag { margin: 0 0 10px; display: inline-block; font-size: 13.5px; font-weight: 700; color: #7A4A06; background: #FBEBD2; border: 1px solid #E8A13A; border-radius: 999px; padding: 3px 12px; }
@media (min-width: 861px) { .ec-stage .ec-card { max-width: 520px; } .ec-stage .ec-card h2 { font-size: 32px; } }
/* 手機：預覽放到表單前面（原本在表單後面約 4.6–7 屏），捲進表單後頂端跟著一條小名片 */
.ec-mini { display: none; }
@media (max-width: 860px) {
  .ec-stage { order: -1; }
  /* 高度 0 的 sticky＋裡面絕對定位：出現或收起都不推動表單（不跳版） */
  .ec-mini { display: block; position: sticky; top: 0; z-index: 5; height: 0; margin: 0 -22px; }
  .ec-mini-in { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--band); color: #fff; border-radius: 0 0 14px 14px; box-shadow: 0 8px 18px -10px rgba(2, 40, 80, .6); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .15s, transform .15s; }
  .ec-mini.on .ec-mini-in { opacity: 1; transform: none; }
  @media (prefers-reduced-motion: reduce) { .ec-mini-in { transition: none; } }
  .ec-mini-ini { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--band); display: grid; place-items: center; font: 900 18px/1 var(--font-head); }
  .ec-mini-t { display: flex; flex-direction: column; min-width: 0; }
  .ec-mini-t b { font: 900 17px/1.3 var(--font-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ec-mini-t span { font-size: 13px; color: #DCE8F4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 860px) { .ec-form input { scroll-margin-top: 150px; } }   /* 對焦的欄位不要躲在頁首＋小名片那條後面 */

/* ---- UILESS（10/18）：左欄上面是萬用輸入，名片欄位收在「核對我聽到的」 ---- */
.ec-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ec-check { margin-top: 4px; }
.ec-check > summary { cursor: pointer; padding: 12px 0 6px; font-weight: 700; color: var(--band); font-size: 15px; list-style: none; }
.ec-check > summary::-webkit-details-marker { display: none; }
.ec-check > summary:before { content: "＋ "; }
.ec-check[open] > summary:before { content: "－ "; }
/* 手機：先給他講（萬用輸入在首屏），預覽排在後面（原本沒有萬用輸入時預覽排最前面） */
@media (max-width: 860px) { .ec-uiless .ec-stage { order: 0; } }
