/*
   dashboard.css - CyberKitchen single-page dashboard
   Shared design system for the shell and every tool panel.
   Fully offline: system fonts, inline SVG icons, no external assets.
*/

/* Theme tokens */
:root{
  --bg:#f6f8fb; --surf:#ffffff; --inset:#f1f5f9; --inset2:#e8edf3;
  --txt:#0f172a; --muted:#64748b; --faint:#94a3b8;
  --acc:#3b82f6; --ok:#10b981; --err:#ef4444; --warn:#f59e0b;
  --bdr:#e5eaf0; --cbdr:#c3cede; --shd:rgba(15,23,42,.06);
  color-scheme:light; /* native parts (open dropdown lists, scrollbars) follow the theme */
}
[data-theme="dark"]{
  --bg:#0d1117; --surf:#161b22; --inset:#1b212a; --inset2:#252c37;
  --txt:#e6edf3; --muted:#8b949e; --faint:#6b7480;
  --bdr:#2a313c; --cbdr:#3a424f; --shd:rgba(0,0,0,.35);
  color-scheme:dark;
}

*,*::before,*::after{margin:0;padding:0;box-sizing:border-box;}
html{overflow:hidden;}
body{
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  font-size:14px; background:var(--bg); color:var(--txt); line-height:1.5;
  height:calc(100vh / var(--zoom, 1)); display:flex; flex-direction:column; overflow:hidden;
  -webkit-font-smoothing:antialiased;
  zoom:var(--zoom, 1); /* Text size control in the top bar; window-tied heights divide by it */
}
svg{display:block;}
/* Theme switch: no transitions for that one frame, so nothing fades in from the old theme */
.theme-switching *, .theme-switching *::before, .theme-switching *::after{transition:none !important;}
button{font-family:inherit;}

/* Thin, minimal scrollbars (3px thumb, hidden until the area is hovered, no track or arrows) across every tool and scrollable area. Chrome ignores the ::-webkit-scrollbar
   size whenever the standard scrollbar-width is set (and "thin" is 10px), so only browsers without
   ::-webkit-scrollbar (Firefox) get the standard properties. */
@supports not selector(::-webkit-scrollbar){ *{scrollbar-width:thin; scrollbar-color:var(--bdr) transparent;} }
::-webkit-scrollbar{width:3px; height:3px;}
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner{background:transparent;}
::-webkit-scrollbar-button{display:none; width:0; height:0;}
::-webkit-scrollbar-thumb{background:transparent; border-radius:3px;}
:hover::-webkit-scrollbar-thumb{background:var(--cbdr);}
::-webkit-scrollbar-thumb:hover{background:var(--muted);}

/* Slim top bar */
header{
  display:flex; align-items:center; gap:7px; padding:0 12px;
  background:var(--surf); flex-shrink:0; height:40px; box-shadow:0 1px 3px var(--shd); position:relative; z-index:45;
}
.brand{
  display:flex; align-items:center; gap:7px; font-size:17px; font-weight:800; letter-spacing:-.4px;
  background:linear-gradient(120deg,#3b82f6,#8b5cf6);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
  text-decoration:none;
}
.brand svg{stroke:#8b5cf6;}
.sub{font-size:11.5px; color:var(--muted); font-weight:500;}
.dot{width:3px; height:3px; border-radius:50%; background:var(--faint);}
.spacer{flex:1;}
.icon-btn{
  width:28px; height:28px; border-radius:50%; background:none; border:none;
  display:flex; align-items:center; justify-content:center; color:var(--muted); cursor:pointer; transition:.15s;
}
.icon-btn:hover{color:var(--acc); background:rgba(59,130,246,.14);}
/* Text size readout between A- and A+: click to go back to 100% */
.zoom-pct{height:28px; min-width:44px; padding:0 6px; border-radius:14px; background:none; border:none; color:var(--muted);
  font-size:11.5px; font-weight:700; font-variant-numeric:tabular-nums; cursor:pointer; transition:.15s;}
.zoom-pct:hover{color:var(--acc); background:rgba(59,130,246,.14);}
/* Sidebar show/hide toggle, on the tool-title line at every screen size */
.nav-open{
  display:inline-flex; width:30px; height:30px; border-radius:8px; flex-shrink:0;
  background:var(--inset2); border:none; color:var(--muted);
  align-items:center; justify-content:center; cursor:pointer; transition:.13s;
}
.nav-open:hover{color:var(--acc); background:rgba(59,130,246,.14);}

/* Shell: content is full width; the sidebar is an off-canvas drawer at every size */
.shell{flex:1; display:grid; grid-template-columns:1fr; min-height:0;}

/* Sidebar drawer: hidden by default, slides in when body has .drawer-open */
nav{
  position:fixed; top:40px; left:0; bottom:0; width:224px; z-index:40;
  border-right:1px solid var(--bdr); background:var(--surf); padding:10px 9px;
  display:flex; flex-direction:column; min-height:0; overflow:hidden;
  transform:translateX(-100%); transition:transform .22s ease; box-shadow:0 10px 34px rgba(0,0,0,.28);
}
body.drawer-open nav{transform:translateX(0);}
.nav-scroll{flex:1; overflow-y:auto; min-height:0; margin:0 -3px; padding:0 3px;}
.grp{
  font-size:10.5px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--muted); padding:12px 8px 5px;
}
.grp:first-child{padding-top:2px;}
.item{
  display:flex; align-items:center; gap:9px; padding:6px 9px; border-radius:7px;
  font-size:13px; font-weight:500; color:var(--txt); cursor:pointer;
  border:none; transition:.13s; width:100%; text-align:left; background:none;
}
.item svg{stroke:var(--muted); flex-shrink:0;}
.item .tag{
  margin-left:auto; font-size:9px; font-weight:700; padding:1px 7px; border-radius:20px;
  background:var(--inset2); color:var(--muted); font-family:'SF Mono','Consolas',monospace;
}
.item:hover{background:var(--inset);}
.item.active{background:rgba(245,158,11,.14); color:#c2760a; font-weight:600;}
.item.active svg{stroke:var(--warn);}
.item.active .tag{background:rgba(245,158,11,.16); color:#c2760a;}

/* Content
   Fill the viewport when there is room, but scroll instead of clipping when
   the window is too short (or a config panel is tall) so nothing overlaps or
   gets cut off on small screens. */
main{padding:8px; overflow-x:hidden; overflow-y:auto; display:flex; flex-direction:column; min-width:0; gap:6px;}
.tool{display:flex; flex-direction:column; gap:6px; min-height:0; flex:1;}
.tool[hidden]{display:none;}
.tool-head{display:flex; align-items:center; gap:9px; flex-shrink:0;}
.tool-head h1{
  font-size:16.5px; font-weight:800; letter-spacing:-.3px;
  background:linear-gradient(120deg,#3b82f6,#8b5cf6);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
}
.pill{
  font-size:10px; font-weight:700; padding:2px 9px; border-radius:20px;
  background:var(--inset2); color:var(--muted); font-family:'SF Mono','Consolas',monospace;
}

/* Panels */
.panel{
  background:var(--surf); border:none; border-radius:12px; box-shadow:0 1px 3px var(--shd);
  min-height:0; display:flex; flex-direction:column;
}
.panel-hdr{
  font-size:11px; font-weight:800; letter-spacing:.07em; color:var(--muted);
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
}
.panel-hdr svg{stroke:var(--muted);}

/* Configuration */
.config{flex-shrink:0;}
.cfg-strip{display:flex; align-items:center; gap:12px; padding:10px 13px 4px;}
.sel{display:flex; align-items:center; gap:10px; min-width:0; flex:1;}
.sel-ico{
  width:32px; height:32px; border-radius:9px; background:rgba(59,130,246,.12); color:var(--acc);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.sel-txt{display:flex; flex-direction:column; min-width:0;}
.sel-name{font-size:13.5px; font-weight:700; letter-spacing:-.2px; display:flex; align-items:center; gap:7px;}
.sel-name .badge{
  font-size:8.5px; font-weight:800; padding:2px 7px; border-radius:20px;
  background:rgba(59,130,246,.13); color:var(--acc); font-family:'SF Mono','Consolas',monospace;
}
/* Status text wraps in every tool rather than being cut off */
.sel-desc{font-size:11px; color:var(--muted);}
.acts{display:flex; align-items:center; gap:6px; flex-shrink:0;}

/* Primary action buttons (solid, flat) */
.prim{
  height:28px; padding:0 11px; border-radius:7px; font-size:12.5px; font-weight:700; color:#fff; border:none;
  display:inline-flex; align-items:center; gap:5px; cursor:pointer; transition:.13s;
}
.prim:hover{filter:brightness(1.06);}
.prim:disabled{opacity:.45; cursor:not-allowed; pointer-events:none;}
.prim.busy{opacity:.9;}
.prim.busy::before{content:''; width:11px; height:11px; border-radius:50%; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; animation:ck-spin .7s linear infinite;}
@keyframes ck-spin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion:reduce){.prim.busy::before{animation-duration:2s;}}
.dec{background:#2563eb;} /* blue-600: white text 5.2:1 (WCAG AA) */
.enc{background:#047857;} /* emerald-700: white text 5.5:1 (WCAG AA) */

/* Icon buttons: the label always shows next to the icon */
.ib{
  height:28px; padding:0 8px; border-radius:7px; background:var(--inset2); border:none;
  color:var(--muted); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:.13s;
}
.ib:hover{color:var(--acc); background:rgba(59,130,246,.14);}
.ib:disabled{opacity:.4; cursor:not-allowed; pointer-events:none;}
.ib .lbl{white-space:nowrap; font-size:11px; font-weight:600; margin-left:5px;}
/* Small screens: icon only, square; the name stays in the tooltip and for screen readers */
@media (max-width:820px){ .ib{width:28px; padding:0;} .ib .lbl{display:none;} }

/* Encoding / algorithm picker: grouped uniform grid */
.picker{padding:11px 13px; display:grid; grid-template-columns:auto 1fr; gap:9px 14px; align-items:center;}
.pk-label{
  font-size:9px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
  color:var(--muted); text-align:right; white-space:nowrap;
}
.pk-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(80px,1fr)); gap:4px;}
.eb{
  height:28px; padding:0 9px; border:none; border-radius:6px; background:var(--inset2); color:var(--muted);
  font-size:11.5px; font-weight:600; cursor:pointer; transition:.12s; text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.eb:hover{color:var(--acc); background:rgba(59,130,246,.14);}
.eb.active{background:#2563eb; color:#fff;}

/* Input / Output */
/* minmax(0,1fr): a long unbreakable line (code, URL) scrolls inside its panel instead of
   widening the column and pushing the layout off-screen */
.io{flex:1; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:6px; min-height:0;}
.io-1col{grid-template-columns:minmax(0,1fr);}
/* Keep panels usably tall; when they cannot all fit, main scrolls rather than
   squeezing them into each other. */
.io-p{padding:11px 12px; gap:9px; position:relative; min-height:180px;}
.fill{flex:1;}
.tb{display:flex; gap:4px; align-items:center; flex-wrap:wrap; justify-content:flex-end;}
.ta{
  flex:1; background:var(--inset); border:none; border-radius:9px; padding:12px;
  font-family:'SF Mono','Fira Code','Consolas',monospace; font-size:12.5px; line-height:1.7; color:var(--txt);
  overflow:auto; white-space:pre-wrap; word-break:break-all; resize:none; width:100%; outline:none;
}
.ta:focus{outline:none; box-shadow:none;}
.ta::placeholder{color:var(--muted); opacity:.8; font-style:italic;}
/* Verify result: a coloured inset ring, so nothing shifts */
.ta.verify-match{box-shadow:inset 0 0 0 1px rgba(16,185,129,.55);}
.ta.verify-fail{box-shadow:inset 0 0 0 1px rgba(239,68,68,.55);}
.char-count{
  position:absolute; bottom:19px; right:23px; pointer-events:none; z-index:2;
  font-size:10px; font-weight:800; letter-spacing:.02em; font-family:'SF Mono','Consolas',monospace;
  padding:3px 9px; border-radius:20px;
  background:var(--surf); color:var(--acc);
}
.pw-strength{
  position:absolute; bottom:19px; pointer-events:none; z-index:2;
  font-size:9px; font-weight:800; letter-spacing:.04em; text-transform:uppercase;
  padding:3px 9px; border-radius:20px;
}
.pw-strength.ok{ background:rgba(16,185,129,.15); color:var(--ok); }
.pw-strength.warn{ background:rgba(245,158,11,.15); color:var(--warn); }
.pw-strength.err{ background:rgba(239,68,68,.15); color:var(--err); }
.pw-strength.acc{ background:rgba(59,130,246,.15); color:var(--acc); }

/* Compact form controls for tool config panels */
.field{display:flex; flex-direction:column; gap:3px;}
.field > label{font-size:12px; font-weight:600; color:var(--muted); white-space:nowrap;}
.cfg-form{padding:11px 13px; display:flex; flex-wrap:wrap; gap:10px 16px; align-items:flex-end;}
.inp{
  background:var(--inset2); color:var(--txt); border:none; border-radius:6px;
  height:28px; padding:0 8px; font-size:12.5px; outline:none; transition:background .15s, box-shadow .15s; width:100%;
  -webkit-appearance:none; appearance:none;
}
.inp:focus{outline:none; box-shadow:none;}
/* Field row: a text input takes the free space, then its format dropdown and buttons */
.inp-row{display:flex; gap:5px; align-items:center;}
.inp-row > input.inp:not(.sm){flex:1; min-width:0;}
.inp-row > select.inp{width:auto;}
/* Preset buttons (and an optional custom value), wrapping when narrow */
.chip-row{display:flex; gap:5px; align-items:center; flex-wrap:wrap;}
/* Dropdowns have no caret, so keyboard focus needs a visible ring */
select.inp:focus-visible{box-shadow:0 0 0 2px rgba(59,130,246,.55);}
/* Small number fields: one width everywhere */
.inp.sm{width:84px; flex:none;}
/* A dropdown always shows its value on one line; the grid columns below widen to fit it */
select.inp{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}

/* Dropdown affordance: chevron so selects don't read as plain buttons */
select.inp{
  cursor:pointer; padding-right:26px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888f9c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center; background-size:11px;
}
/* Opaque on purpose: the open list is drawn from the select's background, and a see-through
   tint shows up light in that separate popup until the pointer leaves the select */
select.inp:hover{background-color:color-mix(in srgb, var(--acc) 14%, var(--inset2));}
/* Chrome/Edge: draw the open list inside the page instead of an OS popup window, so it uses the
   theme colours from the first frame (the native popup briefly shows its default colours).
   Other browsers ignore this and keep their native list. */
@supports (appearance:base-select){
  select.inp, select.inp::picker(select){appearance:base-select;}
  /* Its button part does not centre text vertically: a line as tall as the 28px control does */
  select.inp{line-height:28px;}
  select.inp::picker-icon{display:none;} /* the chevron is our own background image */
  select.inp::picker(select){border:none; border-radius:8px; padding:4px; margin-top:4px; background:var(--inset2); color:var(--txt); box-shadow:0 8px 28px var(--shd);
    scrollbar-width:thin; scrollbar-color:var(--cbdr) transparent;} /* ::-webkit-scrollbar does not reach this layer */
  select.inp option{padding:6px 8px; border-radius:6px; font-size:12.5px; line-height:1.3;}
  select.inp option::checkmark{display:none;}
  select.inp option:hover, select.inp option:focus-visible{background:rgba(59,130,246,.14); color:var(--acc); outline:none;}
  select.inp option:checked{color:var(--acc); font-weight:700;}
  /* Group headings: small caps-style labels; the options under them keep the normal look */
  select.inp optgroup{font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); padding:8px 8px 2px;}
  select.inp optgroup option{font-weight:400; letter-spacing:normal; text-transform:none; color:var(--txt);}
  select.inp optgroup option:checked{color:var(--acc); font-weight:700;}
}


/* Two-column config grid (e.g. AES): left keys, right options 2x2 */
.cfg-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px 18px; padding:11px 13px;}
.cfg-grid.wide-left{grid-template-columns:minmax(0,1fr) minmax(220px,max-content);}
.cfg-grid.wide-right{grid-template-columns:minmax(220px,max-content) minmax(0,1fr);}
.cfg-grid.split-73{grid-template-columns:7fr 3fr;}
.hash-left{display:grid; grid-template-columns:minmax(0,600px) minmax(0,1fr); gap:16px; align-items:start;}
.argon-left{display:grid; grid-template-columns:190px 320px 150px minmax(0,1fr); gap:16px; align-items:start;}
.cfg-grid .col, .pw-grid .col, .fd-grid .col{display:flex; flex-direction:column; gap:12px;}
/* Fake data: type picker (col 1) | settings (col 2, with Count | Format on top) */
.fd-grid{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; align-items:start; padding:8px 13px 12px;}
.fd-grid .cfg-form{padding:6px 0 0;}
.fd-top{display:grid; grid-template-columns:1fr 1fr; gap:14px 18px; align-items:start;}
/* Password generator: preset+mode row, then a compact multi-column config */
.pw-top{display:grid; grid-template-columns:1fr 1fr; gap:8px; align-items:start;}
.pw-row{display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; padding:8px 13px 4px;}
.pw-grid{display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:16px 22px; align-items:start; padding:6px 13px 12px;}
.cfg-grid .col2{display:grid; grid-template-columns:1fr 1fr; gap:12px 14px; align-content:start;}
.cfg-grid .col2.kv-mp{grid-template-columns:minmax(0,7fr) minmax(max-content,3fr);}
/* Same, settings first: Algorithm / Padding on the left, the wide byte fields on the right */
.cfg-grid .col2.mp-kv{grid-template-columns:minmax(max-content,3fr) minmax(0,7fr);}
@media (max-width:820px){
  .cfg-grid, .cfg-grid.wide-left, .cfg-grid.wide-right, .cfg-grid.split-73{grid-template-columns:1fr;}
  .hash-left, .argon-left{grid-template-columns:1fr;}
  .cfg-grid .col2, .cfg-grid .col2.kv-mp, .cfg-grid .col2.mp-kv{grid-template-columns:1fr;}
  .pw-grid{grid-template-columns:1fr 1fr;}
}
@media (max-width:560px){
  .pw-top, .pw-row, .pw-grid{grid-template-columns:1fr;}
}
@media (max-width:820px){
  .fd-grid, .fd-top{grid-template-columns:1fr;}
}
/* Switch toggle (labelled) */
.switch{display:inline-flex; align-items:center; gap:8px; cursor:pointer; font-size:12px; color:var(--txt); user-select:none;}
.switch > input{position:absolute; opacity:0; width:0; height:0;}
.switch .track{width:34px; height:18px; border-radius:20px; background:var(--inset2); border:none; position:relative; transition:.2s; flex-shrink:0;}
.switch .track::after{content:''; position:absolute; width:12px; height:12px; border-radius:50%; background:var(--muted); top:2px; left:2px; transition:.2s;}
.switch > input:checked + .track{background:var(--acc);}
.switch > input:focus-visible + .track{box-shadow:0 0 0 2px rgba(59,130,246,.55);}
.switch > input:checked + .track::after{transform:translateX(16px); background:#fff;}

/* Length row: slim slider + custom number input */
.length-row{display:grid; grid-template-columns:1fr 84px; gap:10px; align-items:center;}
input[type=range]{-webkit-appearance:none; appearance:none; width:100%; height:4px; background:var(--inset2); border-radius:20px; outline:none; cursor:pointer;}
input[type=range]::-webkit-slider-runnable-track{height:4px; background:var(--inset2); border-radius:20px;}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none; appearance:none; margin-top:-5px; width:14px; height:14px; border-radius:50%; background:var(--acc); border:2px solid var(--surf); box-shadow:0 1px 3px var(--shd); cursor:pointer;}
input[type=range]::-moz-range-track{height:4px; background:var(--inset2); border-radius:20px;}
input[type=range]::-moz-range-thumb{width:14px; height:14px; border-radius:50%; background:var(--acc); border:2px solid var(--surf); cursor:pointer;}
/* Labelled option switches (password generator) */
.pw-opts{display:flex; flex-direction:column; gap:9px;}
.pw-opt{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.pw-opt-label{font-size:11.5px; font-weight:600; color:var(--muted);}
.strength{height:6px; border-radius:4px; background:var(--inset2); overflow:hidden; margin-top:4px;}
.strength > span{display:block; height:100%; width:0; transition:width .2s, background .2s;}

/* Markdown preview */
.md-preview{flex:1; overflow:auto; padding:12px 14px; background:var(--inset); border-radius:9px; font-size:13.5px; line-height:1.6; color:var(--txt); min-height:0; word-wrap:break-word;}
.md-preview h1,.md-preview h2,.md-preview h3,.md-preview h4,.md-preview h5,.md-preview h6{font-weight:800; letter-spacing:-.2px; line-height:1.3; margin:16px 0 8px;}
.md-preview h1{font-size:1.7em; border-bottom:1px solid var(--bdr); padding-bottom:6px;}
.md-preview h2{font-size:1.4em; border-bottom:1px solid var(--bdr); padding-bottom:5px;}
.md-preview h3{font-size:1.2em;} .md-preview h4{font-size:1.05em;} .md-preview h5,.md-preview h6{font-size:.95em; color:var(--muted);}
.md-preview p{margin:0 0 10px;}
.md-preview a{color:var(--acc); text-decoration:none;}
.md-preview a:hover{text-decoration:underline;}
.md-preview code{font-family:'SF Mono','Fira Code','Consolas',monospace; font-size:.88em; background:var(--inset2); padding:1px 5px; border-radius:5px;}
.md-preview pre{background:var(--surf); border:1px solid var(--bdr); border-radius:9px; padding:12px; overflow:auto; margin:0 0 12px;}
.md-preview pre code{background:none; padding:0; font-size:12.5px; line-height:1.55;}
.md-preview ul,.md-preview ol{margin:0 0 10px; padding-left:22px;}
.md-preview li{margin:3px 0;}
.md-preview blockquote{margin:0 0 12px; padding:2px 14px; border-left:3px solid var(--cbdr); color:var(--muted);}
.md-preview hr{border:none; border-top:1px solid var(--bdr); margin:16px 0;}
.md-preview img{max-width:100%; border-radius:6px;}
.md-preview table{border-collapse:collapse; margin:0 0 12px; display:block; overflow-x:auto;}
.md-preview th,.md-preview td{border:1px solid var(--bdr); padding:6px 11px; text-align:left;}
.md-preview th{background:var(--inset2); font-weight:700;}
.md-preview > :first-child{margin-top:0;}

/* File Checksum: drop zone (a .ta so Verify colours it like the text panels) */
.cs-drop{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; text-align:center; cursor:pointer; font-family:inherit; white-space:normal; word-break:break-word; min-height:150px;}
/* Large area: a faint hover tint, slightly stronger while a file is dragged over it */
.cs-drop:hover{background:rgba(59,130,246,.05);}
.cs-drop.drag{background:rgba(59,130,246,.09);}
.cs-drop svg{stroke:var(--faint);}
.cs-drop .cs-name{font-size:13px; font-weight:700; color:var(--txt);}
.cs-drop .cs-meta{font-size:11px; color:var(--muted); font-family:'SF Mono','Consolas',monospace;}
.cs-drop .cs-hint{font-size:11.5px; color:var(--muted);}

/* HTML Viewer: sandboxed preview frame and captured console */
.html-frame{flex:1; width:100%; min-height:240px; border:1px solid var(--bdr); border-radius:9px; background:#fff;}
.html-console{border:none; border-radius:9px; background:var(--inset); display:flex; flex-direction:column; max-height:150px; flex-shrink:0;}
.html-console-hdr{display:flex; align-items:center; gap:6px; padding:4px 6px 4px 10px; border-bottom:1px solid var(--bdr); font-size:11px; font-weight:800; letter-spacing:.07em; color:var(--muted);}
.html-console-hdr svg{stroke:var(--muted);}
.html-console-body{overflow:auto; min-height:34px; font-family:'SF Mono','Fira Code','Consolas',monospace; font-size:11.5px; line-height:1.5;}
.html-console-body:empty::after{content:'Console output appears here.'; display:block; padding:7px 10px; color:var(--muted); font-style:italic; opacity:.6;}
.html-log{padding:3px 10px; border-bottom:1px solid var(--bdr); white-space:pre-wrap; word-break:break-word; color:var(--txt);}
.html-log:last-child{border-bottom:none;}
.html-log.warn{color:var(--warn);}
.html-log.error{color:var(--err);}
.html-log.info,.html-log.debug{color:var(--muted);}

/* QR code output area */
.qr-box{flex:1; display:flex; align-items:center; justify-content:center; overflow:auto; padding:12px; min-height:0; background:var(--inset); border-radius:9px;}
.qr-box svg{border-radius:6px;}

/* Placeholder (tools not yet built) */
.ph{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; text-align:center; padding:24px;}
.ph-ico{
  width:54px; height:54px; border-radius:14px; background:rgba(59,130,246,.1); color:var(--acc);
  display:flex; align-items:center; justify-content:center;
}
.ph-title{font-size:15px; font-weight:700;}
.ph-note{font-size:12.5px; color:var(--muted); max-width:420px; line-height:1.6;}

/* Home / landing page: search + per-category cards */
.home{padding:6px 12px 24px;}
.home[hidden]{display:none;}
.home-inner{width:100%; max-width:1340px; margin:0 auto;}
.home-search{
  display:block; width:100%;
  background:var(--inset); color:var(--txt); border:none; border-radius:999px;
  padding:9px 42px 9px 38px; font-size:13px; outline:none; transition:box-shadow .15s;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888f9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:13px center; background-size:15px;
}
.home-search:focus{box-shadow:0 0 0 2px rgba(59,130,246,.55);}
.home-search::placeholder{color:var(--muted);}
.home-search-wrap{position:relative; max-width:440px; margin:16px auto 22px;}
.home-kbd{
  position:absolute; right:12px; top:50%; transform:translateY(-50%); pointer-events:none;
  font-family:'SF Mono','Consolas',monospace; font-size:11px; font-weight:700; line-height:1;
  padding:4px 2px; color:var(--muted);
}
.home-search:focus + .home-kbd, .home-search:not(:placeholder-shown) + .home-kbd{display:none;}
/* Borderless masonry: 3 balanced columns, sections separated by a colored
   header underline (set per category in core.js). */
.home-grid{column-count:3; column-gap:16px;}
.home-cat-card{
  padding:8px 10px;
  display:flex; flex-direction:column; gap:8px; margin:0 0 14px;
  break-inside:avoid; -webkit-column-break-inside:avoid;
}
@media (max-width:860px){ .home-grid{column-count:2;} }
@media (max-width:560px){ .home-grid{column-count:1;} }
.hcc-head{display:flex; align-items:center; gap:10px;}
.hcc-ico{width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.hcc-txt{display:flex; flex-direction:column; min-width:0;}
.hcc-title{font-size:13.5px; font-weight:700; letter-spacing:-.2px;}
.hcc-desc{font-size:11px; color:var(--muted); line-height:1.35;}
.hcc-tools{display:flex; flex-direction:column; gap:1px;}
.hcc-tool{
  display:flex; align-items:center; gap:9px; padding:5px 7px; border-radius:7px; width:100%; text-align:left;
  background:none; border:none; color:var(--txt); cursor:pointer; transition:.12s;
}
.hcc-tool:hover{background:var(--inset);}
.hcc-ticon{color:var(--muted); flex-shrink:0; display:flex;}
.hcc-tool:hover .hcc-ticon{color:var(--acc);}
.hcc-tname{font-size:12px; font-weight:500; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.hcc-ttag{
  font-size:9px; font-weight:700; padding:2px 8px; border-radius:20px; flex-shrink:0;
  background:var(--inset2); color:var(--muted); font-family:'SF Mono','Consolas',monospace;
}

/* Toast */
.toast{
  position:fixed; left:50%; top:22px; transform:translateX(-50%) translateY(-8px);
  padding:9px 16px; border-radius:9px; font-size:12.5px; font-weight:600; z-index:60;
  opacity:0; pointer-events:none; transition:opacity .18s, transform .18s;
  border:1px solid var(--bdr); background:var(--surf); color:var(--txt); box-shadow:0 6px 22px var(--shd);
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; cursor:pointer;}
.toast{display:flex; align-items:center; gap:14px;}
.toast-act{font:inherit; font-weight:800; color:var(--acc); background:none; border:none; cursor:pointer; padding:4px 2px; text-decoration:underline; text-underline-offset:3px;}
.toast-act:hover{color:var(--txt);}
.toast.success{border-color:rgba(16,185,129,.4); color:var(--ok);}
.toast.error{border-color:rgba(239,68,68,.4); color:var(--err);}
.toast.warn{border-color:rgba(245,158,11,.4); color:var(--warn);}

/* Sidebar drawer backdrop (all sizes) */
.nav-backdrop{display:none; position:fixed; inset:40px 0 0 0; background:rgba(0,0,0,.42); z-index:35;}
body.drawer-open .nav-backdrop{display:block;}

/* Small screens: switch from the fixed-viewport app shell to natural document
   scrolling. This restores pull-to-refresh, stops 100vh from clipping the
   bottom, and lets tall tool content flow instead of being squeezed. */
@media (max-width:820px){
  html{overflow-x:clip; overflow-y:visible;}
  body{height:auto; min-height:calc(100vh / var(--zoom, 1)); overflow:visible; display:block;}
  header{position:sticky; top:0; z-index:50;}
  .shell{display:block; min-height:0;}
  main{overflow:visible; height:auto; padding:8px 8px 24px;}
  .tool{flex:none;}
  /* minmax(0,1fr) stops a panel's non-wrapping header toolbar from forcing the
     column wider than the viewport (which clipped input/output on the right) */
  .io{flex:none; grid-template-columns:minmax(0,1fr); min-height:0;}
  .io-p{min-height:220px;}
  /* Let the algorithm label take the full first row so the action buttons
     drop onto their own line instead of cramming beside it. */
  .cfg-strip{flex-wrap:wrap;}
  .sel{flex:1 1 100%;}
  .acts{width:100%; flex-wrap:wrap; justify-content:flex-end;}
}

/* Narrow phones: drop the header subtitle so the brand never crowds the
   theme toggle, and let config forms breathe in a single column. */
@media (max-width:520px){
  header{padding:0 12px; gap:7px;}
  .sub, .dot{display:none;}
  .cfg-form{gap:10px 12px;}
}
