:root {
  color-scheme: dark;
  --bg: #121318;
  --surface: #1b1d24;
  --surface-strong: #22252f;
  --text: #f1f4f8;
  --muted: #a7afba;
  --accent: #0f6f7d;
  --accent-strong: #0a4c56;
  --accent-glow: #1da7b8;
  --line: rgba(148, 159, 175, 0.2);
  --shadow: 0 18px 40px rgba(4, 6, 10, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 12% 10%, rgba(29, 167, 184, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(40, 46, 58, 0.7) 0%, transparent 55%),
    linear-gradient(160deg, #0f1116 0%, var(--bg) 55%, #1d2029 100%);
}

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

button {
  cursor: pointer;
}

textarea, select, input[type="file"] {
  width: 100%;
}

textarea, select {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #161a22;
  color: var(--text);
  padding: 12px 14px;
}

textarea:focus, select:focus, button:focus-visible, input[type="file"]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 167, 184, 0.16);
}

textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

textarea::placeholder {
  color: rgba(167, 175, 186, 0.6);
}

select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23a7afba' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

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

.page-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

main {
  margin-top: 18px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(18, 20, 26, 0.6);
  border: 1px solid var(--line);
}

.mode-btn {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(241, 244, 248, 0.6);
  background: transparent;
}

.mode-btn.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 3px 12px rgba(13, 66, 74, 0.45);
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  user-select: none;
}

.check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.field.compact {
  min-width: 120px;
  flex: 0 1 auto;
}

.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 16px rgba(8, 61, 70, 0.55);
}

.button-secondary {
  color: var(--text);
  background: rgba(28, 31, 40, 0.9);
  border-color: var(--line);
}

.button-ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.toolbar .button {
  flex: 1 1 120px;
  min-height: 38px;
}

.advanced {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 8px 12px;
}

.advanced summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: '+';
  float: right;
  color: var(--muted);
}

.advanced[open] summary::after {
  content: '-';
}

.advanced[open] summary {
  color: var(--text);
}

.advanced-grid {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.file-card {
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.card-header {
  display: grid;
  gap: 6px;
}

.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.file-drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 18px;
  border: 1px dashed rgba(29, 167, 184, 0.45);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(20, 24, 32, 0.9), rgba(18, 20, 26, 0.75));
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.file-drop:hover {
  border-color: rgba(29, 167, 184, 0.75);
  box-shadow: 0 12px 20px rgba(9, 16, 22, 0.6);
  transform: translateY(-1px);
}

.file-drop.is-dragover {
  border-color: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(29, 167, 184, 0.2);
}

.file-drop.has-file {
  border-style: solid;
  border-color: rgba(29, 167, 184, 0.75);
}

.file-drop input {
  display: none;
}

.file-drop-inner {
  display: grid;
  gap: 6px;
}

.file-drop-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.file-drop-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.file-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 2px;
}

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

.file-actions .button {
  flex: 1 1 0;
}

.status {
  margin: 0;
  font-size: 0.78rem;
  min-height: 1.2em;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.status[data-type="success"] {
  color: #2fb8a3;
}

.status[data-type="warning"] {
  color: #e0a95a;
}

.status[data-type="error"] {
  color: #e07a7a;
}

@media (max-width: 720px) {
  .page-shell {
    width: calc(100% - 16px);
  }

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

  .tool-card {
    padding: 16px;
  }

  .file-card {
    padding: 16px;
  }

  .toolbar .button {
    flex: 1 1 100%;
  }

  .file-actions {
    flex-direction: column;
  }
}
