:root {
  color-scheme: light;
  --ink: #12171f;
  --muted: #5d6775;
  --paper: #fbf8f1;
  --surface: #ffffff;
  --line: #d9d5ca;
  --accent: #e34b35;
  --accent-dark: #b73223;
  --gold: #f4d35e;
  --green: #78c6a3;
  --shadow: 0 24px 70px rgb(28 24 18 / 14%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(18 23 31 / 4%) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(circle at 15% 0%, rgb(244 211 94 / 28%), transparent 32rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.workspace {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(300px, 1fr);
  gap: 20px;
  align-items: stretch;
}

.masthead,
.reference-panel,
.result-panel {
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 88%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.masthead {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 24px;
  border-radius: 8px;
}

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

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.rhyme-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.rhyme-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 58px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #f0eadc;
  transition: background 180ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 180ms ease;
}

.rhyme-toggle input:checked + .switch {
  background: var(--green);
}

.rhyme-toggle input:checked + .switch::after {
  transform: translateX(26px);
}

.reference-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 12px;
  padding: 24px;
  border-radius: 8px;
}

.reference-panel label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reference-panel input {
  width: 100%;
  min-height: 58px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 16px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

.reference-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(227 75 53 / 16%);
}

.primary-action,
.result-actions button {
  min-height: 50px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-action {
  margin-top: 10px;
  background: var(--accent);
  color: white;
  box-shadow: 5px 5px 0 var(--ink);
}

.primary-action:hover,
.result-actions button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.primary-action:disabled,
.result-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.result-panel {
  min-height: 390px;
  border-radius: 8px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.empty-state {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--muted);
  text-align: center;
}

.beat-mark {
  width: 150px;
  height: 28px;
  display: block;
  background:
    linear-gradient(90deg, var(--ink) 0 14px, transparent 14px 26px),
    linear-gradient(90deg, var(--accent) 0 42px, transparent 42px 58px),
    linear-gradient(90deg, var(--gold) 0 22px, transparent 22px 36px),
    linear-gradient(90deg, var(--green) 0 34px, transparent 34px);
  background-size: 26px 8px, 58px 8px, 36px 8px, 46px 8px;
  background-position: 0 0, 12px 10px, 4px 20px, 82px 20px;
  background-repeat: no-repeat;
}

.result {
  display: grid;
  gap: 0;
  align-content: center;
  min-height: 230px;
}

.lyric-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid rgb(19 26 33 / 18%);
}

.lyric-row:last-child {
  border-bottom: 0;
}

.lyric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.lyric-line {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2vw, 1.85rem);
  line-height: 1.3;
  letter-spacing: 0;
}

.status {
  min-height: 22px;
  margin: 0;
  color: var(--accent-dark);
  font-weight: 750;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.result-actions button {
  flex: 1 1 150px;
  background: #fffdf8;
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 620px);
    padding: 18px 0;
    place-items: start center;
  }

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

  .masthead {
    align-items: start;
    flex-direction: column;
    padding: 20px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.4rem);
  }

  .reference-panel,
  .result-panel {
    padding: 18px;
  }

  .lyric-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .result-panel {
    min-height: 330px;
  }
}
