/* Menu Board Designer v2 — dark tool theme (derived from /srv/wallpreview/public/style.css) */
* { box-sizing: border-box; }
:root {
  --bg: #0b0d12; --panel: #141821; --panel-2: #0f131c; --border: #2a3040;
  --text: #e8ebf2; --dim: #9aa4b8; --accent: #4f8cff; --accent-2: #7c5cff;
  --err: #ff6b6b; --warn: #f5a623; --ok: #3ddc84;
}
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
h3 { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; margin: 18px 0 8px; font-weight: 600; }
h3:first-child { margin-top: 0; }
.hidden { display: none !important; }
.fine { color: var(--dim); font-size: 12px; }
p.fine { margin: 10px 0 0; }
.brand-sm { letter-spacing: 0.16em; font-size: 11px; color: var(--dim); white-space: nowrap; }
.brand-sm strong { color: var(--text); letter-spacing: 0.03em; }

button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.12); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 500; }
button.danger { border-color: rgba(255,107,107,0.5); color: var(--err); }
button.small { padding: 6px 10px; font-size: 13px; }
button.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
button:disabled { opacity: 0.5; cursor: default; filter: none; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--dim); width: 34px; height: 34px; padding: 0; }
input, select, textarea { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
label > input, label > select, label > .seg { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; background: transparent; color: var(--dim); border-radius: 0; padding: 7px 6px; font-weight: 500; font-size: 13px; }
.seg button.on { background: rgba(79,140,255,0.22); color: var(--text); }
.seg.mini button { padding: 4px 6px; font-size: 12px; }
.readout { background: rgba(79,140,255,0.1); border: 1px solid rgba(79,140,255,0.35); border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #8fb5ff; margin: 6px 0 4px; }
.readout strong { color: var(--text); }
.warn { background: rgba(245,166,35,0.12); border: 1px solid rgba(245,166,35,0.5); color: #ffd48a; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 8px; }

/* ---- shell ---- */
#app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--panel); flex-wrap: wrap; }
.name-input { width: 220px; background: transparent; border-color: transparent; font-weight: 600; }
.name-input:hover, .name-input:focus { border-color: var(--border); background: var(--panel-2); }
.views { display: flex; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.views button { background: transparent; color: var(--dim); padding: 6px 14px; font-weight: 500; }
.views button.active { background: rgba(79,140,255,0.22); color: var(--text); }
.top-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.body { display: flex; flex: 1; min-height: 0; }
.panel { width: 360px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--panel); transition: margin-left 0.25s; }
.panel.collapsed { margin-left: -360px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; background: transparent; color: var(--dim); border-radius: 0; padding: 10px 4px; font-weight: 500; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: thin; }
.stage { flex: 1; position: relative; min-width: 0; background: radial-gradient(1200px 600px at 50% 10%, #141a26 0%, var(--bg) 70%); }
.view { position: absolute; inset: 0; }
.view-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 0; flex-wrap: wrap; }

/* ---- 2D preview ---- */
.pv-board { position: absolute; top: 48px; bottom: 40px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: center; }
.pv-row { display: flex; align-items: flex-start; position: relative; }
.pv-screen { position: relative; background: #05060a; border-radius: 3px; box-shadow: 0 8px 30px rgba(0,0,0,0.55), inset 0 0 0 1px #262b36; cursor: pointer; flex: none; }
.pv-screen.sel { box-shadow: 0 8px 30px rgba(0,0,0,0.55), 0 0 0 2px var(--accent); }
.pv-screen canvas { position: absolute; display: block; }
.pv-cap { position: absolute; left: 0; right: 0; top: 100%; margin-top: 8px; text-align: center; color: var(--dim); font-size: 12px; white-space: nowrap; }
.pv-cap b { color: var(--text); font-weight: 600; }
.pv-dim { position: absolute; left: 0; right: 0; top: -26px; text-align: center; color: var(--dim); font-size: 11px; }
.pv-dim::before, .pv-dim::after { content: ""; position: absolute; top: 50%; height: 1px; background: var(--border); width: calc(50% - 90px); }
.pv-dim::before { left: 0; } .pv-dim::after { right: 0; }

/* ---- 3D ---- */
#stage3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ctrl-bar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px 8px; background: rgba(20,24,33,0.85); border: 1px solid var(--border); border-radius: 12px; backdrop-filter: blur(10px); }
.ctrl-bar button { background: transparent; border: 1px solid transparent; color: var(--dim); padding: 7px 11px; font-weight: 500; font-size: 13px; }
.ctrl-bar button.on { background: rgba(79,140,255,0.25); border-color: var(--accent); color: var(--text); }
.hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); color: var(--dim); font-size: 12px; transition: opacity 1.5s; pointer-events: none; background: rgba(11,13,18,0.5); padding: 4px 10px; border-radius: 12px; }
.hint.fade { opacity: 0; }

/* ---- dimensions ---- */
.dims-grid { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 340px; gap: 18px; padding: 18px; overflow: auto; }
.dims-draw { background: #fff; border-radius: 10px; padding: 10px; display: flex; align-items: center; justify-content: center; min-height: 320px; }
.dims-draw svg { width: 100%; height: auto; max-height: calc(100vh - 140px); }
.dims-side { overflow: auto; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.kv td:first-child { color: var(--dim); width: 46%; }
table.kv td.num { text-align: right; white-space: nowrap; }
table.kv tr.head td { color: var(--text); font-weight: 600; border-bottom-color: var(--dim); }

/* ---- content cards ---- */
.media-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: var(--panel-2); }
.media-card.sel { border-color: var(--accent); }
.media-card .mc-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--dim); margin-bottom: 8px; }
.media-card .mc-head b { color: var(--text); }
.media-card .mc-thumb { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #05060a; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); cursor: pointer; }
.media-card .mc-thumb.portrait { aspect-ratio: 9 / 16; max-height: 220px; width: auto; margin: 0 auto; }
.media-card .mc-thumb.bar { aspect-ratio: 32 / 9; }
.media-card .mc-thumb.over { border-color: var(--accent); background: rgba(79,140,255,0.08); }
.media-card .mc-thumb canvas, .media-card .mc-thumb img, .media-card .mc-thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.media-card .mc-thumb .mc-drop { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--dim); font-size: 12.5px; padding: 12px; gap: 4px; pointer-events: none; }
.media-card .mc-thumb .mc-drop strong { color: var(--text); }
.media-card .mc-thumb.has .mc-drop { opacity: 0; transition: opacity 0.2s; background: rgba(5,6,10,0.75); }
.media-card .mc-thumb.has:hover .mc-drop { opacity: 1; }
.media-card input[type=file] { display: none; }
.media-card .mc-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.media-card .mc-foot .seg { flex: 1; }
.media-card .mc-name { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 6px; }
.media-card .mc-prog { height: 6px; background: var(--panel); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.media-card .mc-prog div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.media-card .mc-err { color: var(--err); font-size: 12px; margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.badge-video { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 10px; }

/* ---- scene tab ---- */
.env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.env-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; background: var(--panel-2); }
.env-card:hover { border-color: var(--dim); }
.env-card.on { border-color: var(--accent); background: rgba(79,140,255,0.12); }
.env-card .sw { height: 26px; border-radius: 6px; margin-bottom: 8px; }
.env-card b { display: block; font-size: 13px; }
.env-card span { font-size: 11.5px; color: var(--dim); }

/* ---- landing ---- */
.landing { position: fixed; inset: 0; z-index: 80; overflow: auto; background: radial-gradient(1200px 700px at 30% 0%, #1b2438 0%, #0b0d12 60%); transition: opacity 0.35s; }
.landing.leaving { opacity: 0; pointer-events: none; }
.landing-inner { max-width: 1080px; margin: 0 auto; padding: 48px 24px 40px; }
.landing-brand { letter-spacing: 0.18em; font-size: 12px; color: var(--dim); margin-bottom: 18px; }
.landing h1 { font-size: clamp(28px, 4.2vw, 46px); margin: 0 0 10px; line-height: 1.1; letter-spacing: -0.01em; }
.landing h1 em { font-style: normal; background: linear-gradient(90deg, #7fb0ff, #b79bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing .sub { color: var(--dim); font-size: 16px; margin: 0 0 28px; max-width: 640px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.preset-card { border: 1px solid var(--border); border-radius: 14px; background: rgba(20,24,33,0.85); overflow: hidden; cursor: pointer; text-align: left; padding: 0; transition: transform 0.15s, border-color 0.15s; }
.preset-card:hover { transform: translateY(-3px); border-color: var(--accent); filter: none; }
.preset-card canvas { width: 100%; display: block; aspect-ratio: 16 / 9; background: #0a0c12; }
.preset-card .pc-body { padding: 12px 14px 14px; }
.preset-card b { display: block; font-size: 15px; color: var(--text); }
.preset-card span { font-size: 12.5px; color: var(--dim); }
.landing-foot { display: flex; gap: 12px; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.landing-foot .fine { margin-left: auto; }

/* ---- sheet / toast ---- */
.sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(5,7,12,0.7); backdrop-filter: blur(6px); }
.sheet-card { position: relative; width: 440px; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.sheet-card h2 { margin: 0 0 6px; font-size: 18px; }
.sheet-card p { margin: 6px 0 12px; color: var(--dim); font-size: 13px; }
.sheet-close { position: absolute; top: 10px; right: 10px; background: transparent; color: var(--dim); padding: 4px 8px; }
.sheet .err { color: var(--err); font-size: 13px; min-height: 18px; }
.share-url { display: flex; gap: 6px; }
.share-url input { font-family: ui-monospace, monospace; font-size: 12px; }
.btn-link { display: block; margin: 8px 0; padding: 10px; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; text-align: center; }
.btn-link.wa { background: #22a55b; }
.btn-link.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.prog { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin: 12px 0; }
.prog div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
.snap-img { width: 100%; border-radius: 8px; border: 1px solid var(--border); margin: 8px 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1d2330; border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: 10px; z-index: 95; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); max-width: calc(100vw - 32px); }

@media (max-width: 900px) {
  .topbar { gap: 8px; }
  .name-input { width: 140px; }
  .top-actions { margin-left: 0; width: 100%; }
  .panel { position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: min(360px, 92vw); box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
  .panel.collapsed { margin-left: calc(-1 * min(360px, 92vw)); box-shadow: none; }
  .dims-grid { grid-template-columns: 1fr; }
  .pv-board { left: 12px; right: 12px; }
  .ctrl-bar { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); }
}
