:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-strong: #fdfefe;
  --text: #172026;
  --muted: #5f6d78;
  --line: #d6dde3;
  --primary: #1b6f8f;
  --primary-strong: #12536d;
  --accent: #8a5b12;
  --danger: #b3261e;
  --success: #147a45;
  --shadow: 0 14px 34px rgb(23 32 38 / 8%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101416;
  --panel: #171d20;
  --panel-strong: #1d2529;
  --text: #edf2f4;
  --muted: #a9b5bc;
  --line: #334047;
  --primary: #69b7d0;
  --primary-strong: #9cd7e8;
  --accent: #e1b15f;
  --danger: #ff9a92;
  --success: #75d99f;
  --shadow: 0 14px 34px rgb(0 0 0 / 28%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101416;
    --panel: #171d20;
    --panel-strong: #1d2529;
    --text: #edf2f4;
    --muted: #a9b5bc;
    --line: #334047;
    --primary: #69b7d0;
    --primary-strong: #9cd7e8;
    --accent: #e1b15f;
    --danger: #ff9a92;
    --success: #75d99f;
    --shadow: 0 14px 34px rgb(0 0 0 / 28%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

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

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

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--panel);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1480px, calc(100% - 1.5rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 0.75rem 0 1.5rem;
}

.topbar,
.top-controls,
.section-heading,
.button-row,
.workspace {
  display: flex;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 0.7rem 0;
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(16px);
}

.topbar h1,
.editor-panel h2,
.tools-panel h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.eyebrow {
  margin: 0 0 0.28rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-controls {
  align-items: center;
  gap: 0.75rem;
}

.theme-field {
  display: grid;
  gap: 0.25rem;
  min-width: 150px;
}

.theme-field span,
.path-tool span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.save-state {
  min-width: 4.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: right;
}

.workspace {
  align-items: stretch;
  gap: 0.9rem;
}

.editor-panel,
.tools-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  flex: 1 1 0;
  min-height: calc(100vh - 150px);
}

.tools-panel {
  flex: 0 0 310px;
  padding: 1rem;
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.section-heading.compact {
  padding: 0 0 0.9rem;
  border-bottom: 0;
}

.editor-panel h2,
.tools-panel h2 {
  font-size: 1.25rem;
}

.button-row {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.58rem 0.82rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--panel-strong);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

select,
input {
  min-height: 2.45rem;
  padding: 0.55rem 0.65rem;
}

textarea {
  min-height: 560px;
  resize: none;
  border: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  tab-size: 2;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary), transparent 62%);
  outline-offset: 2px;
}

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

.status-line {
  min-height: 3rem;
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--success);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.status-line[data-state="error"] {
  border-left-color: var(--danger);
  color: var(--danger);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.stats-grid div {
  display: grid;
  gap: 0.15rem;
  min-height: 4.4rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.stats-grid span {
  font-size: 1.35rem;
  font-weight: 850;
}

.stats-grid small {
  color: var(--muted);
  font-weight: 800;
}

.path-tool {
  display: grid;
  gap: 0.4rem;
}

.path-result {
  min-height: 7rem;
  max-height: 16rem;
  margin: 0.65rem 0 0;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  background: var(--panel-strong);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.path-result[data-state="error"] {
  border-left-color: var(--danger);
  color: var(--danger);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

@media (max-width: 1080px) {
  .workspace {
    flex-wrap: wrap;
  }

  .tools-panel {
    flex: 1 1 100%;
    order: -1;
  }

  .editor-panel {
    flex-basis: calc(50% - 0.45rem);
  }
}

@media (max-width: 760px) {
  .topbar,
  .top-controls,
  .section-heading,
  .workspace {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .save-state {
    text-align: left;
  }

  .editor-panel {
    flex-basis: 100%;
    min-height: 520px;
  }

  textarea {
    min-height: 420px;
  }

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