:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1f2430;
  --text: #e6e6e6;
  --muted: #9aa4b2;
  --border: #303746;
  --accent: #6ea8fe;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --code: #0b0d12;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #111827, #0f1117);
}

header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.8rem;
}

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

main {
  padding: 2rem;
  display: grid;
  gap: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: var(--text);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

textarea {
  min-height: 300px;
  resize: vertical;
}

.hint {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button {
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  color: #0b0d12;
  background: var(--accent);
}

button.secondary {
  background: #d0d7de;
}

button.warn {
  background: var(--warn);
}

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

#actionStatus:empty {
  display: none;
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1100px) {
  .output-grid {
    grid-template-columns: 1fr 1fr;
  }
}

pre {
  margin: 0;
  padding: 1rem;
  min-height: 260px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--code);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre;
}

.warning-list {
  margin: 0;
  padding-left: 1.2rem;
}

.warning-list li {
  margin: 0.25rem 0;
}

.ok {
  color: var(--good);
  font-weight: 700;
}

.warning {
  color: var(--warn);
  font-weight: 700;
}

.error {
  color: var(--bad);
  font-weight: 700;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

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

code {
  background: var(--code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

[hidden] { display: none !important; }
.converter-panel { display: grid; gap: 1.5rem; min-width: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.tabs [role="tab"] { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.tabs [aria-selected="true"] { background: var(--accent); color: #0b0d12; border-color: var(--accent); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card, .output-grid, .grid > div { min-width: 0; }
.hint, .warning-list { overflow-wrap: anywhere; }
pre { max-width: 100%; }
@media (max-width: 600px) {
  header { padding: 1.25rem; }
  header h1 { font-size: 1.5rem; }
  main { padding: 1rem; }
  .section-title { flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; }
}
