html, body { height: 100%; }
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.side { width: 236px; flex: none; background: var(--paper-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; text-decoration: none; padding: 4px 8px 16px; }
.logo-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; flex: none; }
.logo-mark::after { content: ''; width: 12px; height: 12px; background: var(--accent); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: 14.5px; }
.menu a i { font-style: normal; width: 20px; text-align: center; font-size: 15px; }
.menu a:hover { background: rgba(255, 255, 255, .55); color: var(--ink); }
.menu a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.menu-label { font-size: 11.5px; color: var(--muted); padding: 14px 10px 4px; letter-spacing: .06em; }
.credit-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.credit-box .row { justify-content: space-between; }
.credit-box a { text-decoration: none; }
.credit-num { font-family: var(--serif); font-size: 26px; font-weight: 900; line-height: 1.2; }
.credit-bar { height: 5px; background: var(--paper-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.credit-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.mock-banner { background: #fff3cd; color: #6b5300; font-size: 13px; padding: 6px 16px; text-align: center; border-bottom: 1px solid #f0dfa0; }
#view { flex: 1; min-height: 0; overflow-y: auto; }
.side-mask { display: none; }
@media (max-width: 860px) {
  .side { position: fixed; z-index: 200; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .side-mask.open { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .3); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
  .topbar b { flex: 1; }
}

/* ---------- 通用頁面 ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 28px 60px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-size: 28px; font-weight: 900; }
.page-head p { color: var(--ink-2); margin: 4px 0 0; }
@media (max-width: 600px) { .page { padding: 18px 14px 50px; } }
.split { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.split > .panel { position: sticky; top: 0; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } .split > .panel { position: static; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { font-size: 13.5px; color: var(--ink-2); font-weight: 600; margin: 16px 0 8px; }
.panel h3:first-child { margin-top: 0; }
.cost-line { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 10px; }
.cost-line .hint b { color: var(--ink); }

.model-select { position: relative; }
.model-select select { appearance: none; padding-right: 30px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8174'/%3E%3C/svg%3E") no-repeat right 12px center; }

.grid-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; }
.tile .media { aspect-ratio: 1; background: var(--paper-2); cursor: zoom-in; display: block; width: 100%; object-fit: cover; }
.tile video.media { cursor: pointer; }
.tile .meta { padding: 8px 10px; font-size: 12.5px; color: var(--ink-2); }
.tile .meta p { margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); }
.tile .acts { display: flex; gap: 4px; flex-wrap: wrap; }
.tile .acts .btn { padding: 3px 9px; font-size: 12px; }
.tile.loading .media { display: grid; place-items: center; cursor: default; background: linear-gradient(110deg, var(--paper-2) 30%, #f7f1e6 50%, var(--paper-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

.drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; color: var(--ink-2); transition: all .15s; background: var(--paper); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop img { max-height: 220px; margin: 0 auto; border-radius: 8px; }

/* ---------- 對話 ---------- */
.chat-wrap { display: flex; height: 100%; position: relative; }
.conv-list { width: 250px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--paper); }
.conv-list .head { padding: 14px 12px 8px; }
.conv-list .items { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.conv-item { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.conv-item:hover { background: var(--paper-2); }
.conv-item.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.conv-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item button { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; }
.conv-item:hover button { opacity: 1; }
@media (max-width: 1000px) { .conv-list { display: none; } .conv-list.show { display: flex; position: absolute; z-index: 20; height: 100%; box-shadow: var(--shadow); } }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.chat-top .title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs { flex: 1; overflow-y: auto; padding: 24px 16px; }
.msgs-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.msg-u { align-self: flex-end; max-width: 85%; }
.msg-u .bub { background: var(--ink); color: var(--paper); padding: 10px 15px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-u .imgs { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; flex-wrap: wrap; }
.msg-u .imgs img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.msg-a .who { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg-a .acts { display: flex; gap: 4px; margin-top: 6px; opacity: .7; }
.msg-a .acts:hover { opacity: 1; }
.msg-a .err { color: var(--danger); }
.typing::after { content: '▍'; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.composer { padding: 10px 16px 16px; }
.composer-box { max-width: 780px; margin: 0 auto; background: var(--card); border: 1px solid var(--line-2); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow); }
.composer-box:focus-within { border-color: var(--ink-2); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: none; max-height: 220px; min-height: 26px; padding: 4px 4px; line-height: 1.55; }
.composer .bar { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.composer .bar select { width: auto; max-width: 230px; padding: 5px 28px 5px 10px; font-size: 13px; border-radius: 999px; }
.composer .send { margin-left: auto; }
.attach-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.attach-row .att { position: relative; }
.attach-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.attach-row .att button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 11px; cursor: pointer; }
.suggest { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 18px; }
.suggest button { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.suggest button:hover { border-color: var(--ink-2); color: var(--ink); }
.suggest b { display: block; color: var(--ink); margin-bottom: 2px; }
.welcome { text-align: center; padding-top: 8vh; }
.welcome h2 { font-family: var(--serif); font-size: 30px; font-weight: 900; }

/* ---------- 比較 ---------- */
.cmp-grid { display: grid; gap: 12px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
@media (max-width: 900px) { .cmp-grid { grid-template-columns: 1fr; } }
.cmp-col { background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-height: 200px; }
.cmp-col .h { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.cmp-col .h .hint { font-weight: 400; margin-left: auto; }
.cmp-col .b { padding: 14px; font-size: 14.5px; }
.cmp-round { margin-bottom: 22px; }
.cmp-q { background: var(--ink); color: var(--paper); display: inline-block; padding: 8px 14px; border-radius: 14px; margin-bottom: 10px; white-space: pre-wrap; max-width: 100%; }

/* ---------- 修圖對比 ---------- */
.ba { position: relative; border-radius: 12px; overflow: hidden; user-select: none; background: var(--paper-2); }
.ba img { width: 100%; display: block; }
.ba .after { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.ba .after img { width: 100%; height: 100%; object-fit: cover; }
.ba .handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none; }
.ba .handle::after { content: '⇆'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); font-size: 15px; }
.ba .lbl { position: absolute; top: 10px; font-size: 12px; background: rgba(255, 253, 248, .92); padding: 2px 10px; border-radius: 999px; }
.ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }

/* ---------- 網頁編輯器 ---------- */
.web-wrap { display: grid; grid-template-columns: 360px 1fr; height: 100%; }
@media (max-width: 1000px) { .web-wrap { grid-template-columns: 1fr; grid-template-rows: auto 70vh; height: auto; } }
.web-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.web-side .scroll { flex: 1; overflow-y: auto; padding: 16px; }
.web-log { background: #221f1b; color: #d9d1c3; font: 12px/1.5 var(--mono); border-radius: 10px; padding: 10px 12px; max-height: 200px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin-top: 12px; }
.web-prev { display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); }
.web-tool { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.web-tool .title-input { border: 1px solid transparent; background: none; font-weight: 600; padding: 4px 8px; border-radius: 8px; min-width: 120px; flex: 1; }
.web-tool .title-input:hover, .web-tool .title-input:focus { border-color: var(--line-2); background: var(--card); outline: none; }
.frame-box { flex: 1; display: flex; justify-content: center; padding: 14px; min-height: 0; overflow: auto; }
.frame-box iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); transition: width .25s; }
.frame-box.mobile iframe { width: 390px; max-width: 100%; }
.page-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.page-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: box-shadow .2s, transform .2s; }
.page-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.page-card .thumb { height: 150px; overflow: hidden; position: relative; background: #fff; border-bottom: 1px solid var(--line); }
.page-card .thumb iframe { width: 1200px; height: 750px; transform: scale(.2); transform-origin: 0 0; border: 0; pointer-events: none; }
.page-card .info { padding: 10px 14px; }
.page-card .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 影片工作 ---------- */
.job { display: grid; grid-template-columns: 220px 1fr; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .job { grid-template-columns: 1fr; } }
.job .vid { aspect-ratio: 16/9; background: var(--paper-2); border-radius: 10px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.job .vid video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.progress { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .5s; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs-line button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line button.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .n { font-family: var(--serif); font-size: 28px; font-weight: 900; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- 方案與付款 ---------- */
.bill-toggle { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.bill-toggle button { border: 0; background: none; padding: 5px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; }
.bill-toggle button.on { background: var(--ink); color: var(--paper); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px; display: flex; flex-direction: column; position: relative; background: var(--paper); }
.plan-card.hot { border: 2px solid var(--accent); }
.plan-card .hl { position: absolute; top: -10px; left: 12px; background: var(--accent); color: #fff; font-size: 11.5px; padding: 1px 9px; border-radius: 999px; font-weight: 700; }
.plan-card .btn { margin-top: auto; }
.pc-price { font-family: var(--serif); font-size: 24px; font-weight: 900; margin-top: 8px; }
.pc-price small { font: 400 12px var(--sans); color: var(--muted); }
.pack-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pack { border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; background: var(--paper); }
.pack .btn { margin-top: 8px; }
