:root {
  --bg: #15171b;
  --panel: #1e2127;
  --panel2: #262a31;
  --border: #343a44;
  --text: #e8eaee;
  --muted: #9aa3b0;
  --accent: #4f8cff;
  --accent2: #2fbf71;
  --warn: #ff9f43;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; font-size: 14px; line-height: 1.55; }
.top { padding: 18px 24px 8px; }
.top h1 { margin: 0 0 4px; font-size: 20px; }
.top .sub { margin: 0; color: var(--muted); max-width: 900px; }
main { padding: 12px 24px 24px; }
.foot { padding: 0 24px 24px; color: var(--muted); font-size: 12px; }

.drop { border: 2px dashed var(--border); border-radius: 12px; padding: 48px 20px; text-align: center; background: var(--panel); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: #1c2436; }
.drop-icon { font-size: 40px; margin-bottom: 8px; }
.drop p { margin: 4px 0; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.link { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; }
.btn:hover { border-color: #4a5260; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.active { border-color: var(--warn); color: var(--warn); }
.btn:disabled { opacity: .5; cursor: default; }

.editor { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px 14px; }
.group { padding: 10px 0; border-bottom: 1px solid var(--border); }
.group:last-child { border-bottom: none; }
.group h2 { font-size: 13px; color: var(--muted); margin: 4px 0 8px; text-transform: none; letter-spacing: .02em; }
.opt { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.opt.sel select, .opt.sel input[type=range] { flex: 1; }
select { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font: inherit; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.row .btn { flex: 1; min-width: 120px; }
.panel .btn { width: 100%; margin-top: 6px; }
.row .btn { margin-top: 0; }

.thumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs li { position: relative; width: 72px; height: 54px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #000; }
.thumbs li.cur { border-color: var(--accent); }
.thumbs li img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs li .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 9px; background: rgba(0,0,0,.6); color: #fff; border: none; font-size: 11px; line-height: 18px; padding: 0; cursor: pointer; }

.plates { list-style: none; margin: 0; padding: 0; }
.plates li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.plates li.sel { background: var(--panel2); outline: 1px solid var(--warn); }
.plates li .name { flex: 1; }
.plates li .meta { color: var(--muted); font-size: 12px; }
.plates li .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }
.plates li .del:hover { color: #ff6b6b; }

.stage { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.status { color: var(--muted); font-size: 12px; }
.viewwrap { background: #0d0e11; border: 1px solid var(--border); border-radius: 12px; display: flex; justify-content: center; align-items: center; overflow: hidden; min-height: 200px; }
#view { display: block; touch-action: none; cursor: crosshair; }
.zooms { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.zooms h3 { font-size: 12px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
.zooms canvas { width: 100%; height: auto; display: block; background: #0d0e11; border: 1px solid var(--border); border-radius: 8px; }
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.top h1 .en { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: .04em; }
[hidden] { display: none !important; }
