/* VL Studio 画面のデザイン */
:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1d1c1a;
  --muted: #77736b;
  --line: #e3ded3;
  --gold: #b48a35;
  --gold-soft: #f3ead6;
  --dark: #161513;
  --ok: #2f7d4f;
  --warn: #b7791f;
  --bad: #b23b3b;
  --radius: 10px;
  --font: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
a { color: var(--gold); }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0; }
p { line-height: 1.7; }
.muted { color: var(--muted); }
small { color: var(--muted); }

/* ── 上部 ── */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; background: var(--dark); color: #eee; }
.brand { color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.brand .mark { color: var(--gold); font-family: Georgia, serif; font-size: 18px; }
#nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
#nav a { color: #cfcac0; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
#nav a.active, #nav a:hover { background: #2a2824; color: #fff; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #aaa; white-space: nowrap; }
#meter-mini { display: flex; align-items: center; gap: 8px; color: #ddd; text-decoration: none; }
#meter-mini .bar { width: 90px; }

/* ── 本体 ── */
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.split { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2, .grid3, .split { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-color: var(--gold); }

/* ── 入力 ── */
button, .button { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .button:hover { border-color: var(--gold); }
button.primary { background: var(--dark); color: #fff; border-color: var(--dark); }
button.primary:hover { background: #33302a; }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 12px; }
button.icon { border: none; background: none; font-size: 20px; padding: 2px 8px; }
button:disabled { opacity: .5; cursor: default; }
button.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type=text], input[type=number], select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { resize: vertical; line-height: 1.6; }
input[type=color] { width: 48px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .field.wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field .label { font-size: 12px; color: var(--muted); }
.field input[type=checkbox] { width: 18px; height: 18px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--gold); background: var(--gold-soft); }

/* ── 表・一覧 ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--gold-soft); color: #7a5b1c; }
.chip.gray { background: #eee; color: #666; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.1); vertical-align: middle; }

/* ── メーター ── */
.bar { height: 10px; background: #e9e4d9; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar.warn > i { background: var(--warn); }
.bar.over > i { background: var(--bad); }
.big-num { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── 画像 ── */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.thumb { position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #fff repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; cursor: pointer; }
.thumb img, .thumb canvas { display: block; width: 100%; height: auto; }
.thumb.selected { border-color: var(--gold); }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; background: rgba(255,255,255,.88); }
.thumb .tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.thumb:hover .tools { opacity: 1; }
.checker { background: #fff repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.stage { position: relative; overflow: auto; background: #e7e3da; border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; }
.stage canvas { box-shadow: 0 2px 12px rgba(0,0,0,.15); width: auto; height: auto; max-width: 100%; max-height: 68vh; touch-action: none; cursor: move; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sticker { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sticker canvas { width: 100%; height: auto; border-radius: 6px; }
.sticker input { font-size: 12px; padding: 4px 6px; }

/* ── モーダル・通知 ── */
.modal-back { position: fixed; inset: 0; background: rgba(20,18,15,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: min(760px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--dark); color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: 0 4px 16px rgba(0,0,0,.2); line-height: 1.5; }
.toast.error { background: var(--bad); }
.toast.ok { background: var(--ok); }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--gold-soft); color: #6b4f17; line-height: 1.6; }
.notice.bad { background: #f6e0e0; color: var(--bad); }
.progress { font-size: 12px; color: var(--muted); }
pre.copy { white-space: pre-wrap; background: #f7f5f0; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: var(--font); line-height: 1.6; margin: 0; }
