:root {
  color-scheme: light;
  --ink: #181a16;
  --muted: #687064;
  --line: #d9dfd5;
  --paper: #fffdf7;
  --surface: #eef2ea;
  --sidebar: #20251f;
  --sidebar-muted: #aeb8a9;
  --accent: #1f7a6d;
  --accent-strong: #155c54;
  --warm: #b94743;
  --shadow: 0 18px 42px rgba(24, 26, 22, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 12%, rgba(185, 71, 67, 0.2), transparent 28%),
    radial-gradient(circle at 18% 78%, rgba(31, 122, 109, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(238, 242, 234, 0.94)),
    repeating-linear-gradient(135deg, rgba(31, 122, 109, 0.08) 0 1px, transparent 1px 18px);
}

body::before {
  content: "♪ ♫ ♬";
  position: fixed;
  right: 4vw;
  top: 6vh;
  z-index: 0;
  pointer-events: none;
  color: rgba(32, 37, 31, 0.08);
  font-size: clamp(120px, 20vw, 280px);
  font-weight: 900;
  line-height: 0.8;
  white-space: pre;
  transform: rotate(-8deg);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 42px,
      rgba(32, 37, 31, 0.07) 42px 44px,
      transparent 44px 54px,
      rgba(32, 37, 31, 0.07) 54px 56px,
      transparent 56px 66px,
      rgba(32, 37, 31, 0.07) 66px 68px,
      transparent 68px 78px,
      rgba(32, 37, 31, 0.07) 78px 80px,
      transparent 80px 140px
    );
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 16px;
  color: #fff;
  background: var(--sidebar);
}

.brand {
  padding: 0 10px 22px;
  font-size: 24px;
  font-weight: 950;
}

.brand::after {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--warm);
}

.nav-menu {
  display: grid;
  gap: 10px;
}

.nav-link {
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}

.content {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.view {
  display: grid;
  gap: 22px;
}

.view[hidden] {
  display: none !important;
}

.topbar {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(36px, 6vw, 72px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}

.tool-stack {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.input-panel,
.csv-panel,
.converter-status,
.queue {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow);
}

.queue {
  width: 100%;
}

.input-panel,
.csv-panel,
.converter-status {
  padding: 18px;
}

.input-panel {
  border-top: 5px solid var(--accent);
}

.csv-panel,
.converter-status {
  border-top: 5px solid var(--warm);
}

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

.section-heading span {
  color: var(--muted);
  font-weight: 800;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 850;
}

label + select {
  margin-bottom: 12px;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 180px;
  resize: vertical;
  padding: 13px;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  outline: 3px solid rgba(31, 122, 109, 0.2);
  border-color: var(--accent);
}

.actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

button,
.download {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.download:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

button.secondary {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #e2e8df;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  font-weight: 850;
}

.meter {
  position: relative;
  height: 22px;
  overflow: hidden;
  margin: 12px 0;
  border-radius: 999px;
  border: 1px solid rgba(32, 37, 31, 0.14);
  background: #dde5d9;
  box-shadow: inset 0 1px 4px rgba(24, 26, 22, 0.16);
}

.meter span {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(24, 26, 22, 0.55);
}

.meter div {
  position: relative;
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--accent), var(--warm)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.32) 0 10px, rgba(255, 255, 255, 0) 10px 20px);
  background-blend-mode: screen;
  box-shadow: 0 0 18px rgba(31, 122, 109, 0.35);
  transition: width 180ms ease;
}

.meter div::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  transform: translateX(-100%);
}

.meter div.is-active::after {
  animation: meter-shine 1.05s linear infinite;
}

.meter div.is-active {
  animation: meter-pulse 900ms ease-in-out infinite alternate;
}

.converter-meter {
  margin-top: 12px;
}

.message {
  min-height: 24px;
  color: var(--muted);
}

.queue {
  overflow: hidden;
}

.queue-head,
.item {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 92px;
  gap: 14px;
  align-items: start;
}

.queue-head {
  padding: 13px 16px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.items:empty::before {
  content: "No results yet";
  display: block;
  padding: 28px 16px;
  color: var(--muted);
}

.item {
  min-height: 72px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.source,
.links {
  min-width: 0;
}

.source strong,
.source small,
.links a,
.links span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source strong + small {
  margin-top: 6px;
}

.source small,
.links span {
  color: var(--muted);
}

.links a {
  color: var(--accent-strong);
  font-weight: 750;
}

.copy-cell {
  display: flex;
  justify-content: flex-start;
}

.copy-cell button {
  min-height: 36px;
  width: 76px;
  padding: 0 10px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    padding: 0 4px 12px;
  }

  .nav-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    width: min(100% - 20px, 1120px);
    padding: 22px 0;
  }

  .queue-head,
  .item {
    grid-template-columns: 1fr;
  }

  .queue-head {
    display: none;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }
}

@keyframes meter-shine {
  to {
    transform: translateX(100%);
  }
}

@keyframes meter-pulse {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.25) brightness(1.08);
  }
}
