:root {
  color-scheme: light;
  --surface: #fff8f8;
  --surface-lowest: #ffffff;
  --surface-low: #fff0f0;
  --surface-container: #ffe4e6;
  --surface-high: #fecdd3;
  --text: #241012;
  --muted: #6f3a40;
  --subtle: #9f636b;
  --placeholder: #c38a91;
  --line: #f4c5cb;
  --line-strong: #e11d48;
  --primary: #c41230;
  --primary-strong: #e11d48;
  --primary-soft: #ffe4e6;
  --tertiary: #ffcc00;
  --tool-accent: #ffcc00;
  --tool-accent-soft: #fff2a8;
  --tool-accent-line: #facc15;
  --tool-surface: #f6f7f9;
  --tool-card: #ffffff;
  --tool-card-soft: #f9fafb;
  --tool-border: #d9dee7;
  --tool-border-strong: #aeb7c4;
  --tool-text: #1f2937;
  --tool-muted: #5b6573;
  --tool-control: #2f343b;
  --tool-control-hover: #111827;
  --tool-control-text: #ffffff;
  --tool-accent-contrast: #111827;
  --brand-warm: #c41230;
  --brand-warm-soft: #ffe4e6;
  --success: #15803d;
  --success-bg: #dcfce7;
  --shadow: 0 16px 42px rgb(196 18 48 / 12%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0b0f14;
  --surface-lowest: #111827;
  --surface-low: #151c27;
  --surface-container: #1a2330;
  --surface-high: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --subtle: #6b7280;
  --placeholder: #6b7280;
  --line: #1f2937;
  --line-strong: #374151;
  --primary: #f59e0b;
  --primary-strong: #fbbf24;
  --primary-soft: #1f2937;
  --tertiary: #f59e0b;
  --tool-accent: #f59e0b;
  --tool-accent-soft: #2a2112;
  --tool-accent-line: #f59e0b;
  --tool-surface: #0b0f14;
  --tool-card: #111827;
  --tool-card-soft: #151c27;
  --tool-border: #1f2937;
  --tool-border-strong: #374151;
  --tool-text: #e5e7eb;
  --tool-muted: #9ca3af;
  --tool-control: #374151;
  --tool-control-hover: #4b5563;
  --tool-control-text: #e5e7eb;
  --tool-accent-contrast: #111827;
  --brand-warm: #f59e0b;
  --brand-warm-soft: #1f2937;
  --success: #86efac;
  --success-bg: #12351f;
  --shadow: 0 18px 52px rgb(0 0 0 / 30%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--surface-high) 42%, transparent), transparent 32%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-low) 72%, var(--surface-lowest)));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.material-symbols-outlined {
  display: inline-block;
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-warm) 20%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--brand-warm-soft) 58%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface-lowest) 94%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--brand-warm) 28%, var(--line));
  border-radius: 12px;
  background:
    radial-gradient(circle at 70% 25%, rgb(255 255 255 / 72%), transparent 22px),
    var(--brand-warm-soft);
  box-shadow: 0 8px 18px rgb(185 28 28 / 13%);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 2px rgb(19 27 46 / 14%));
}

.main-nav,
.header-actions,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.main-nav {
  height: 100%;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.header-actions {
  justify-content: end;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(320px, 32vw);
}

.header-search .material-symbols-outlined {
  position: absolute;
  left: 12px;
  color: var(--subtle);
  font-size: 19px;
  pointer-events: none;
}

.header-search input,
.tool-search,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--text);
  outline: none;
}

.header-search input {
  height: 34px;
  padding: 7px 12px 7px 40px;
  font-size: 13px;
}

input,
select {
  min-height: 44px;
  padding: 11px 13px;
}

input,
textarea {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: -0.005em;
}

select {
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 0.58;
}

input[type="number"] {
  min-height: 48px;
  padding-right: 14px;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

textarea {
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

.html-output {
  min-height: 260px;
  max-height: 600px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--text);
}

.html-output :first-child { margin-top: 0; }
.html-output :last-child { margin-bottom: 0; }

.html-output h1, .html-output h2, .html-output h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.html-output code {
  background: var(--surface-high);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.html-output pre {
  background: var(--surface-high);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.html-output pre code {
  background: transparent;
  padding: 0;
}

.html-output blockquote {
  border-left: 4px solid var(--line-strong);
  margin-left: 0;
  padding-left: 16px;
  color: var(--muted);
}

.qrcode-preview {
  display: flex;
  justify-content: center;
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 16px;
}

.qrcode-preview canvas {
  max-width: 100%;
  height: auto !important;
}

.shadow-preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 64px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 24px;
}

.shadow-preview-box {
  width: 120px;
  height: 120px;
  background: var(--surface-lowest);
  border-radius: 12px;
}

.tool-form input[type="range"] {
  padding: 0;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  appearance: none;
}

.tool-form input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 26px;
  height: 26px;
  background: var(--primary);
  border: 3px solid var(--surface-lowest);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(19 27 46 / 20%);
  cursor: pointer;
}

.tool-form input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--primary);
  border: 3px solid var(--surface-lowest);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(19 27 46 / 20%);
  cursor: pointer;
}

.tool-form input[type="color"] {
  padding: 2px;
  height: 40px;
  cursor: pointer;
}

/* Playgrounds & Batch 2 UI */
.playground-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: var(--surface-low);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.playground-canvas {
  min-height: 300px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.playground-item {
  background: var(--primary);
  color: white;
  padding: 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  min-width: 50px;
  min-height: 50px;
}

.glass-preview-container {
  padding: 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.glass-preview-box {
  width: 200px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.image-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.image-preview-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--tool-card);
  border: 1px solid var(--tool-border);
  border-radius: 8px;
}

.image-preview-frame {
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--tool-border) 44%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--tool-border) 44%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--tool-border) 44%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--tool-border) 44%, transparent) 75%);
  background-color: var(--tool-card-soft);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px dashed var(--tool-border-strong);
  border-radius: 8px;
}

.image-preview-frame img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.image-preview-frame img:not([src]),
.image-preview-frame img[src=""] {
  display: none;
}

.image-info {
  font-size: 11px;
  color: var(--tool-muted);
}

.converter-results {
  display: grid;
  gap: 8px;
}

.converter-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: var(--tool-card);
  border: 1px solid var(--tool-border);
  border-radius: 8px;
}

.converter-result-row strong,
.converter-result-row span {
  display: block;
}

.converter-result-row span {
  color: var(--tool-muted);
  font-size: 12px;
}

.file-dropzone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 132px;
  padding: 18px;
  background: var(--tool-card-soft);
  border: 2px dashed var(--tool-border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.file-dropzone:hover,
.file-dropzone:focus-visible,
.file-dropzone.is-dragging,
.file-dropzone.has-file {
  background: color-mix(in srgb, var(--tool-accent) 16%, var(--tool-card));
  border-color: var(--tool-accent);
}

.file-dropzone.has-file {
  border-style: solid;
}

.file-dropzone.is-dragging {
  transform: translateY(-1px);
}

.file-dropzone strong,
.file-dropzone span,
.file-dropzone-status {
  display: block;
}

.file-dropzone strong {
  font-size: 18px;
}

.file-dropzone span,
.file-dropzone-status,
.tool-status {
  color: var(--muted);
  font-size: 13px;
}

.file-dropzone-status {
  grid-column: 2 / -1;
  padding-top: 2px;
}

.file-dropzone-status strong {
  color: var(--tool-control);
  font-size: 12px;
  text-transform: uppercase;
}

.file-dropzone-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--tool-control);
  font-family: 'Material Symbols Outlined';
  font-size: 32px;
  background: var(--tool-card);
  border: 1px solid var(--tool-border);
  border-radius: 8px;
  overflow: hidden;
}

.file-dropzone-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-status {
  padding: 10px 12px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tool-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.tool-options-grid label {
  min-height: 40px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-preview-wrap,
.json-tree {
  min-height: 180px;
  padding: 14px;
  overflow: auto;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-preview {
  width: 100%;
  min-width: 520px;
  height: auto;
}

.chart-axis line {
  stroke: var(--line-strong);
  stroke-width: 2;
}

.chart-bars rect,
.chart-dots circle {
  fill: var(--primary);
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
}

.chart-area {
  fill: color-mix(in srgb, var(--primary) 24%, transparent);
}

.chart-labels text {
  fill: var(--muted);
  font-size: 13px;
}

.json-tree {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.json-tree details {
  margin-left: 14px;
}

.json-tree summary {
  cursor: pointer;
  color: var(--text);
}

.json-type {
  color: var(--muted);
}

.json-leaf {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(160px, 1.1fr);
  gap: 12px;
  margin-left: 24px;
  padding: 3px 0;
}

.json-leaf code {
  color: var(--primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.contrast-result {
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin-top: 10px;
}

.case-result-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-low);
  border-radius: 8px;
}

.case-label {
  font-weight: bold;
  color: var(--primary);
  font-size: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

#tool-app input:focus,
#tool-app select:focus,
#tool-app textarea:focus {
  border-color: var(--tool-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tool-accent) 22%, transparent);
}

#tool-app input,
#tool-app select,
#tool-app textarea,
#tool-app .html-output {
  border-color: var(--tool-border);
  background: var(--tool-card);
  color: var(--tool-text);
}

#tool-app textarea[readonly],
#tool-app input[readonly],
#tool-app .html-output {
  background: var(--tool-card-soft);
}

.theme-toggle,
button,
.collection-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface-lowest);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.theme-toggle {
  width: 38px;
  padding: 0;
  color: var(--muted);
}

.theme-toggle:hover,
button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-transform: none;
}

.language-switcher .material-symbols-outlined {
  color: var(--primary);
  font-size: 18px;
}

.language-switcher select {
  width: auto;
  min-width: 132px;
  min-height: 34px;
  padding: 7px 28px 7px 10px;
  border-radius: 999px;
  background: var(--surface-low);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.app-frame {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.side-nav {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-low);
}

.side-nav-heading {
  padding: 24px 16px 16px;
}

.side-nav-heading h2 {
  margin: 0;
  color: var(--primary);
  font-size: 18px;
}

.side-nav-heading p {
  margin: 4px 0 0;
  color: var(--subtle);
  font-size: 12px;
}

.side-nav nav {
  display: grid;
  gap: 4px;
  padding: 0 8px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 14px;
  border-right: 4px solid transparent;
  color: var(--muted);
  font-weight: 650;
}

.side-nav a.category-group {
  margin-top: 8px;
  color: var(--text);
  font-weight: 800;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 18px;
  padding: 0 6px;
  background: var(--surface-low);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.nav-item-wrap.active .nav-badge,
.nav-item-wrap:hover .nav-badge {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.side-nav a.sub-category {
  min-height: 36px;
  margin-left: 18px;
  padding: 8px 12px;
  font-size: 13px;
}

.side-nav a.sub-category .material-symbols-outlined {
  font-size: 18px;
}

.side-nav a:hover,
.side-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary-soft) 65%, transparent);
  border-right-color: var(--primary);
  color: var(--primary);
}

.side-note {
  display: grid;
  gap: 3px;
  margin: auto 16px 16px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary-soft) 38%, var(--surface-lowest));
  color: var(--muted);
  font-size: 12px;
}

.side-note strong {
  color: var(--primary);
  font-size: 11px;
  text-transform: uppercase;
}

.app-main {
  min-width: 0;
  background: var(--surface-lowest);
}

.workspace {
  width: min(1800px, 96%);
  margin: 0 auto;
  padding: 40px 0;
}

.workspace.compact {
  padding-top: 8px;
}

.home-intro,
.directory-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.home-intro {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(280px, 42vw, 430px);
  margin-bottom: 34px;
  padding: clamp(34px, 7vw, 76px) 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  border-bottom: 5px solid var(--tertiary);
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--tertiary) 20%, transparent), transparent 28%),
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--brand-warm) 14%, transparent), transparent 25%),
    linear-gradient(135deg, var(--surface-lowest), color-mix(in srgb, var(--surface-low) 84%, var(--surface-lowest)));
  box-shadow: var(--shadow);
  text-align: center;
}

.home-intro h1,
.directory-heading h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 32px;
  letter-spacing: 0;
}

.home-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(42px, 8vw, 86px);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.home-intro p,
.directory-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.home-intro p {
  max-width: min(980px, 100%);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-intro .stats-strip {
  justify-content: center;
  margin-top: 18px;
}

.stats-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-strip span + span::before {
  content: "•";
  margin: 0 9px;
  color: var(--subtle);
}

.stats-strip .material-symbols-outlined {
  color: var(--primary);
  font-size: 16px;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sort-control button {
  min-height: 34px;
  font-size: 12px;
  text-transform: none;
}

.tool-sort-toggle[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.tool-grid.small {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tool-category-directory {
  display: grid;
  gap: 18px;
}

.tool-category-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--tertiary);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-lowest) 90%, var(--surface-low));
  box-shadow: 0 10px 26px rgb(196 18 48 / 7%);
}

.tool-category-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.tool-category-heading div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tool-category-heading .material-symbols-outlined {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--tertiary) 70%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--tertiary) 22%, var(--surface-lowest));
  color: var(--primary);
  font-size: 21px;
}

.tool-category-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 24px;
}

.tool-category-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
  text-align: right;
}

.tool-card {
  min-height: 220px;
  border: 1px solid var(--tool-border);
  border-radius: 12px;
  background: var(--tool-card);
  transition: all 0.2s ease;
  overflow: hidden;
}

.tool-card:hover {
  border-color: var(--tool-accent);
  box-shadow: 0 12px 28px rgb(17 24 39 / 8%);
  transform: translateY(-2px);
}

.tool-card-content {
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tool-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.tool-card-link {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--tool-text);
}

.tool-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--tool-muted);
  line-height: 1.5;
}

.tool-card-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--subtle);
}

.fast-tag {
  color: var(--success);
  background: var(--success-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.tool-row {
  border: 1px solid var(--tool-border);
  border-radius: 8px;
  background: var(--tool-card);
  transition: border-color 0.16s ease, background 0.16s ease;
  margin: 0;
}

.tool-row-inner {
  display: flex;
  align-items: flex-start;
  min-height: 72px;
  padding: 8px 10px 8px 8px;
  gap: 4px;
}

.tool-row-link {
  flex: 1;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 22px;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
  padding: 2px 0;
  color: var(--text);
}

.tool-row:hover {
  border-color: var(--tool-accent);
  background: color-mix(in srgb, var(--tool-accent-soft) 18%, var(--tool-card));
}

.tool-row .tool-icon {
  width: 28px;
  height: 28px;
  font-size: 21px;
}

.tool-row-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.tool-row-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-row-title h3 {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 18px;
}

.tool-row-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

.tool-row-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-transform: uppercase;
}

.tool-row-arrow {
  color: var(--subtle);
  font-size: 18px;
}

.favorite-button {
  background: transparent;
  border: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--subtle);
  transition: all 0.2s ease;
  padding: 0;
}

.favorite-button:hover {
  background: var(--surface-high);
  color: #ffb400;
}

.favorite-button.is-active {
  color: #ffb400;
}

.favorite-button .favorite-icon {
  font-size: 19px;
  font-variation-settings: "FILL" 0;
}

.favorite-button.is-active .favorite-icon {
  font-variation-settings: "FILL" 1;
}

.featured-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.collection-card,
.new-card {
  border-radius: 8px;
  padding: 32px;
}

.collection-card {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  background: #111827;
  color: #ffffff;
}

.collection-card p {
  max-width: 430px;
  color: #b8c1d5;
}

.collection-card h2,
.new-card h2 {
  margin: 12px 0 8px;
  font-size: 24px;
  line-height: 32px;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-strong);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.collection-action {
  width: fit-content;
  margin-top: 14px;
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: #ffffff;
}

.collection-mark {
  position: absolute;
  right: -30px;
  bottom: -38px;
  color: rgb(255 255 255 / 16%);
  font-size: 180px;
}

.new-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: var(--surface-lowest);
}

.new-card p {
  color: var(--muted);
}

.new-card a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-weight: 800;
}

.eyebrow {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-workspace {
  display: grid;
  gap: 32px;
  width: min(1800px, 96%);
  margin: 0 auto;
  padding: 28px 0 40px;
  background: var(--tool-surface);
}

.tool-hero {
  padding: 4px 0 2px;
}

.tool-hero-copy {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.tool-icon.large {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--tool-border);
  border-radius: 18px;
  background:
    radial-gradient(circle at 68% 24%, rgb(255 255 255 / 72%), transparent 24px),
    var(--tool-card);
  color: var(--tool-control);
  font-size: 34px;
  box-shadow: inset 0 -4px 0 var(--tool-accent), 0 10px 24px rgb(17 24 39 / 8%);
}

.tool-hero h1 {
  margin: 4px 0 8px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 0.96;
  letter-spacing: -0.05em;
  color: var(--tool-text);
}

.tool-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--tool-muted);
  font-size: 17px;
  line-height: 1.55;
}

.tool-hero .eyebrow {
  margin: 0;
  color: var(--tool-control);
  font-size: 10px;
  line-height: 1.2;
}

.workspace.compact h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 28px;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  padding: clamp(24px, 5vw, 60px);
  border: 1px solid var(--tool-border);
  border-top: 6px solid var(--tool-accent);
  border-radius: 32px;
  background: var(--tool-card);
  box-shadow: 0 24px 60px rgb(17 24 39 / 12%);
}

.tool-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--tool-border);
  border-radius: 8px;
  background: var(--tool-card-soft);
  box-shadow: 0 1px 0 rgb(19 27 46 / 4%);
  font-weight: 800;
}

.tool-action-bar div {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--tool-muted);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
}

#tool-app,
.tool-form {
  min-width: 0;
}

.tool-form {
  display: grid;
  gap: 16px;
}

#tool-app > .tool-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  align-items: stretch;
}

#tool-app > .tool-form > .tool-form,
#tool-app > .tool-form > .tool-controls,
#tool-app > .tool-form > .file-dropzone,
#tool-app > .tool-form > .chart-preview-wrap,
#tool-app > .tool-form > p,
#tool-app > .tool-form > small {
  grid-column: 1 / -1;
}

.tool-form.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-form.two-col label:last-child {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.copyable-output {
  position: relative;
}

.copyable-output textarea,
.copyable-output .html-output {
  padding-top: 42px;
}

.output-copy-button {
  position: absolute;
  top: 28px;
  right: 10px;
  z-index: 2;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border-color: var(--tool-border);
  background: color-mix(in srgb, var(--tool-accent) 18%, var(--tool-card));
  color: var(--tool-accent);
  font-size: 11px;
  box-shadow: 0 4px 12px rgb(120 92 12 / 10%);
  backdrop-filter: blur(8px);
}

:root[data-theme="dark"] .brand-mark {
  box-shadow: 0 8px 18px rgb(0 0 0 / 28%);
}

:root[data-theme="dark"] .tool-category-section {
  box-shadow: 0 10px 26px rgb(0 0 0 / 18%);
}

:root[data-theme="dark"] .tool-card,
:root[data-theme="dark"] .tool-row,
:root[data-theme="dark"] .tool-panel,
:root[data-theme="dark"] .tool-action-bar,
:root[data-theme="dark"] .tool-category-section,
:root[data-theme="dark"] .image-preview-item,
:root[data-theme="dark"] .converter-result-row,
:root[data-theme="dark"] .file-dropzone,
:root[data-theme="dark"] #tool-app input,
:root[data-theme="dark"] #tool-app select,
:root[data-theme="dark"] #tool-app textarea,
:root[data-theme="dark"] #tool-app .html-output {
  background-color: color-mix(in srgb, var(--tool-card) 86%, #1f2937);
  border-color: #374151;
}

#tool-app textarea,
#tool-app .html-output {
  min-height: 420px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
}

:root[data-theme="dark"] .tool-card,
:root[data-theme="dark"] .tool-row,
:root[data-theme="dark"] .image-preview-item,
:root[data-theme="dark"] .converter-result-row,
:root[data-theme="dark"] .file-dropzone {
  box-shadow: 0 12px 28px rgb(0 0 0 / 28%);
}

:root[data-theme="dark"] .tool-panel {
  box-shadow: 0 18px 46px rgb(0 0 0 / 36%);
}

:root[data-theme="dark"] #tool-app input,
:root[data-theme="dark"] #tool-app select,
:root[data-theme="dark"] #tool-app textarea,
:root[data-theme="dark"] #tool-app .html-output {
  color: var(--text);
}

:root[data-theme="dark"] .file-dropzone-icon {
  background: #111827;
  border-color: #374151;
}

:root[data-theme="dark"] .output-copy-button {
  border-color: #f59e0b;
  background: #111827;
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tool-controls button:first-child {
  border-color: var(--tool-border-strong);
  background: var(--tool-control);
  color: var(--tool-control-text);
}

.tool-controls button:first-child:hover {
  border-color: var(--tool-control-hover);
  background: var(--tool-control-hover);
  color: var(--tool-control-text);
}

#tool-app .tool-controls button:not(:first-child) {
  border-color: var(--tool-accent);
  background: transparent;
  color: var(--tool-accent);
}

#tool-app .tool-controls button:not(:first-child):hover,
.output-copy-button:hover {
  border-color: var(--tool-accent);
  background: var(--tool-accent);
  color: var(--tool-accent-contrast);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: var(--surface-lowest);
  color: var(--muted);
  font-size: 12px;
}

.site-footer span {
  color: var(--text);
  font-weight: 800;
}

.site-footer a:hover {
  color: var(--primary);
}

[hidden] {
  display: none !important;
}

/* Premium UI Utilities */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--tool-card);
  border: 1px solid var(--tool-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.side-nav nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-wrap {
  position: relative;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.main-link > span:nth-of-type(2) {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  line-height: 1.2;
}

.main-link .material-symbols-outlined,
.nav-badge,
.expand-icon {
  flex-shrink: 0;
}

.main-link:hover {
  background: var(--surface-container);
  color: var(--primary);
}

.nav-item-wrap.active .main-link {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 4px 12px rgb(196 18 48 / 8%);
}

.expand-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px !important;
  opacity: 0.4;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 12px 10px 42px;
  background: color-mix(in srgb, var(--surface-low) 50%, transparent);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hover show sub-nav */
.nav-item-wrap:hover .sub-nav {
  display: flex;
}

.nav-item-wrap:hover .main-link {
  background: var(--surface-container);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.nav-item-wrap:hover .expand-icon {
  transform: rotate(90deg);
  opacity: 1;
}

.sub-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.sub-link > span:nth-of-type(2) {
  flex: 1;
}

.sub-link .material-symbols-outlined {
  font-size: 18px !important;
  opacity: 0.7;
}

.sub-link:hover {
  background: var(--surface-high);
  color: var(--primary);
  transform: translateX(4px);
}

.sub-link.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

:root[data-theme="dark"] .sub-link.active {
  background: var(--surface-high);
}

.side-note {
  margin-top: auto;
  padding: 16px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--tool-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-container);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.tool-io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.input-header, .output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.input-header label, .output-header label {
  margin-bottom: 0;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav,
  .header-search {
    display: none;
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .side-nav {
    display: none;
  }

  .home-intro,
  .directory-heading,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .home-intro {
    align-items: center;
    min-height: 280px;
    gap: 10px;
  }

  .home-intro p {
    max-width: 720px;
  }

  .home-intro .stats-strip {
    justify-content: center;
  }

  .tool-grid,
  .tool-grid.small,
  .featured-grid {
    grid-template-columns: 1fr;
  }

  .workspace > .tool-grid .tool-card {
    min-height: 0;
    border-radius: 8px;
  }

  .workspace > .tool-grid .tool-card-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .workspace > .tool-grid .tool-card-top {
    display: grid;
    grid-template-columns: 28px;
    gap: 4px;
    margin-bottom: 0;
  }

  .workspace > .tool-grid .tool-card-top .favorite-button {
    grid-row: 2;
    width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .workspace > .tool-grid .tool-card-link {
    min-width: 0;
  }

  .workspace > .tool-grid .tool-card h3 {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 18px;
  }

  .workspace > .tool-grid .tool-card p {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 17px;
  }

  .workspace > .tool-grid .tool-card-meta {
    justify-content: flex-start;
    gap: 8px;
    margin-top: 0;
  }

  .tool-list {
    grid-template-columns: 1fr;
  }

  #tool-app > .tool-form {
    grid-template-columns: 1fr;
  }

  .tool-category-heading {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }

  .tool-category-heading p {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
  }

  .header-actions {
    gap: 10px;
  }

  .language-switcher select {
    min-width: 112px;
    max-width: 140px;
  }

  .workspace {
    width: min(100% - 24px, 1280px);
    padding: 24px 0;
  }

  .tool-workspace {
    width: min(100% - 24px, 1280px);
    padding: 20px 0 28px;
  }

  .tool-panel {
    padding: 16px 14px;
    border-radius: 16px;
  }

  .tool-hero-copy {
    gap: 12px;
  }

  .tool-icon.large {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 28px;
  }

  .tool-hero h1 {
    font-size: 32px;
  }

  .tool-hero p {
    font-size: 15px;
  }

  .collection-card,
  .new-card {
    padding: 22px;
  }

  .tool-form.two-col {
    grid-template-columns: 1fr;
  }

  .tool-row-link {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tool-row-arrow {
    display: none;
  }
}

/* Password Strength Indicator */
.password-strength-meter {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
  position: relative;
}

.password-strength-bar {
  height: 100%;
  width: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar[data-strength="0"] { width: 5%; background-color: #ef4444; }
.password-strength-bar[data-strength="1"] { width: 20%; background-color: #ef4444; }
.password-strength-bar[data-strength="2"] { width: 40%; background-color: #f59e0b; }
.password-strength-bar[data-strength="3"] { width: 60%; background-color: #f59e0b; }
.password-strength-bar[data-strength="4"] { width: 80%; background-color: #10b981; }
.password-strength-bar[data-strength="5"] { width: 100%; background-color: #10b981; }

.password-display-group {
  position: relative;
  margin-bottom: 24px;
}

.password-display-group textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  text-align: center;
  min-height: 80px;
  padding: 20px;
  background: var(--surface-low);
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  resize: none;
}

.password-length-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}

.password-length-info span {
  color: var(--primary);
  font-size: 1.1rem;
}

.primary-button {
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
}

.primary-button:hover {
  background: var(--primary-strong) !important;
}

/* Search Results Dropdown */
.header-search {
  position: relative;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface-lowest);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.search-results-dropdown[hidden] {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--surface-low);
}

.search-result-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-container);
  color: var(--primary);
  border-radius: 6px;
  font-size: 20px;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-summary {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Diff Checker Styles */
.diff-container {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--tool-border);
  border: 1px solid var(--tool-border);
  border-radius: 8px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.diff-line {
  display: grid;
  grid-template-columns: 40px 1fr;
  background: var(--tool-card);
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-line.addition { background: #e6ffec; color: #1e4620; }
.diff-line.deletion { background: #ffebe9; color: #82071e; }

.diff-marker {
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  font-weight: bold;
  opacity: 0.5;
  background: rgba(0,0,0,0.03);
  border-right: 1px solid rgba(0,0,0,0.05);
}

.diff-content {
  padding: 2px 12px;
}

:root[data-theme="dark"] .diff-line.addition { background: #1b3421; color: #88d090; }
:root[data-theme="dark"] .diff-line.deletion { background: #3d1b1a; color: #ff8182; }

/* Policy & Info Pages */
.page-heading {
  padding: 80px 40px;
  background: var(--surface-low);
  border-bottom: 1px solid var(--line);
}

.page-heading.narrow {
  max-width: 100%;
  padding: 80px max(40px, 12%);
  text-align: left;
}

.page-heading h1 {
  margin: 8px 0 16px;
  font-size: 48px;
  letter-spacing: -0.04em;
  color: var(--primary);
}

.policy-wrapper {
  margin-top: 48px;
  max-width: 900px;
}

.policy-content {
  color: var(--muted);
  line-height: 1.8;
  font-size: 16px;
}

.policy-content h2 {
  margin: 48px 0 20px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.policy-content p {
  margin-bottom: 24px;
}

.policy-content ul {
  margin: 24px 0 32px;
  padding-left: 24px;
  list-style: disc;
}

.policy-content li {
  margin-bottom: 12px;
}

.policy-content a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

.policy-content strong {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 768px) {
  .page-heading {
    padding: 60px 24px;
  }
  .page-heading h1 {
    font-size: 36px;
  }
}

/* Tool Metadata & Info */
.tool-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.tag {
  padding: 4px 12px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tool-info-section {
  margin-top: 48px;
  padding: 0 40px;
}

.info-card {
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  max-width: 1000px;
}

.info-card h2 {
  margin: 0 0 16px;
  font-size: 24px;
  color: var(--text);
}

.info-card h3 {
  margin: 32px 0 16px;
  font-size: 18px;
  color: var(--primary);
}

.info-card p {
  color: var(--muted);
  line-height: 1.8;
}

.info-card ol {
  margin: 0 0 32px;
  padding-left: 20px;
  color: var(--muted);
}

.info-card li {
  margin-bottom: 12px;
  line-height: 1.6;
}

.info-footer {
  display: flex;
  gap: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--subtle);
}

.info-footer strong {
  color: var(--text);
  margin-left: 4px;
}

@media (max-width: 768px) {
  .tool-info-section {
    padding: 0 16px;
  }
  .info-card {
    padding: 24px;
  }
}

/* Scientific Calculator Styles */
.calculator-container {
  max-width: 480px;
  margin: 0 auto;
  background: #1a1c1e;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}

.calc-display-wrapper {
  background: #2d2f31;
  padding: 24px;
  border-radius: 20px;
  margin-bottom: 24px;
  text-align: right;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(255,255,255,0.05);
}

.calc-history {
  color: #9aa0a6;
  font-size: 14px;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  height: 20px;
  overflow: hidden;
  white-space: nowrap;
}

.calc-main-display {
  color: #ffffff;
  font-size: 42px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.calc-main-display::-webkit-scrollbar { display: none; }

.calc-grid {
  display: grid;
  gap: 12px;
}

.calc-grid.basic {
  grid-template-columns: repeat(4, 1fr);
}

.calc-grid.scientific {
  grid-template-columns: repeat(5, 1fr);
}

.calc-btn.double {
  grid-column: span 2;
}

.calc-btn {
  height: 54px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8eaed;
}

.calc-btn.num { background: #3c4043; }
.calc-btn.num:hover { background: #4e5256; transform: translateY(-2px); }

.calc-btn.op { background: #5f6368; color: #8ab4f8; }
.calc-btn.op:hover { background: #70757a; transform: translateY(-2px); }

.calc-btn.func { background: #303134; color: #bdc1c6; font-size: 14px; }
.calc-btn.func:hover { background: #3c4043; color: #8ab4f8; transform: translateY(-2px); }

.calc-btn.action { background: #5f6368; color: #f28b82; }
.calc-btn.action:hover { background: #70757a; transform: translateY(-2px); }

.calc-btn.equals {
  background: #8ab4f8;
  color: #202124;
  font-size: 20px;
}
.calc-btn.equals:hover { background: #aecbfa; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(138, 180, 248, 0.4); }

.calc-btn:active { transform: translateY(0); scale: 0.95; }

@media (max-width: 480px) {
  .calculator-container {
    padding: 16px;
    border-radius: 0;
  }
  .calc-btn {
    height: 48px;
    border-radius: 12px;
    font-size: 14px;
  }
}

/* BMI Dashboard Styles */
.bmi-dashboard {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 40px;
  align-items: center;
}

.bmi-gauge-container {
  padding: 20px 0;
}

.bmi-gauge-track {
  position: relative;
  height: 12px;
  background: var(--surface-low);
  border-radius: 6px;
  display: flex;
  overflow: visible;
}

.bmi-gauge-segment { height: 100%; }
.bmi-gauge-segment.underweight { flex: 3.5; background: #60a5fa; border-radius: 6px 0 0 6px; }
.bmi-gauge-segment.normal { flex: 6.5; background: #34d399; }
.bmi-gauge-segment.overweight { flex: 5; background: #fbbf24; }
.bmi-gauge-segment.obese { flex: 10; background: #f87171; border-radius: 0 6px 6px 0; }

.bmi-gauge-indicator {
  position: absolute;
  top: -10px;
  width: 2px;
  height: 32px;
  background: var(--text);
  transition: left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
}

.indicator-arrow {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--text);
}

.indicator-val {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.bmi-gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 11px;
  color: var(--subtle);
  padding: 0 5%;
}

.bmi-status-card {
  padding: 32px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.bmi-status-card h2 {
  margin: 12px 0 8px;
  font-size: 24px;
}

.bmi-status-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.bmi-stats-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.mini-stat .label { font-size: 11px; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.05em; display: block; }
.mini-stat .value { font-size: 15px; font-weight: 600; color: var(--text); }

/* Password Generator Modern Styles */
.password-main-card {
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
}

.password-output-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-container);
  border-radius: 16px;
  padding: 12px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
}

.password-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}

.password-actions { display: flex; gap: 8px; }

.strength-meter { margin-top: 16px; }
.strength-bar { height: 6px; background: #eee; border-radius: 3px; transition: all 0.5s ease; margin-bottom: 8px; }
.strength-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.checkbox-group-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.check-item:hover { border-color: var(--primary); background: var(--surface-container); }
.check-item input { width: 18px; height: 18px; cursor: pointer; }

@media (max-width: 768px) {
  .bmi-dashboard { grid-template-columns: 1fr; }
  .password-text { font-size: 18px; }
}

/* ASCII Art Generator & Tabs */
.tabs-modern {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  padding: 6px;
  background: var(--surface-low);
  border-radius: 14px;
  width: fit-content;
  border: 1px solid var(--line);
}

.tab-btn {
  padding: 8px 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--surface-container);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: 24px;
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-low);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--surface-container);
}

.upload-zone p {
  margin-top: 16px;
  color: var(--muted);
  font-weight: 500;
}

.ascii-pre-box {
  width: 100%;
  height: 500px;
  margin-top: 16px;
  white-space: pre;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1;
  background: #000;
  color: #00ff41;
  border: none;
  padding: 24px;
  border-radius: 16px;
  overflow: auto;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.5);
  scrollbar-width: thin;
}

.ascii-pre-box::-webkit-scrollbar { width: 8px; height: 8px; }
.ascii-pre-box::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* Pomodoro Timer Premium UI */
.pomodoro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 32px;
}

.pomodoro-modes {
  display: flex;
  background: var(--surface-low);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}

.mode-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--surface-lowest);
  color: var(--primary);
  box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
}

.timer-visual {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface-low);
  stroke-width: 4;
}

.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.timer-content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-time {
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -2px;
}

.timer-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.primary-button.large {
  padding: 16px 40px;
  font-size: 1.1rem;
  border-radius: 16px;
}

/* BMI Gauge Styles */
.bmi-visual {
  margin: 32px 0;
  padding: 0 10px;
}

.bmi-gauge {
  position: relative;
  height: 8px;
  background: linear-gradient(to right, #60a5fa 0%, #60a5fa 25%, #34d399 25%, #34d399 50%, #fbbf24 50%, #fbbf24 75%, #f87171 75%, #f87171 100%);
  border-radius: 4px;
  margin-bottom: 12px;
}

.gauge-pointer {
  position: absolute;
  top: -6px;
  width: 20px;
  height: 20px;
  background: var(--surface-lowest);
  border: 4px solid var(--primary);
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
  transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* RNG Premium Styles */
.rng-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
}

.rng-display {
  font-size: 6rem;
  font-weight: 800;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 4px 12px rgb(var(--primary-rgb) / 20%);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 14px;
  animation: toast-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), toast-out 0.3s 2.7s forwards;
  pointer-events: auto;
}

.toast .material-symbols-outlined {
  color: var(--primary);
  font-size: 20px;
}

@keyframes toast-in {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(10px); opacity: 0; }
}

/* FAQ Section */
.faq-section {
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

.faq-section h2 {
  font-size: 1.75rem !important;
  font-weight: 800 !important;
  margin-bottom: 32px !important;
  color: var(--text);
  letter-spacing: -0.02em;
}

.faq-list {
  display: grid;
  gap: 20px;
}

.faq-item {
  background: var(--surface-low);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-soft);
}

.faq-item h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
}

.faq-item h3::before {
  content: 'Q.';
  font-size: 0.9rem;
  opacity: 0.6;
}

.faq-item p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0;
}

/* Sharing Section */
.share-section {
  margin-top: 40px;
  padding: 32px;
  background: var(--surface-subtle);
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.share-section h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.share-section p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.share-btn:hover {
  background: var(--surface-subtle);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.share-btn.primary {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

.share-btn.primary:hover {
  background: var(--primary-dark);
}
