/* Pico Terminal Modifier - "plum & lavender" dark theme, the same as Digivice Color Modifier's
   (its tokens, buttons, fields, cards, notes, dialogs and toasts), with the Crest of Kindness logo. */
:root {
  color-scheme: dark;
  --bg: #1c1825; --panel: #25202f; --panel2: #2d2738; --line: #362f43; --line2: #453d56;
  --text: #e2dfe9; --muted: #a198b3; --faint: #786f8c;
  --accent: #bc98f9; --accent2: #d1b9fe; --accent-bg: #4f4365; --crest: #fea3fc; --orange: #f4c459; --green: #7bd88f; --red: #f17b7b; --blue: #7fb5ff;
  --card: #221e2c; --card-hover: #282232; --well: #15121c;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 650; }
h4 { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent2); }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
code { background: #1a1623; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.num { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.icon { flex-shrink: 0; }
:focus-visible { outline: 2px solid #9f87cb; outline-offset: 1px; }

/* buttons (Digivice Color Modifier's) */
.btn { background: #322b3f; border: 1px solid #473f58; color: var(--text); border-radius: 5px; padding: 6px 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.btn:hover:not(:disabled) { background: #3f374e; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #262033; font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: var(--accent2); }
.btn.go { background: #2e4a3a; border-color: #3c6b4a; color: #c9f2d6; font-weight: 650; }
.btn.danger { color: var(--red); border-color: #6b3b3b; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: #352e42; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.icon-only { padding: 6px; }
.icon-btn { background: transparent; border: 0; color: var(--muted); padding: 4px; border-radius: 5px; cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: #352e42; color: var(--text); }

/* fields */
input, select, textarea { background: #1a1623; border: 1px solid #463c57; border-radius: 4px; padding: 6px 8px; min-width: 0; }
input[type=text], input[type=number], input[type=search], input[type=url], input[type=password], select, textarea { width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9f87cb; outline-offset: -1px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; padding: 0; }
input[type=range] { accent-color: var(--accent); padding: 0; background: none; border: 0; }
input[type=color] { padding: 2px; height: 30px; width: 56px; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
label.field, .field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 0; }
label.field .help, .field .help { font-size: 11px; color: var(--faint); }
.field input, .field select, .field textarea, .field button { font-size: 13px; color: var(--text); }
.field .seg button { font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }

/* top bar */
.topbar { height: 48px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; padding: 0 10px; background: #292333; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 7px; margin-right: 10px; cursor: pointer; flex-shrink: 0; text-decoration: none; }
.brand-logo { width: 32px; height: 32px; display: block; filter: drop-shadow(0 0 6px #fea3fc40); }
.brand-name, .logo-name { font-weight: 800; letter-spacing: .2px; white-space: nowrap; background: linear-gradient(90deg, var(--crest), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name { font-size: 14px; }
.topbar .sep { width: 1px; height: 22px; background: var(--line2); margin: 0 6px; flex-shrink: 0; }
.file-label { color: var(--muted); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; min-width: 0; }
.src-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px; background: #352e43; color: #d6d2e0; font-size: 11px; white-space: nowrap; }
.src-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.src-chip.on .dot { background: var(--green); }
.src-chip.ro .dot { background: var(--orange); }
.global-search { width: 240px !important; margin-right: 6px; }
.save-btn .count { background: #262033; color: var(--accent2); border-radius: 8px; padding: 0 6px; font-size: 11px; min-width: 20px; text-align: center; }
@media (max-width: 1100px) { .brand-name { display: none; } .global-search { width: 170px !important; } }
@media (max-width: 760px) { .tb-label, .file-label { display: none; } .global-search { width: 120px !important; } }

/* body: navigation + workspace */
.body { flex: 1; display: flex; min-height: 0; }
.nav { width: 200px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 6px 0 20px; }
.nav-group { padding: 2px 0 6px; }
.nav-title { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); padding: 10px 14px 4px; }
.nav-item { width: 100%; display: flex; align-items: center; justify-content: flex-start; background: none; border: 0; border-radius: 0; padding: 7px 14px; color: #cdc8d9; gap: 10px; cursor: pointer; text-align: left; font-size: 13px; text-decoration: none; }
.nav-item:hover { background: #312a3e; }
.nav-item.active { background: var(--accent-bg); color: #d8c5fe; box-shadow: inset 3px 0 var(--accent); }
.nav-item .nav-badge { margin-left: auto; }
@media (max-width: 900px) {
  .nav { width: 52px; overflow-x: hidden; }
  .nav-title { height: 1px; padding: 0; margin: 8px 10px; background: var(--line); color: transparent; overflow: hidden; }
  .nav-item { justify-content: center; padding: 8px 0; }
  .nav-item span { display: none; }
}
.center { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.workspace { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px 40px; }
.page { max-width: 1280px; display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head h2 { font-size: 18px; }
.page-head .lede { margin-top: 2px; color: var(--muted); font-size: 12px; max-width: 900px; }

/* status bar */
.statusbar { height: 28px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-top: 1px solid var(--line); background: #231e2d; font-size: 12px; color: var(--muted); }
.status-changes { color: var(--orange); white-space: nowrap; }
.status-file { color: var(--faint); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statusbar .status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout helpers */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-width: 0; }
.panel.tight { padding: 10px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head .grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.grow { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; padding: 0 5px; border: 1px solid var(--line2); border-radius: 4px; background: #1a1623; }

/* toggles, tabs, chips */
.seg { display: inline-flex; flex-wrap: wrap; }
.seg button { border: 1px solid #473f58; background: #322b3f; padding: 5px 10px; font-size: 12px; cursor: pointer; margin-left: -1px; border-radius: 0; }
.seg button:first-child { border-radius: 5px 0 0 5px; margin-left: 0; }
.seg button:last-child { border-radius: 0 5px 5px 0; }
.seg button:only-child { border-radius: 5px; }
.seg button:hover { background: #3f374e; }
.seg button.on { background: var(--accent-bg); border-color: #9680bf; color: #d8c6fe; position: relative; z-index: 1; }
.seg.col { display: flex; flex-direction: column; }
.seg.col button { margin-left: 0; margin-top: -1px; border-radius: 0; text-align: left; }
.seg.col button:first-child { border-radius: 5px 5px 0 0; margin-top: 0; }
.seg.col button:last-child { border-radius: 0 0 5px 5px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 4px 10px; font-size: 12.5px; background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--muted); cursor: pointer; }
.tabs button:hover { background: #312a3e; color: var(--text); }
.tabs button.on { background: var(--accent-bg); color: #d8c5fe; border-color: #796998; }
.badge { display: inline-flex; align-items: center; font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: #3c344b; color: #dcd8e6; white-space: nowrap; letter-spacing: .2px; }
.badge.changed { background: #5b4d21; color: #ffe6a0; }
.badge.ok { background: #2e4a3a; color: #bff0cf; }
.badge.err { background: #5e2f2f; color: #ffc2c2; }
.badge.blue { background: #2f3f5e; color: #bfd8ff; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #352e43; color: #d6d2e0; }

/* notes (Digivice Color Modifier's note boxes) */
.note:has(> .icon) { display: flex; gap: 8px; align-items: flex-start; }
.note { padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5; background: #2c243c; border: 1px solid #34405e; color: #dacff3; }
.note.warn { background: #3a2a22; border-color: #6d532c; color: #f8ddae; }
.note.ok { background: #1f3326; border-color: #2f6b44; color: #c9f2d6; }
.note.bad { background: #3a2428; border-color: #6b3b3b; color: #ffd3d3; }
.note > .icon { margin-top: 1px; }
.note code { background: #00000030; }

/* pixel previews */
canvas.pix, img.pix { image-rendering: pixelated; image-rendering: crisp-edges; }
.checker { background: repeating-conic-gradient(#1c1825 0% 25%, #241f2e 0% 50%) 50% / 16px 16px; }
.screen { background: var(--well); border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: inline-flex; }
.screen canvas { display: block; }

/* home (Digivice Color Modifier's home) */
.home { display: flex; flex-direction: column; gap: 14px; max-width: 1280px; }
.dropzone { border: 2px dashed #5f5672; border-radius: 16px; padding: 36px 20px 30px; text-align: center; background: radial-gradient(#272034, #1e1a27); }
.dropzone h2 { margin: 10px 0 6px; font-size: 22px; }
.dropzone.drop-hover { border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent2), 0 0 16px #bc98f9aa; }
.dropzone .home-logo { margin: 0 auto 4px; }
.dropzone .muted { max-width: 760px; margin: 8px auto 0; }
.dropzone .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.home-logo { width: 112px; height: 112px; display: block; filter: drop-shadow(0 0 12px #fea3fc55); }
.logo-name { font-size: 17px; }
.home-version { font-size: 12px; }
.piracy-notice { max-width: 780px; margin: 14px auto; padding: 12px 18px 14px; border: 2px solid #ff6b6b; border-radius: 10px; background: #3d1d25; color: #ffe3e3; text-align: center; box-shadow: 0 0 0 3px #ff6b6b26, 0 0 22px #ff6b6b40; }
.piracy-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 900; letter-spacing: .5px; color: #ff8f8f; }
.piracy-notice p { margin: 7px 0 0; font-size: 13.5px; line-height: 1.5; }
.piracy-notice b { color: #fff; font-weight: 850; }
.piracy-notice .piracy-big { font-size: 15.5px; font-weight: 900; letter-spacing: .3px; color: #ffd166; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; min-height: 120px; text-align: left; color: var(--text); font-size: 13px; }
.tile:hover { border-color: var(--accent); background: #272034; }
.tile h3 { margin: 0; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.tile p { margin: 0; color: var(--muted); font-size: 12px; }
.tile.logo-tile { cursor: default; align-items: center; justify-content: center; text-align: center; gap: 6px; background: radial-gradient(circle at 50% 38%, #fea3fc1f, transparent 62%), var(--card); }
.tile.logo-tile:hover { border-color: var(--line); }
.tile.static { cursor: default; }
.tile.static:hover { border-color: var(--line); background: var(--card); }
.tile ul { margin: 0; padding-left: 18px; max-height: 160px; overflow: auto; color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 12.5px; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv > span { overflow-wrap: anywhere; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; }
.steps b { color: var(--text); }

/* Digimon browser */
.devbar, .listbar { display: flex; gap: 2px; flex-wrap: wrap; }
.devbar button, .listbar button { padding: 4px 10px; font-size: 12.5px; background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--muted); cursor: pointer; }
.devbar button:hover, .listbar button:hover { background: #312a3e; color: var(--text); }
.devbar button.on, .listbar button.on { background: var(--accent-bg); color: #d8c5fe; border-color: #796998; }
.devbar button { font-weight: 600; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mon { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px; cursor: pointer; min-width: 0; color: var(--text); font-size: 13px; }
.mon:hover { border-color: #625a73; background: var(--card-hover); }
.mon.selected { border-color: var(--accent); background: #3a324b; box-shadow: 0 0 0 1px var(--accent) inset; }
.mon .pics { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; align-items: center; }
.mon .pics > div { aspect-ratio: 1; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mon .pics canvas { width: 100%; height: 100%; object-fit: contain; }
.mon .pics .cut { background: var(--well); }
.mon .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mon .nm { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon .sub { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon .top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 16px; }
.mon .idx { font: 600 10.5px ui-monospace, Menlo, Consolas, monospace; color: var(--faint); }
.mon .flags { display: flex; gap: 3px; }
.mon.locked .pics { opacity: 0.8; }

/* dialogs (Digivice Color Modifier's modal) */
.overlay { position: fixed; inset: 0; background: #00000099; display: flex; align-items: flex-start; justify-content: center; padding: 20px 15px; z-index: 50; overflow: auto; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; width: min(560px, 100%); box-shadow: 0 20px 60px #000000aa; display: flex; flex-direction: column; max-height: calc(100vh - 40px); margin: auto 0; }
.dialog.wide { width: min(1120px, 100%); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.dialog-body { padding: 14px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.progress-box { display: flex; flex-direction: column; gap: 10px; }
.bar { height: 10px; background: var(--well); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--crest), var(--accent)); transition: width .15s; }
.ctx-menu { position: fixed; z-index: 1000; min-width: 230px; background: #2a2336; border: 1px solid #5a516d; border-radius: 7px; padding: 4px; box-shadow: 0 8px 28px #00000099; }
.ctx-menu button { display: flex; width: 100%; border: 0; background: none; padding: 7px 8px; justify-content: flex-start; align-items: center; gap: 8px; border-radius: 4px; cursor: pointer; text-align: left; }
.ctx-menu button:hover:not(:disabled) { background: #5d4f77; }
.ctx-menu button:disabled { opacity: .4; cursor: default; }
.ctx-menu .sep { height: 1px; background: #453b57; margin: 4px 3px; }
#toasts { position: fixed; right: 16px; bottom: 40px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 8px; align-items: center; background: #2e273b; border: 1px solid #4d4360; border-radius: 8px; padding: 9px 12px; box-shadow: 0 8px 24px #00000088; transition: opacity .3s, transform .3s; font-size: 13px; }
.toast.ok { border-color: #3c6b4a; }
.toast.ok .icon { color: var(--green); }
.toast.error { border-color: #7a3b3b; background: #3a2528; }
.toast.error .icon { color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Digimon editor */
.editor { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.editor-side { display: flex; flex-direction: column; gap: 10px; }
.editor-side .screen { justify-content: center; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 12px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .field label { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.skills { display: flex; flex-direction: column; gap: 6px; }
.skills .row input { flex: 1; }
.atk { display: flex; gap: 8px; align-items: center; }
.atk .atk-prev { width: 48px; height: 48px; border-radius: 6px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; }
.frames { display: flex; flex-wrap: wrap; gap: 8px; }
.frame { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #1e1a27; cursor: pointer; }
.frame:hover { border-color: var(--accent); }
.frame.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #3a324b; }
.frame .lbl { font: 600 10.5px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.frame select { width: auto; font-size: 12px; padding: 3px 6px; }
.pages { display: flex; flex-wrap: wrap; gap: 12px; }
.page-card { display: flex; flex-direction: column; gap: 6px; }
.page-card canvas { width: 320px; max-width: 100%; height: auto; border-radius: 4px; background: #000; border: 1px solid var(--line); }

/* crop tool */
.crop-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.crop-stage { position: relative; background: var(--well); border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 10px; touch-action: none; cursor: grab; }
.crop-stage canvas { max-width: 100%; height: auto; }
.crop-stage.dragging { cursor: grabbing; }

/* analyzer */
.an-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.tree { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; padding-right: 4px; }
.tree details { border: 1px solid var(--line); border-radius: 6px; background: #1e1a27; }
.tree summary { padding: 6px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 12.5px; }
.tree .lists { padding: 4px 10px 8px 30px; display: flex; flex-direction: column; gap: 4px; }
details > summary { cursor: pointer; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card-item { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; min-width: 0; }
.card-item:hover { border-color: #625a73; background: var(--card-hover); }
.card-item .imgs { display: grid; grid-template-columns: 4fr 3fr; gap: 6px; align-items: center; }
.card-item canvas { width: 100%; height: auto; border-radius: 4px; display: block; background: var(--well); }
.card-item .cap { display: flex; gap: 6px; align-items: center; min-width: 0; font-size: 12px; }
.card-item .cap b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-weight: 600; }
.card-item .src { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-item.skip { opacity: 0.5; }
.cand-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.cand-strip button { flex: none; border: 2px solid transparent; padding: 0; border-radius: 6px; background: var(--well); cursor: pointer; width: 112px; height: 84px; overflow: hidden; }
.cand-strip button.on { border-color: var(--accent); }
.cand-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* tables, graphics */
.table-wrap { overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: 12px; }
table.list th, table.list td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); font-weight: 600; }
table.list tr:hover td { background: var(--card-hover); }
.gfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gfx { display: flex; flex-direction: column; gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; min-width: 0; color: var(--text); font-size: 12px; text-align: left; }
.gfx:hover { border-color: #625a73; background: var(--card-hover); }
.gfx .thumb { height: 96px; display: flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; }
.gfx .thumb canvas, .gfx .thumb img { max-width: 100%; max-height: 96px; }
.gfx .path { font: 10.5px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 2px dashed #5f5672; border-radius: 12px; background: radial-gradient(#272034, #1e1a27); display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Find Digimon results */
.search-hits { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow: auto; }
.search-hit { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; color: var(--text); font-size: 13px; }
.search-hit:hover { background: #312a3e; border-color: var(--line2); }
.search-hit .where { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.search-hit .idx { font: 600 10.5px ui-monospace, Menlo, Consolas, monospace; color: var(--faint); width: 34px; }

/* Spritesheets & Resources (Digivice Color Modifier's) */
.res-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.res-side { position: sticky; top: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.res-side h3 { display: flex; gap: 8px; align-items: center; }
.res-controls { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: flex-end; }
.res-search { flex: 1 1 300px; }
.res-search .row { flex-wrap: nowrap; }
.res-count { margin: 2px 0 4px; color: var(--muted); }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.res-card { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; min-width: 0; text-align: left; color: var(--text); }
.res-card:hover { border-color: var(--line2); }
.res-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.res-pic { height: 112px; display: flex; align-items: center; justify-content: center; background: var(--well); border-radius: 6px; overflow: hidden; }
.res-img { width: 128px; height: 112px; object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; }
.res-pic.baby .res-img { width: 96px; height: 72px; }
.res-pic.photo .res-img { image-rendering: auto; object-fit: cover; width: 100%; }
.res-nopic { font-size: 11px; color: var(--faint); }
.res-name { font-weight: 650; font-size: 13px; margin-top: 6px; overflow-wrap: anywhere; }
.res-meta, .res-src { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.res-dl { position: absolute; top: 12px; right: 12px; opacity: .85; }
.res-sheet-img { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 4px; }
.res-sheet-img.photo { image-rendering: auto; }
.web-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 58vh; overflow: auto; padding: 2px; }
.web-hit { display: flex; flex-direction: column; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; color: var(--text); text-align: left; min-width: 0; }
.web-hit:hover { border-color: var(--accent); }
.web-hit img { width: 100%; height: 110px; object-fit: cover; border-radius: 5px; background: var(--well); display: block; }
.web-hit span { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1000px) {
  .editor, .an-layout, .crop-wrap, .res-layout { grid-template-columns: minmax(0, 1fr); }
  .res-side { position: static; }
  .form-grid .span2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
