:root {
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --ink: #1a1423;
  --cream: #faf6ef;
  --accent: #e85d4c;
  --accent-dark: #c43d2e;
  --mint: #3d8b7a;
  --mint-dark: #2d6b5e;
  --lavender: #d4c5f9;
  --card: #fffdf9;
  --border: #e8dfd0;
  --muted: #6b5f72;
  --shadow: 0 12px 40px rgba(26, 20, 35, 0.08);
  --control-height: 2.8125rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, var(--lavender) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, #fde8d8 0%, transparent 50%),
    var(--cream);
  line-height: 1.5;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mint);
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.02em;
}

.subtitle {
  max-width: 36rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.layout {
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .form-card {
    position: sticky;
    top: 1.5rem;
  }

  .results {
    grid-column: 2;
  }
}

#results {
  scroll-margin-top: 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2,
.card h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 0 0 1rem;
}

.card h2 {
  font-size: 1.35rem;
}

.card h3 {
  font-size: 1.1rem;
}

.field {
  margin-bottom: 1rem;
}

.field-row {
  display: grid;
  gap: 1rem;
}

@media (min-width: 520px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.req {
  color: var(--accent);
}

input,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: inherit;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--ink);
}

input {
  min-height: var(--control-height);
  box-sizing: border-box;
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

input:focus,
textarea:focus {
  outline: 2px solid var(--mint);
  outline-offset: 1px;
}

.custom-select {
  position: relative;
}

.custom-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: var(--control-height);
  padding: 0.65rem 0.85rem;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: inherit;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s;
}

.custom-select-trigger:hover {
  border-color: #d4c5f9;
}

.custom-select-trigger:focus {
  outline: 2px solid var(--mint);
  outline-offset: 1px;
  border-color: var(--mint);
}

.custom-select.open .custom-select-trigger {
  border-color: var(--mint);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.custom-select-chevron {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%233d8b7a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
  transition: transform 0.15s;
}

.custom-select.open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  border: 1px solid var(--mint);
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  background: #fff;
  box-shadow: var(--shadow);
  max-height: 14rem;
  overflow-y: auto;
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  padding: 0.6rem 0.85rem;
  font-family: var(--font-mono);
  font-size: inherit;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: #f3f0fa;
  outline: none;
}

.custom-select-option[aria-selected="true"] {
  background: #e8f4f1;
  color: var(--mint-dark);
}

.form-section-heading {
  margin: 1.5rem 0 1rem;
  font-size: 1rem;
  color: var(--muted);
}

fieldset.hobbies {
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1rem 0.25rem;
  margin: 0 0 1rem;
}

fieldset.hobbies legend {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 0.25rem;
}

.fieldset-hint,
.form-hint {
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

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

.btn-primary,
.btn-secondary,
.btn-ghost {
  font: inherit;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: transform 0.15s, background 0.15s;
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  color: #fff;
  background: var(--mint);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--mint-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-secondary {
  padding: 0.65rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-ghost {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--ink);
}

.error {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(135deg, var(--card) 0%, #fde8d8 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.highlight-card {
  background: linear-gradient(135deg, #fff9f5 0%, #f3ede8 100%);
  border-color: #e0d0c0;
  scroll-margin-top: 1.25rem;
}

.repo-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.highlight-card h2 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.tagline {
  color: var(--mint);
  font-weight: 500;
  margin: 0 0 1.25rem;
}

.limerick {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  line-height: 1.7;
  margin: 0;
  white-space: pre-wrap;
}

.limerick-cursor {
  display: inline-block;
  width: 0.12em;
  min-width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.08em;
  background: var(--ink);
  animation: limerick-cursor-blink 0.65s step-end infinite;
}

@keyframes limerick-cursor-blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .limerick-cursor {
    display: none;
  }
}

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

.card-header h3 {
  margin: 0;
}

.markdown-preview {
  margin: 0;
  padding: 1rem;
  background: var(--cream);
  border-radius: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow-y: auto;
}

.rhyme-grid {
  display: grid;
  gap: 0.75rem;
}

.rhyme-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--cream);
  border-radius: 0.5rem;
}

.rhyme-chip strong {
  color: var(--accent);
  min-width: 5rem;
}

.rhyme-chip span {
  font-size: 0.9rem;
  color: var(--muted);
}

.tips-list {
  margin: 0;
  padding-left: 1.25rem;
}

.tips-list li {
  margin-bottom: 0.5rem;
}

.tips-list li:last-child {
  margin-bottom: 0;
}

.actions {
  display: flex;
  justify-content: flex-end;
}
