:root {
  color-scheme: dark;
  --bg: #070b14;
  --surface: #0e1523;
  --well: #0a1220;
  --line: #2a3a56;
  --panel-border: #23334f;
  --text: #f1f5fd;
  --muted: #b1bfd5;
  --blue: #2458f5;
  --blue-light: #9bb8ff;
  --focus: #b5c7ff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden], body[data-mode="public"] [data-private], body[data-mode="private"] [data-public] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
body, button, input, select { font: inherit; }
a { color: var(--blue-light); }
h1, h2, h3, p { margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.symbol-bank { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(100% - 3rem, 74rem); margin-inline: auto; }
.sr-only, .file-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 5; left: 1rem; top: .75rem; transform: translateY(-160%); border-radius: .45rem; padding: .7rem 1rem; background: var(--text); color: var(--bg); }
.skip-link:focus { transform: none; }

.site-head { border-bottom: 1px solid #1b2940; }
.site-head-inner { min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: .8rem 2rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-size: .875rem; line-height: 1.05; font-weight: 800; letter-spacing: .06em; text-decoration: none; }
.brand img { width: 2.25rem; height: 2.25rem; object-fit: contain; }
.brand-sub { display: block; margin-top: .24rem; color: var(--muted); letter-spacing: 0; font-weight: 550; font-size: .875rem; }
.site-nav, .footer-inner nav { display: flex; gap: .25rem clamp(.75rem, 2.3vw, 1.75rem); flex-wrap: wrap; align-items: center; }
.site-nav a, .site-footer a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.site-nav a { padding-block: .55rem; }
.site-nav a:hover, .site-footer a:hover { color: var(--text); text-decoration: underline; text-underline-offset: .22em; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(12rem, 1fr);
  align-items: end;
  gap: 1.5rem;
  overflow: hidden;
  min-height: 15rem;
  margin: 2.25rem 0 1.5rem;
  padding: clamp(1.4rem, 4vw, 3rem);
  border: 1px solid #2c4774;
  border-radius: 1.25rem;
  background: radial-gradient(ellipse at 85% 12%, #182f63 0, transparent 64%), linear-gradient(110deg, #111d31, #121d35 72%, #121c30);
  isolation: isolate;
}
.hero::before { content: ""; z-index: -1; position: absolute; inset: 0 0 0 58%; opacity: .27; background: repeating-linear-gradient(to right, transparent 0 36px, #4a64a0 37px, transparent 38px), repeating-linear-gradient(to bottom, transparent 0 36px, #4a64a0 37px, transparent 38px); mask-image: linear-gradient(95deg, transparent, #000 82%); }
.hero h1 { font-size: clamp(2.05rem, 5vw, 3.65rem); font-weight: 800; letter-spacing: -.052em; line-height: 1.01; }
.hero h1 em { color: var(--blue-light); font-style: normal; }
.hero-copy p { max-width: 36em; margin-top: .9rem; color: #d0dcf3; }
.hero-security { justify-self: end; display: flex; align-items: center; gap: .85rem; padding: .90rem 1rem; border: 1px solid #455e93; border-radius: .8rem; background: #0c1831; }
.hero-security strong, .hero-security span { display: block; }
.hero-security strong { font-size: .95rem; }
.hero-security span { color: var(--muted); font-size: .875rem; }
.hero-shield { color: var(--blue-light); width: 1.6rem; height: 1.6rem; }

.editor-grid { scroll-margin-top: 1rem; display: grid; grid-template-columns: 14.8rem minmax(0, 1fr); align-items: start; gap: 1.15rem; }
.tool-picker, .workbench { min-width: 0; border: 1px solid var(--panel-border); border-radius: 1rem; background: var(--surface); }
.tool-picker { padding: .875rem; }
.tool-picker h2 { margin: .35rem .47rem .9rem; display: flex; align-items: center; gap: .55rem; font-size: 1rem; }
.tool-picker h2 .icon { color: var(--blue-light); }
.tool-group + .tool-group { border-top: 1px solid #24344e; margin-top: .7rem; padding-top: .65rem; }
.tool-group h3 { margin: 0 .52rem .35rem; color: var(--muted); font-size: .875rem; font-weight: 650; }
.tool-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.6rem;
  padding: .48rem .55rem;
  gap: .58rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .6rem;
  color: var(--text);
  font-size: .9rem;
  font-weight: 580;
  text-align: left;
  line-height: 1.3;
}
.tool-button .icon { color: #9badca; }
.tool-button:hover:not(:disabled) { background: #17253a; }
.tool-button[aria-pressed="true"] { background: #1b305b; border-color: #4b69ac; color: #f1f5ff; }
.tool-button[aria-pressed="true"] .icon { color: #a6beff; }
.tool-button:disabled { opacity: .63; }
.workbench { padding: clamp(1.2rem, 3.7vw, 2rem); }
.workbench-head { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.4rem; }
.tool-medallion, .result-icon { display: grid; flex: 0 0 auto; place-items: center; width: 3rem; height: 3rem; border-radius: .78rem; color: #aec5ff; background: #172b53; border: 1px solid #405d9d; }
.tool-medallion .icon { width: 1.5rem; height: 1.5rem; }
.workbench-head h2 { font-size: clamp(1.48rem, 3vw, 2rem); letter-spacing: -.035em; line-height: 1.1; }
.workbench-head p { margin-top: .3rem; color: var(--muted); }
.drop-area { position: relative; display: flex; align-items: center; justify-content: center; gap: 1rem; min-height: 9rem; padding: 1.25rem; border: 1px dashed #5273b6; border-radius: .8rem; background: #0c1730; }
.drop-area:hover, .drop-area.is-dragging, .drop-area:focus-within { border-color: #a0baff; background: #142143; }
.drop-area:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.drop-icon { color: var(--blue-light); width: 2.8rem; height: 2.8rem; display: grid; place-items: center; background: #233c74; flex: 0 0 auto; border-radius: .8rem; }
.drop-icon .icon { width: 1.55rem; height: 1.55rem; }
.pick-label { cursor: pointer; color: #e7efff; font-size: 1.1rem; font-weight: 750; }
.pick-label::after { content: ""; position: absolute; inset: 0; }
.drop-area.is-busy .pick-label { cursor: default; }
#file-hint { margin-top: .2rem; color: var(--muted); font-size: .89rem; }

.selection-header { margin: 1rem 0 .3rem; display: flex; justify-content: space-between; gap: .75rem; align-items: center; font-size: .9rem; }
.files-list { list-style: none; margin: .4rem 0; padding: 0; display: grid; gap: .4rem; max-height: 19rem; overflow: auto; }
.file-item { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; padding: .54rem .65rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--well); }
.file-item > .icon { color: var(--blue-light); }
.file-data { min-width: 0; flex: 1 1 8rem; }
.file-name { display: block; overflow-wrap: anywhere; font-weight: 650; font-size: .9rem; }
.file-size { display: block; color: var(--muted); font-size: .84rem; }
.file-buttons { display: flex; gap: .32rem; }
.icon-button { background: #152138; border: 1px solid #344a70; color: #deebff; min-width: 2rem; min-height: 2rem; padding: .22rem; border-radius: .4rem; display: grid; place-items: center; }
.icon-button:hover:not(:disabled) { background: #263f6e; }
.icon-button:disabled { opacity: .35; }
.icon-button .icon { width: 1rem; height: 1rem; }
.quiet-button { min-height: 2rem; border: 0; background: transparent; color: var(--blue-light); text-decoration: underline; text-underline-offset: .2em; padding-inline: .42rem; font-size: .875rem; }
.quiet-button:disabled { opacity: .5; }

.options { border: 0; padding: 0; margin: 1.3rem 0 1rem; min-width: 0; }
.options legend { font-weight: 750; margin-bottom: .55rem; }
.option-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.75rem), 1fr)); }
.option { min-width: 0; }
.option label { display: block; margin-bottom: .28rem; font-size: .88rem; font-weight: 650; }
.option input, .option select { display: block; width: 100%; min-height: 2.75rem; background-color: var(--well); border: 1px solid #3b4f72; border-radius: .52rem; color: var(--text); padding: .53rem .65rem; font-size: 1rem; }
.option select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m3 6 5 5 5-5' stroke='%23b1bfd5' stroke-width='1.5'/%3E%3C/svg%3E"); background-size: .9rem; background-repeat: no-repeat; background-position: right .65rem center; padding-right: 1.8rem; }
.option input::placeholder { color: #91a4c4; }
.option small, .tool-note { display: block; margin-top: .28rem; font-size: .855rem; color: var(--muted); }
.tool-note { margin-top: .65rem; }
.quality-presets { display: flex; gap: .45rem; margin-top: .35rem; }
.preset-button { background: #152138; border: 1px solid #3b4f72; border-radius: .4rem; color: #e2ebff; min-height: 1.95rem; padding: .2rem .52rem; font-size: .875rem; }
.preset-button:hover:not(:disabled) { background: #263e6b; }
.bench-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 2.9rem; padding: .58rem 1rem; border: 1px solid #5d82ff; border-radius: .55rem; text-decoration: none; background: var(--blue); color: #fff; font-size: .94rem; font-weight: 740; text-align: center; }
.primary-button:hover:not(:disabled) { background: #3669ff; }
.primary-button:disabled { color: #acb8d0; border-color: #33496e; background: #22345a; }
.secondary-button { background: #18253d; border-color: #435b84; }
.secondary-button:hover { background: #24375a; }
.notice { margin: .7rem 0; padding: .7rem .85rem; border: 1px solid #526891; border-radius: .5rem; background: #182a49; color: #e0ebff; overflow-wrap: anywhere; }
.notice-error { border-color: #89505d; background: #321d2b; color: #ffdae1; }
.progress-box { margin: .8rem 0; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .52rem; background: var(--well); }
.progress-box > div { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .9rem; }
.progress-box progress { display: block; width: 100%; margin-top: .3rem; height: .82rem; accent-color: #668aff; }
.result { margin-top: 1.15rem; padding: 1rem; border: 1px solid #395d66; border-radius: .8rem; background: #10242d; }
.result-header { display: flex; gap: .75rem; align-items: center; margin-bottom: .7rem; }
.result-header h3 { font-size: 1.12rem; }
.result-header p { color: #c2d3e2; overflow-wrap: anywhere; font-size: .91rem; }
.result-icon { color: #a6e7cf; background: #19383b; border-color: #467475; }
.output-summary { margin: .35rem 0 .65rem; color: #c2d3e2; }
.result ul { margin: 0 0 .65rem; padding-left: 1.2rem; color: #ffe5bf; }
.output-preview { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .5rem; margin: .55rem 0 .8rem; padding: .5rem; border: 1px solid #3c596b; border-radius: .55rem; background: #0e1925; }
.output-preview figure { margin: 0; min-width: 0; }
.output-preview img { display: block; max-height: 13rem; max-width: 100%; margin-inline: auto; object-fit: contain; }
.output-preview figcaption { text-align: center; font-size: .86rem; margin-top: .35rem; color: var(--muted); }

.guide { padding: 2rem 0 2.25rem; scroll-margin-top: 1rem; }
.guide > h2 { margin-bottom: .75rem; font-size: clamp(1.35rem, 2.7vw, 1.75rem); letter-spacing: -.03em; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: .8rem; }
.guide article { padding: 1.1rem; border-radius: .8rem; border: 1px solid var(--panel-border); background: var(--surface); }
.guide article .icon { color: var(--blue-light); margin-bottom: .45rem; }
.guide article h3 { font-size: 1rem; margin-bottom: .32rem; }
.guide article p, .guide-details p { color: var(--muted); }
.guide-details { border-bottom: 1px solid var(--panel-border); }
.guide-details summary { padding: .72rem .2rem; cursor: pointer; font-weight: 660; }
.guide-details p { padding: 0 1.2rem 1rem; }
.site-footer { border-top: 1px solid #202d43; }
.footer-inner { padding-block: 1.3rem; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; }
.footer-inner > span { font-size: .9rem; font-weight: 750; }
body[data-mode="private"] .hero { min-height: 10rem; }
body[data-mode="private"] .hero h1 { font-size: clamp(1.9rem, 4.3vw, 2.8rem); }

@media (max-width: 53rem) {
  .editor-grid { grid-template-columns: 12rem minmax(0, 1fr); gap: .75rem; }
  .tool-picker { padding: .65rem; }
  .tool-button { gap: .45rem; }
  .hero { align-items: center; }
}

@media (max-width: 42rem) {
  .wrap { width: min(100% - 1.5rem, 74rem); }
  .site-head-inner { min-height: 4rem; }
  .site-nav { justify-content: flex-end; }
  .hero { grid-template-columns: 1fr; margin-top: 1.15rem; min-height: auto; }
  .hero-security { justify-self: start; padding: .65rem .75rem; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-group-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; }
  .tool-button { min-height: 2.75rem; }
  .tool-button .icon { width: 1rem; height: 1rem; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 29rem) {
  .site-head-inner { align-items: center; padding-block: .5rem; gap: .4rem; }
  .site-nav { column-gap: .65rem; }
  .site-nav a { font-size: .85rem; padding-block: .28rem; }
  .drop-area { padding: 1rem; gap: .6rem; }
  .drop-icon { width: 2.3rem; height: 2.3rem; }
  .tool-group-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bench-actions button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
