:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #ffffff;
  --panel-soft: #eef5f1;
  --text: #1b2528;
  --muted: #5b686d;
  --border: #d5ddd8;
  --accent: #1f7a5b;
  --accent-strong: #155a43;
  --danger: #b3261e;
  --shadow: 0 18px 48px rgba(38, 48, 45, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141817;
  --panel: #202624;
  --panel-soft: #17211d;
  --text: #edf3ef;
  --muted: #a9b7b0;
  --border: #3a4641;
  --accent: #62d29f;
  --accent-strong: #3eaf7b;
  --danger: #ff8a80;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  min-height: 42px;
}

button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 20px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 18px;
  height: 100vh;
  padding: 24px;
}

.workspace,
.history-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  height: 100%;
  overflow: hidden;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--panel);
  padding: 24px;
}

.history-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-soft);
  padding: 20px;
  min-height: 0;
}

.topbar,
.history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(32px, 5vw, 56px);
}

h2 {
  font-size: 24px;
}

.converter-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px; /* room for the scrollbar so content doesn't hug it */
}

.field-label {
  color: var(--text);
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

/* --- Searchable, sortable conversion picker -------------------------------- */

.combobox {
  position: relative;
}

.combobox-control {
  display: flex;
  gap: 8px;
}

.combobox-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.sort-toggle {
  flex-shrink: 0;
  width: 64px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.combobox-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option.is-active {
  background: var(--panel-soft);
}

.combobox-option.is-selected .option-label {
  color: var(--accent);
  font-weight: 700;
}

.option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 14px;
}


select {
  padding: 0 12px;
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding: 12px;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  line-height: 1.5;
}

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

.hint,
.status,
.shortcut-note {
  margin: 0;
  min-height: 22px;
  color: var(--muted);
}

.status.is-error {
  color: var(--danger);
  font-weight: 700;
}

.status.is-success {
  color: var(--accent);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 16px 2px 2px;
}

.history-empty,
.history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.history-empty {
  color: var(--muted);
}

.history-item {
  text-align: left;
  min-height: auto;
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item strong {
  margin-bottom: 6px;
}

.history-item span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-note {
  padding-top: 16px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .workspace,
  .history-panel {
    height: auto;
    overflow: visible;
    padding: 16px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding: 8px;
  }

  .workspace,
  .history-panel {
    padding: 12px;
  }

  h1 {
    font-size: 28px;
  }
}

/* --- About / FAQ content sections ------------------------------------------ */

.content-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px;
}

.content-section h2 {
  font-size: 28px;
  margin-bottom: 14px;
}

.content-section > p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 12px;
  font-size: 16px;
}

.faq-section {
  padding-top: 8px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 18px;
  margin-bottom: 10px;
  background: var(--panel);
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 28px 16px 0;
  position: relative;
}

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

.faq-item summary h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 14px;
  color: var(--accent);
  font-weight: 800;
  font-size: 20px;
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px;
  font-size: 15px;
}

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* --- 404 page ---------------------------------------------------------------- */

.not-found-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 120px 24px;
  text-align: center;
}

.not-found-shell .eyebrow {
  justify-content: center;
}

.not-found-shell h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 12px 0 16px;
}

.not-found-message {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 28px;
  font-size: 16px;
}

.not-found-link {
  display: inline-block;
  text-decoration: none;
}