:root {
  color-scheme: dark;
  --bg: #0f1214;
  --panel: #1a2024;
  --panel-2: #151a1e;
  --text: #f3f0e8;
  --muted: #b9b3a7;
  --line: #343b41;
  --accent: #f0a33a;
  --accent-2: #5fc3b1;
  --danger: #dc6b5f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

button {
  border: 1px solid var(--line);
  background: #242b30;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:not(:disabled):hover {
  border-color: var(--accent);
}

.shell {
  width: min(1760px, calc(100% - 32px));
  height: 100%;
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
}

.masthead {
  border-left: 10px solid var(--accent);
  padding-left: 18px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.masthead p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.tool-nav {
  border: 1px solid var(--line);
  background: var(--panel-2);
  min-height: 0;
  padding: 14px;
}

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.nav-title {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-link {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, transparent 35%, var(--accent) 36% 47%, transparent 48%) 7px 6px / 16px 12px no-repeat,
    linear-gradient(var(--accent-2) 0 0) 9px 15px / 12px 9px no-repeat,
    #242b30;
}

.home-link:hover,
.home-link.is-active {
  border-color: var(--accent);
  background-color: #302b22;
}

.tool-tab {
  width: 100%;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  background: #242b30;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  margin-bottom: 8px;
  text-align: left;
}

.tool-tab span {
  color: var(--muted);
  font-size: 0.9rem;
}

.tool-tab.is-active {
  border-color: var(--accent);
  background: #302b22;
}

.tool-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.tool-launcher {
  min-height: 0;
  display: grid;
  align-content: start;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 420px));
  align-content: start;
  gap: 18px;
  min-height: 0;
}

.tool-card {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  min-height: 300px;
  padding: 28px;
}

.tool-card:hover {
  border-color: var(--accent);
}

.tool-card strong {
  font-size: 1.45rem;
  line-height: 1.1;
}

.tool-card span {
  color: var(--muted);
}

.card-icon {
  width: 92px;
  height: 92px;
  align-self: start;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 42%, var(--accent) 42% 58%, transparent 58%),
    linear-gradient(var(--accent-2) 0 0) 16px 22px / 60px 8px no-repeat,
    linear-gradient(var(--accent-2) 0 0) 16px 42px / 60px 8px no-repeat,
    linear-gradient(var(--accent-2) 0 0) 16px 62px / 60px 8px no-repeat,
    #111416;
}

.splitter-icon {
  box-shadow: inset 0 0 0 8px #1f262b;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.tool-header h2 {
  margin: 0 0 4px;
  font-size: 1.45rem;
}

.tool-header p {
  margin: 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
  min-height: 0;
}

.file-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.file-field input,
.file-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #111416;
  color: var(--text);
  padding: 0.75rem;
}

.controls-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(280px, 0.65fr) auto;
  align-items: end;
  gap: 14px;
}

.actions {
  display: flex;
  gap: 10px;
}

.status {
  grid-column: 1 / -1;
  min-height: 1.5rem;
  margin: 0;
  color: var(--accent-2);
}

.status.error {
  color: var(--danger);
}

.results {
  display: grid;
  grid-template-columns: minmax(340px, 0.62fr) minmax(620px, 1.38fr);
  gap: 18px;
  min-height: 0;
}

.results .panel {
  display: flex;
  flex-direction: column;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-title h3 {
  margin: 0;
  font-size: 1.05rem;
}

.section-title span,
#viewerMeta {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.zip-button {
  width: 100%;
  margin-top: 12px;
}

.zip-button:not(:disabled) {
  border-color: var(--accent);
  background: #3a2a17;
  animation: soft-pulse 3s ease-in-out infinite;
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(240 163 58 / 0.15);
  }

  50% {
    box-shadow: 0 0 0 4px rgb(240 163 58 / 0);
  }
}

.file-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 4px;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  padding: 8px;
  width: 100%;
}

.file-row[aria-pressed="true"] {
  border-color: var(--accent);
  background: #302b22;
}

.file-row strong {
  overflow-wrap: anywhere;
}

.file-row span {
  color: var(--muted);
}

textarea {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  resize: none;
  border: 1px solid var(--line);
  background: #111416;
  color: var(--text);
  padding: 12px;
  white-space: pre;
}

code {
  color: var(--accent);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.footer-item + .footer-item::before {
  content: "";
  width: 1px;
  height: 13px;
  margin: 0 12px;
  background: var(--line);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.github-link:hover {
  color: var(--text);
}

.footer-link {
  color: var(--accent-2);
}

.footer-link:hover {
  color: var(--text);
}

.github-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .results {
    grid-template-columns: 1fr;
    min-height: 720px;
  }

  .controls-panel {
    grid-template-columns: 1fr;
  }

  .status {
    grid-column: auto;
  }
}
