/* 展場頁面編輯器：白底、無分隔線、無框淺灰圓角按鈕與輸入格；字體 Noto Sans TC＋Google Sans Flex，中文不加字距 */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #8f8f8f;
  --btn: #efefef;
  --btn-hover: #e2e2e2;
  --field: #f3f3f1;
  --sel: #efefef;
  --ok: #3f9a55;
  --warn: #c4432f;
  --font: "Google Sans Flex", "Noto Sans TC", "PingFang TC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --ink: #f2f2f2; --ink-2: #b0b0b0; --ink-3: #7c7c7c;
    --btn: #262626; --btn-hover: #333333; --field: #1e1e1e; --sel: #262626;
    --ok: #74c088; --warn: #e8705b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); letter-spacing: 0; font-size: 15px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: 0; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px; background: var(--btn); font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--btn-hover); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.ink { background: var(--ink); color: var(--bg); }
.btn.ink:hover { opacity: .88; }
.btn.ghost { background: none; }
.btn.ghost:hover { background: var(--btn); }
.btn.danger { color: var(--warn); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field > small, .hint { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }
input[type=text], input[type=url], input[type=number], input[type=password], textarea {
  width: 100%; border: 0; outline: 0; border-radius: 10px; background: var(--field);
  padding: 9px 12px; font-size: 15px; line-height: 1.6;
  box-shadow: 0 0 0 0 var(--ink); transition: box-shadow .12s;
}
input:focus, textarea:focus { box-shadow: 0 0 0 1.5px var(--ink); }
textarea { resize: vertical; min-height: 84px; }
textarea.auto { resize: none; overflow: hidden; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; margin: 0 18px 10px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--field); }
.seg button { height: 30px; padding: 0 14px; border-radius: 999px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--bg); color: var(--ink); font-weight: 700; }

/* ── 登入、列表 ─────────────────────────── */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login { width: 360px; }
.login h1 { font-size: 34px; font-weight: 900; margin: 0 0 6px; line-height: 1.3; }
.login p { color: var(--ink-2); margin: 0 0 24px; }
.login .err { color: var(--warn); font-size: 13px; margin-top: 8px; min-height: 20px; }

.sites { max-width: 1200px; margin: 0 auto; padding: 64px 40px; }
.sites h1 { font-size: 44px; font-weight: 900; margin: 0; line-height: 1.3; }
.sites > p { font-size: 17px; font-weight: 700; color: var(--ink-2); margin: 10px 0 40px; line-height: 1.42; }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px 24px; }
.scard { text-align: left; cursor: pointer; }
.scard .cv { aspect-ratio: 16/10; border-radius: 14px; background: var(--field); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-weight: 700; font-size: 18px; }
.scard .cv img { width: 100%; height: 100%; object-fit: cover; }
.scard b { display: block; font-size: 18px; margin-top: 12px; }
.scard small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 4px; line-height: 1.65; }
.scard .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--btn); margin-left: 6px; vertical-align: 2px; }
.scard .tag.on { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.newsite { background: var(--field); border-radius: 14px; padding: 20px; }
.newsite h3 { margin: 0 0 14px; font-size: 18px; }

/* ── 編輯畫面 ─────────────────────────── */
.ed { display: grid; grid-template-columns: 300px minmax(420px, 1fr) var(--pvw, 560px); grid-template-rows: auto 1fr; height: 100vh; }
.ed.nopv { grid-template-columns: 300px minmax(420px, 1fr) 0; }
.ed.nopv .pv { display: none; }
.bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 14px 20px; }
.bar .ttl { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.bar .ttl b { font-size: 20px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .ttl a { font-size: 13px; color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.bar .ttl a:hover { color: var(--ink); }
.status { font-size: 13px; color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.pending i { background: var(--warn); }
.status.live i { background: var(--ok); }

.side { overflow-y: auto; padding: 4px 12px 40px 20px; }
.adds { display: flex; gap: 6px; margin: 4px 0 14px; }
.adds .btn { flex: 1; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; position: relative; }
.list li:hover { background: color-mix(in srgb, var(--sel) 60%, transparent); }
.list li.on { background: var(--sel); }
.list li.drop-before::before, .list li.drop-after::after { content: ""; position: absolute; left: 8px; right: 8px; height: 2px; border-radius: 2px; background: var(--ink); }
.list li.drop-before::before { top: -1px; }
.list li.drop-after::after { bottom: -1px; }
.list .th { flex: none; width: 64px; aspect-ratio: 16/10; border-radius: 7px; background: var(--field); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--ink-3); }
.list .th img { width: 100%; height: 100%; object-fit: cover; }
.list .tx { min-width: 0; flex: 1; }
.list .tx b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .tx small { display: block; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--btn); color: var(--ink-2); margin-left: 4px; }
.list .settings .th { background: var(--ink); color: var(--bg); }
.list .sep { height: 14px; cursor: default; padding: 0; }
.list .sep:hover { background: none; }
.list .none { color: var(--ink-3); font-size: 13px; cursor: default; padding: 8px; line-height: 1.7; }

.form { overflow-y: auto; padding: 4px 28px 120px; }
.form h2 { font-size: 26px; font-weight: 900; margin: 6px 0 4px; line-height: 1.42; }
.form .lead { color: var(--ink-2); font-weight: 700; margin: 0 0 24px; line-height: 1.6; }
.form h4 { font-size: 15px; font-weight: 900; margin: 34px 0 14px; }
.opts { display: flex; flex-wrap: wrap; margin: 4px 0 10px; }
.foot { display: flex; justify-content: flex-end; margin-top: 30px; }

/* 圖片欄位 */
.imgf { display: flex; gap: 14px; align-items: flex-start; }
.imgf .thumb { position: relative; flex: none; width: 180px; aspect-ratio: 16/10; border-radius: 10px; background: var(--field); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; }
.imgf.logo .thumb { aspect-ratio: 2/1; background-image: linear-gradient(45deg, var(--btn) 25%, transparent 25%, transparent 75%, var(--btn) 75%), linear-gradient(45deg, var(--btn) 25%, transparent 25%, transparent 75%, var(--btn) 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.imgf .thumb img { width: 100%; height: 100%; object-fit: cover; }
.imgf.logo .thumb img { object-fit: contain; padding: 10px; }
.imgf .thumb.drag { box-shadow: inset 0 0 0 2px var(--ink); }
.imgf .prog { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 70%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ink); }
.imgf .act { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.imgf .act .btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* YouTube 欄位 */
.ytbox { display: flex; gap: 14px; align-items: center; margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--field); }
.ytbox img { width: 120px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.ytbox div { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.ytbox b { color: var(--ink); }
.ytbox.err { color: var(--warn); }

/* 內文區塊 */
.blocks { display: flex; flex-direction: column; gap: 10px; }
.blk { border-radius: 14px; background: color-mix(in srgb, var(--field) 55%, transparent); padding: 10px 12px 12px; }
.blk .bh { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.blk .bh b { font-size: 12px; font-weight: 700; color: var(--ink-3); flex: 1; }
.blk .bh button { width: 28px; height: 28px; border-radius: 8px; color: var(--ink-3); font-size: 14px; }
.blk .bh button:hover { background: var(--btn); color: var(--ink); }
.blk input + input, .blk textarea + input, .blk .imgf + input, .blk input + .ytbox { margin-top: 8px; }
.blk.h input { font-weight: 700; font-size: 17px; }
.blk.q textarea { font-weight: 700; }
.addblk { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* 預覽 */
.pv { display: flex; flex-direction: column; padding: 0 20px 20px 8px; min-width: 0; }
.pv-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pv-bar small { color: var(--ink-3); font-size: 12px; flex: 1; text-align: right; }
.pv-wrap { flex: 1; min-height: 0; position: relative; }
.pv-dev { position: absolute; left: 0; top: 0; border-radius: 22px; background: #1a1a1a; padding: 14px; transform-origin: 0 0; }
.pv-dev iframe { display: block; border: 0; border-radius: 10px; background: #fff; }

/* iPad 開啟方式 */
.howto { display: flex; gap: 20px; padding: 18px; border-radius: 14px; background: var(--field); align-items: center; }
.howto .qr { flex: none; width: 128px; height: 128px; background: #fff; padding: 8px; border-radius: 10px; }
.howto .qr svg { width: 100%; height: 100%; display: block; }
.howto ol { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13.5px; line-height: 1.75; }
.howto b { font-size: 15px; }
.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatches button.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.swatches input[type=color] { width: 44px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }

/* 對話框、提示 */
dialog { border: 0; border-radius: 18px; padding: 24px; width: min(640px, 92vw); background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h3 { margin: 0 0 12px; font-size: 20px; }
dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 500; z-index: 50; animation: up .2s ease; }
.banner { grid-column: 1 / -1; margin: 0 20px 10px; padding: 10px 16px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-weight: 500; display: flex; gap: 10px; align-items: center; }
@keyframes up { from { transform: translate(-50%, 10px); opacity: 0; } }

@media (max-width: 1280px) {
  .ed { grid-template-columns: 260px minmax(380px, 1fr) var(--pvw, 420px); }
}
