:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #11151a;
  --surface-2: #171c22;
  --line: #2a3139;
  --text: #f4f7f9;
  --muted: #8f9aa6;
  --lime: #c8ff3d;
  --lime-dark: #8fb91e;
  --blue: #74d4ff;
  --danger: #ff6f61;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 8%, rgba(116, 212, 255, .09), transparent 25rem),
    radial-gradient(circle at 8% 78%, rgba(200, 255, 61, .07), transparent 28rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.app-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 1.08rem; font-weight: 900; letter-spacing: .16em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--bg); background: var(--lime); border-radius: 9px 9px 9px 2px; font-size: 1rem; letter-spacing: 0; }
.header-note { color: var(--muted); font-size: .86rem; }

main { padding: 42px 0 62px; }

.tabs { display: inline-flex; padding: 5px; margin-bottom: 48px; background: rgba(23, 28, 34, .72); border: 1px solid var(--line); border-radius: 14px; }
.tab { min-height: 42px; padding: 0 20px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; transition: background .2s, color .2s, transform .2s; }
.tab:hover { color: var(--text); }
.tab:active { transform: scale(.98); }
.tab.active { color: #0c0f12; background: var(--lime); }

.panel { animation: enter .3s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.section-heading { max-width: 680px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--lime); font-size: .77rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.04; letter-spacing: -.045em; }

.search-wrap { position: relative; max-width: 820px; }
.search-wrap input {
  width: 100%;
  height: 78px;
  padding: 0 150px 0 25px;
  border: 1px solid #3a444f;
  border-radius: 18px;
  outline: none;
  color: var(--text);
  background: rgba(17, 21, 26, .88);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input:focus { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(200, 255, 61, .12); }
.search-button { position: absolute; right: 9px; top: 9px; height: 60px; min-width: 126px; padding: 0 19px; border: 0; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 22px; color: #0a0d0e; background: var(--lime); font-weight: 850; cursor: pointer; }

.result-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 39px 0 18px; color: var(--muted); }
.result-summary strong { color: var(--text); font-size: 1.35rem; }
.count { margin-left: auto; font-size: .84rem; }

.search-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; max-width: 820px; margin-top: 14px; }
.rhyme-depth-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .875rem; }
.rhyme-depth-label select { max-width: 220px; font-size: 1rem; }
.data-status { min-height: 22px; margin: 0; color: var(--muted); font-size: .875rem; }
.data-status.ready { color: var(--blue); }
.match-note { margin: -5px 0 22px; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.results-heading { margin: 0 0 2px; color: var(--text); font-size: 1rem; font-weight: 650; }
.results-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.result-group { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(23, 28, 34, .92), rgba(15, 18, 22, .92)); }
.result-group h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 19px; color: var(--text); font-size: 1rem; font-weight: 650; }
.group-count { margin-left: auto; color: var(--muted); font-size: .875rem; font-weight: 400; }
.result-group h3::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px rgba(200, 255, 61, .65); }
.result-group.near h3::before { background: var(--blue); box-shadow: 0 0 14px rgba(116, 212, 255, .55); }
.word-list { display: flex; flex-wrap: wrap; gap: 9px; }
.rhyme-word { min-height: 44px; max-width: 100%; overflow-wrap: anywhere; padding: 8px 14px; border: 1px solid #343d46; border-radius: 11px; color: #e9eef2; background: #1c2229; cursor: pointer; transition: border-color .18s, color .18s, transform .18s; }
.rhyme-word:hover { border-color: var(--lime); color: var(--lime); transform: translateY(-1px); }
.rhyme-word.from-reference { border-color: #586538; }
.rhyme-word.from-reference::before { content: '•'; color: var(--lime); margin-right: 8px; }
.group-pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.page-status { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.page-button { min-height: 44px; padding: 7px 12px; border: 1px solid #3c4650; border-radius: 9px; background: transparent; cursor: pointer; }
.page-button:hover:enabled { border-color: var(--lime); }
.page-button:disabled { opacity: .4; cursor: default; }
.loose-rhymes { margin-top: 18px; padding-top: 26px; border-top: 1px solid var(--line); }
.loose-rhymes > summary { padding: 8px 0; color: var(--blue); cursor: pointer; font-size: 1.05rem; font-weight: 650; }
.loose-note, .no-exact { color: var(--muted); line-height: 1.6; font-size: .95rem; }
.loose-groups { display: grid; gap: 16px; }
.empty-state { padding: 28px; border: 1px dashed #46515c; border-radius: var(--radius); color: var(--muted); }
.source-note { margin: 30px 3px 0; color: var(--muted); font-size: .875rem; line-height: 1.65; }
.source-note summary { width: fit-content; cursor: pointer; padding: 8px 0; }
.source-note a { color: #a9bdcd; text-underline-offset: 3px; }
.source-note a:hover { color: var(--blue); }

.practice-card { overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(150deg, rgba(24, 30, 36, .95), rgba(12, 15, 18, .96)); box-shadow: 0 30px 90px rgba(0, 0, 0, .28); }
.practice-topline { padding: 29px 32px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.practice-topline h1 { font-size: clamp(1.7rem, 4vw, 3rem); }
.practice-settings { display: grid; justify-items: end; gap: 8px; }
.practice-rhyme-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: .9375rem; }
.practice-rhyme-toggle input { width: 20px; height: 20px; margin: 0; accent-color: var(--lime); cursor: pointer; }
.practice-rhyme-toggle input:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.select-label { display: grid; gap: 7px; color: var(--muted); font-size: .75rem; font-weight: 700; }
select { min-height: 44px; padding: 0 38px 0 13px; border: 1px solid #3a444f; border-radius: 10px; color: var(--text); background: var(--surface-2); }

.word-stage { min-height: 440px; display: grid; place-items: center; padding: 40px 20px 30px; }
.timer-ring {
  --progress: 1;
  width: min(330px, 100%);
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--progress) * 1turn), #262d35 0);
  box-shadow: 0 0 70px rgba(200, 255, 61, .08);
  position: relative;
}
.timer-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #101419; }
.word-inner { position: relative; z-index: 1; width: calc(100% - 36px); aspect-ratio: 1; border: 1px solid #2d353e; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.seconds { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.prompt-word-space { width: 90%; min-width: 0; margin: 10px 0 12px; display: flex; justify-content: center; align-items: center; }
.prompt-word { display: block; flex: 0 0 auto; width: max-content; max-width: none; white-space: nowrap; overflow-wrap: normal; word-break: normal; hyphens: none; font-size: 1rem; line-height: 1.15; letter-spacing: -.035em; }
.word-index { color: var(--lime); font-size: .67rem; font-weight: 850; letter-spacing: .18em; }
.word-stage.flash .prompt-word { animation: word-pop .34s ease; }
@keyframes word-pop { 0% { opacity: 0; transform: scale(.90); } 100% { transform: scale(1); } }

.practice-controls { display: flex; justify-content: center; gap: 12px; padding: 0 24px 30px; }
.practice-rhymes { max-width: 740px; margin: 0 auto 26px; padding: 0 24px; text-align: center; }
.practice-rhymes h2 { margin: 0; font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.practice-rhyme-status { margin: 8px 0 14px; min-height: 1.5em; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.practice-rhyme-list { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.practice-rhyme-list li { max-width: 100%; padding: 7px 12px; border: 1px solid #364959; border-radius: 10px; color: #c0e9ff; background: #16212a; font-size: 1rem; line-height: 1.4; overflow-wrap: anywhere; }
.practice-rhymes-loose h3 { margin: 18px 0 9px; color: var(--muted); font-size: .875rem; font-weight: 500; }
.practice-rhymes-loose li { color: #bdc7d1; background: var(--surface-2); border-style: dashed; border-color: #47515d; }
.practice-rhyme-note { margin: 16px auto 0; max-width: 520px; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.primary-button, .secondary-button { min-height: 52px; padding: 0 24px; border-radius: 13px; font-weight: 850; cursor: pointer; }
.primary-button { min-width: 150px; border: 0; color: #0b0e10; background: var(--lime); }
.secondary-button { border: 1px solid #3c4650; color: var(--text); background: transparent; }
.primary-button:hover { background: #d7ff70; }
.secondary-button:hover { border-color: #73808d; }

.pace-row { min-height: 78px; padding: 15px 30px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .85rem; }
.pace-buttons { display: flex; gap: 6px; }
.pace-buttons button { width: 46px; min-height: 38px; border: 1px solid #343e48; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.pace-buttons button.active { color: #0b0e10; border-color: var(--blue); background: var(--blue); font-weight: 850; }
.shortcut-note { text-align: center; color: #6f7a85; font-size: .78rem; }
kbd { padding: 3px 7px; border: 1px solid #343d46; border-bottom-width: 2px; border-radius: 5px; background: #151a20; }

footer { min-height: 90px; padding: 23px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: #69747e; font-size: .76rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.practice-pool { color: var(--muted); text-align: center; font-size: .875rem; line-height: 1.6; }
.storage-warning { padding: 14px 18px; border: 1px solid #976344; border-radius: 12px; background: #2d211a; color: #ffcb9f; font-size: 1rem; line-height: 1.55; }
.workshop-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.workshop-heading h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
.save-status { color: var(--blue); font-size: .875rem; text-align: right; }
.save-status.unsaved { color: #ffcb9f; }
.storage-notice { margin: 20px 0 24px; max-width: 820px; color: var(--muted); font-size: .875rem; line-height: 1.65; }
.storage-notice strong { color: #d6dfe7; font-weight: 600; }
.draft-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.draft-picker { display: grid; gap: 7px; flex: 1 1 240px; color: var(--muted); font-size: .875rem; min-width: 0; }
.draft-picker select { width: 100%; min-width: 0; }
.small-button { min-height: 44px; border: 1px solid #3c4650; border-radius: 10px; background: var(--surface-2); color: var(--text); padding: 9px 14px; font-size: .875rem; cursor: pointer; }
.small-button:hover { border-color: var(--lime); }
.draft-file-menu { position: relative; }
.draft-file-menu > summary { padding: 12px 14px; min-height: 44px; cursor: pointer; font-size: .875rem; color: var(--blue); }
.draft-file-menu[open] { flex-basis: 100%; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: #171c22; border: 1px solid #45515d; border-radius: 12px; }
.workshop-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 15px 0 22px; border-top: 1px solid var(--line); }
.workshop-options label { display: flex; align-items: center; gap: 8px; color: #c0cad3; font-size: .875rem; }
.workshop-options input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--lime); }
.workshop-options input[type=number] { width: 95px; }
.workshop-options input[type=number], .workshop-dialog input { min-height: 44px; border: 1px solid #3a444f; border-radius: 9px; background: var(--surface-2); padding: 8px 10px; color: var(--text); }
.writing-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor-pane, .analysis-pane { min-width: 0; border: 1px solid var(--line); background: #101419; border-radius: 18px; overflow: hidden; }
.editor-pane { border-top: 3px solid var(--lime); }
.draft-title { width: 100%; min-height: 65px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: transparent; padding: 17px 20px; font-size: 1.2rem; font-weight: 750; }
.draft-title:focus { outline: none; box-shadow: inset 0 -2px var(--lime); }
.section-buttons { display: flex; flex-wrap: wrap; gap: 2px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.quiet-button { min-height: 40px; padding: 8px 10px; border: 0; border-radius: 7px; color: #adbbc7; background: transparent; font-size: .875rem; cursor: pointer; }
.quiet-button:hover { background: #222a33; color: var(--text); }
.danger-text { color: #eda195; }
#draft-text { width: 100%; display: block; min-height: 395px; resize: vertical; padding: 21px 20px; border: 0; outline: none; color: var(--text); background: transparent; font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 1rem; line-height: 1.85; tab-size: 4; }
#draft-text:focus { box-shadow: inset 3px 0 0 var(--lime); }
#draft-text::placeholder { color: #7c8995; opacity: 1; }
.editor-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 6px; min-height: 54px; padding: 6px 10px; border-top: 1px solid var(--line); }
#draft-stats { padding-left: 10px; font-size: .875rem; color: var(--muted); }
.analysis-pane { padding: 20px 16px 16px; }
.analysis-heading, .ideas-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.analysis-heading h2, .workshop-detail h2 { margin: 0; font-size: 1.1rem; }
#analysis-status { color: var(--muted); font-size: .8125rem; }
.analysis-help { margin: 12px 0 18px; font-size: .875rem; color: var(--muted); line-height: 1.65; }
.rhyme-legend { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.rhyme-legend:empty { display: none; }
.legend-item { border-radius: 6px; padding: 4px 7px; font-size: .8125rem; max-width: 100%; overflow-wrap: anywhere; }
.lyric-preview { min-height: 220px; max-height: 630px; overflow-y: auto; padding-bottom: 10px; }
.lyric-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) 39px 44px; gap: 6px; align-items: start; padding: 7px 0; }
.line-number { color: #818e9b; font-size: .8125rem; line-height: 2.1; font-variant-numeric: tabular-nums; }
.line-words { white-space: pre-wrap; font-size: 1rem; line-height: 1.9; overflow-wrap: anywhere; }
.lyric-word { display: inline; margin: 0; padding: 2px 0; background: none; border: 0; border-radius: 3px; color: inherit; text-align: inherit; line-height: inherit; cursor: pointer; overflow-wrap: anywhere; }
.lyric-word:hover { background: #ffffff12; }
.lyric-word mark { color: #101318; border-radius: 3px; padding: 1px 0; }
.rhyme-color-0 { background: #d7f781; color: #101318; }
.rhyme-color-1 { background: #81dced; color: #101318; }
.rhyme-color-2 { background: #cbb2ff; color: #101318; }
.rhyme-color-3 { background: #ffb4c4; color: #101318; }
.rhyme-color-4 { background: #ffd38c; color: #101318; }
.rhyme-color-5 { background: #7fe1b8; color: #101318; }
.rhyme-color-6 { background: #9abfff; color: #101318; }
.rhyme-color-7 { background: #efa3f3; color: #101318; }
.rhyme-color-8 { background: #ebeb99; color: #101318; }
.rhyme-color-9 { background: #feb596; color: #101318; }
.support-stave { text-decoration: underline dotted var(--blue) 2px; text-underline-offset: 5px; }
.head-stave { text-decoration: underline double var(--blue) 2px; text-underline-offset: 5px; }
.syllable-count { margin-top: 2px; padding: 5px 0; border: 1px solid #35414d; border-radius: 6px; background: #1d252e; color: var(--blue); font-size: .875rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.syllable-count.manual { border-style: dashed; color: var(--lime); }
.count-delta { display: block; font-size: .75rem; color: #aebbc7; margin-top: 2px; }
.line-scheme { padding-top: 8px; font-size: .75rem; text-align: right; color: #b8c4ce; }
.verse-heading { margin: 15px 0 8px; color: var(--lime); font-size: .95rem; overflow-wrap: anywhere; }
.verse-gap { min-height: 14px; }
.preview-empty { color: #84929f; font-size: 1rem; line-height: 1.8; margin: 14px 10px; }
.scheme-summary { color: #afbdc9; border-top: 1px solid var(--line); padding-top: 15px; margin-bottom: 0; font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.scheme-summary:empty { display: none; }
.analysis-caveat { font-size: .875rem; color: #98a6b3; line-height: 1.7; margin: 15px 0 24px; }
.analysis-caveat a { color: var(--blue); }
.workshop-detail { border: 1px solid var(--line); border-radius: 18px; background: #11161c; padding: 22px; margin-top: 22px; }
.workshop-detail > p { color: #a2b0bd; font-size: .95rem; line-height: 1.7; }
.estimate-label { display: inline-block; padding: 5px 8px; border: 1px solid #3a4650; border-radius: 6px; color: #b8c5d1; font-size: .8125rem; font-weight: 400; margin-left: 6px; }
.alliteration-pair { border-left: 2px solid #41596a; padding: 8px 14px; color: #c3cfd9; font-size: .95rem; line-height: 1.7; }
.timing-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.timing-heading label { display: flex; align-items: center; gap: 10px; color: #b4c2cd; font-size: .875rem; }
.workshop-detail > .timing-help { font-size: .875rem; color: #94a5b4; margin-top: -4px; }
.beat-grid { display: grid; gap: 18px; min-width: 0; }
.timing-row { min-width: 0; border: 1px solid #34424f; border-radius: 13px; background: #10171e; overflow: hidden; }
.timing-row-heading { display: flex; align-items: baseline; gap: 14px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.timing-line-number { color: var(--blue); font-size: .875rem; flex-shrink: 0; }
.timing-line-text { margin: 0; color: #b3c1cd; font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; min-width: 0; }
.timing-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: #586c80 #141d26; scrollbar-width: thin; }
.timing-scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.timing-board { min-width: 700px; padding: 0 16px 4px; }
.timing-ruler { position: relative; height: 45px; border-bottom: 1px solid #43586b; color: var(--blue); user-select: none; }
.timing-tick, .timing-half { position: absolute; top: 12px; transform: translateX(-50%); font-size: .95rem; font-variant-numeric: tabular-nums; }
.timing-tick { font-weight: 800; }
.timing-half { color: #6f859a; font-size: .875rem; }
.pickup-label { position: absolute; left: 4px; top: 15px; color: #798d9f; font-size: .8125rem; }
.timing-track { position: relative; min-height: 80px; background: linear-gradient(to right, #0a101766 20%, transparent 20%); }
.timing-gridline { position: absolute; top: 0; bottom: 0; width: 1px; border-left: 1px dotted #293a49; pointer-events: none; }
.timing-gridline.major { border-left: 1px solid #3d5264; }
.timing-gridline.first { border-color: #668ca8; }
.timing-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--lime); opacity: .6; pointer-events: none; }
.timing-word { position: absolute; z-index: 1; width: max-content; max-width: calc(100% - 4px); min-height: 44px; padding: 8px; border: 1px solid #4b6173; border-radius: 8px; background: #1b2a36; color: #edf4fa; font-size: 1rem; line-height: 1.4; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.timing-word-label { white-space: pre-wrap; overflow-wrap: anywhere; }
.timing-word:hover { border-color: #96bfdc; background: #243a4c; }
.timing-word.placed { border-bottom-color: var(--lime); }
.timing-word.selected { border-color: var(--lime); background: #26341f; color: #f1ffd8; z-index: 2; }
.timing-word.dragging { cursor: grabbing; box-shadow: 0 5px 18px #0007; z-index: 3; }
.timing-grab-mark { display: none; position: absolute; top: -5px; width: 2px; height: 6px; background: var(--lime); pointer-events: none; }
.selected > .timing-grab-mark { display: block; }
.timing-inspector { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px; border-top: 1px solid #354633; background: #172018; }
.timing-selection { font-size: 1rem; color: #e9ffc6; overflow-wrap: anywhere; max-width: 100%; }
.timing-position { color: #bbcfaa; font-size: .875rem; font-variant-numeric: tabular-nums; }
.timing-field { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #aabc9e; font-size: .875rem; }
.timing-field select { max-width: 100%; min-width: 0; font-size: .875rem; }
.timing-nudge, .timing-align { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #aabc9e; font-size: .875rem; }
.timing-nudge button, .timing-align button { min-width: 44px; }
.workshop-detail > .timing-status { min-height: 24px; color: var(--blue); font-size: .875rem; }
.ideas-controls { display: flex; flex-wrap: wrap; gap: 12px; }
.ideas-controls select { flex: 1; }
.ideas-controls button { min-height: 48px; font-size: .95rem; }
.ideas-controls button:disabled { opacity: .6; cursor: wait; }
.idea-results { font-size: 1rem; line-height: 1.7; }
.idea-context { padding-left: 15px; border-left: 3px solid var(--blue); color: #e4edf5; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-length { font-size: .875rem; color: #a5b3bf; }
.writing-prompt { color: #e4edf5; max-width: 790px; }
.idea-word-list { display: flex; flex-wrap: wrap; gap: 8px; }
.idea-word { min-height: 44px; border: 1px solid #4d5e34; border-radius: 8px; background: #1b2418; padding: 8px 12px; color: #daedb8; font-size: .95rem; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.idea-word:hover { border-color: var(--lime); }
.workshop-dialog { width: min(490px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow: auto; background: #141b23; color: var(--text); border: 1px solid #54626f; border-radius: 20px; padding: 24px; }
.workshop-dialog::backdrop { background: #020509bc; }
.dialog-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.dialog-heading h2 { font-size: 1.25rem; margin: 0; overflow-wrap: anywhere; }
.workshop-dialog label { display: grid; gap: 10px; margin-block: 18px; font-size: .95rem; }
.workshop-dialog select { width: 100%; min-width: 0; }
.workshop-dialog p { line-height: 1.65; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 880px) {
  .writing-grid { grid-template-columns: minmax(0, 1fr); }
  #draft-text { min-height: 330px; }
  .lyric-preview { max-height: 550px; }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 22px, 1080px); }
  .topbar { min-height: 70px; }
  .header-note { display: none; }
  main { padding: 25px 0 42px; }
  .tabs { width: 100%; margin-bottom: 35px; }
  .tab { flex: 1; padding: 0 10px; font-size: .88rem; }
  .search-wrap input { height: 68px; padding-left: 18px; padding-right: 74px; }
  .search-button { width: 54px; min-width: 54px; height: 52px; padding: 0; justify-content: center; }
  .search-button span:first-child { display: none; }
  .results-grid { grid-template-columns: 1fr; }
  .result-group { padding: 18px 15px; }
  .search-options { align-items: flex-start; flex-direction: column; }
  .rhyme-depth-label { width: 100%; justify-content: space-between; }
  .rhyme-depth-label select { flex: 1; }
  .group-pager { gap: 8px; justify-content: space-between; }
  .count { width: 100%; margin-left: 0; }
  .practice-topline { padding: 23px 20px; align-items: stretch; flex-direction: column; }
  .practice-settings { justify-items: stretch; }
  .practice-rhymes { padding-inline: 16px; }
  .word-stage { min-height: 370px; padding-top: 30px; }
  .practice-controls { display: grid; grid-template-columns: 1fr 1fr; padding-inline: 16px; }
  .primary-button, .secondary-button { padding-inline: 12px; min-width: 0; }
  .pace-row { padding-inline: 18px; flex-direction: column; align-items: stretch; }
  .pace-buttons { display: grid; grid-template-columns: repeat(4, 1fr); }
  .pace-buttons button { width: auto; }
  footer { align-items: flex-start; flex-direction: column; }
  .tabs { flex-wrap: wrap; }
  .tab { flex: 1 1 auto; min-width: 0; max-width: 100%; padding-inline: 8px; }
  .workshop-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .save-status { text-align: left; }
  .draft-toolbar { align-items: stretch; }
  .draft-picker { flex-basis: 100%; }
  .draft-file-menu > summary { padding-inline: 8px; }
  .workshop-options { gap: 12px 14px; }
  .workshop-options label { flex-wrap: wrap; }
  .workshop-detail { padding: 18px 14px; }
  .analysis-pane { padding: 18px 11px; }
  .lyric-line { grid-template-columns: 20px minmax(0, 1fr) 35px 40px; gap: 5px; }
  .timing-row-heading { align-items: flex-start; flex-direction: column; gap: 5px; padding: 12px; }
  .timing-inspector { padding: 12px; gap: 12px; }
  .timing-field, .timing-align { flex-basis: 100%; }
  .ideas-controls { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

.dictionary-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.definition-card { min-width: 0; }
.definition-word { display: block; font-size: 1.6rem; overflow-wrap: anywhere; }
.definition-help, .definition-status { color: var(--muted); font-size: .875rem; line-height: 1.6; }
.definition-entry { margin: 20px 0; }
.definition-entry h4 { margin: 0 0 12px; color: var(--blue); font-size: .9rem; }
.definition-sense { line-height: 1.65; overflow-wrap: anywhere; }
.definition-sense + .definition-sense { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.definition-sense .definition-sense { margin: 12px 0 0 10px; border-left: 2px solid var(--line); padding-left: 12px; }
.definition-meaning { margin: 8px 0; }
.definition-phrase { font-weight: 700; margin: 8px 0; }
.definition-example { margin: 8px 0; color: #c5ced8; font-size: .92rem; }
.definition-labels, .definition-grammar { margin: 5px 0; color: var(--muted); font-size: .8rem; }
.definition-collocations { margin: 12px 0; font-size: .85rem; }
.definition-collocations summary { cursor: pointer; color: var(--blue); }
.definition-attribution { font-size: .72rem; line-height: 1.65; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.definition-card a { color: var(--blue); }
.definition-card .small-button { margin-top: 10px; }
.rhyme-word.selected-word { color: var(--lime); border-color: var(--lime); background: #25301b; }
@media (min-width: 900px) {
  .dictionary-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 20px; }
  .definition-card { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow: auto; }
}

.related-words {display:flex;flex-wrap:wrap;gap:.4rem;margin:.75rem 0;}
.related-words button {max-width:100%;overflow-wrap:anywhere;text-align:left;}
.language-panel {margin-top:1rem;}
#language-analysis {overflow-x:auto;}
.language-table {width:100%;border-collapse:collapse;margin:1rem 0;}
.language-table th,.language-table td {padding:.6rem;text-align:left;border-bottom:1px solid var(--border,#ddd);}
.language-table button {text-align:left;}
.language-suggestions {margin:.8rem 0;}
.language-suggestions summary {cursor:pointer;font-weight:600;}
.language-context {overflow-wrap:anywhere;}

.compound-plan {border-top:1px solid var(--border,#ddd);padding-top:.75rem;margin-top:1rem;}
.compound-part {border-left:3px solid var(--border,#ddd);padding-left:.7rem;margin:.8rem 0;}
.definition-language {font-size:.8rem;font-weight:600;}
.definition-source {font-size:.75rem;}

.rhyme-filters {display:flex;flex-wrap:wrap;gap:.75rem 1.25rem;margin:1rem 0;padding:.8rem 1rem;border:1px solid var(--line);border-radius:12px;}
.rhyme-filters legend {font-size:.85rem;color:var(--muted);padding:0 .35rem;}
.rhyme-filters label {display:flex;align-items:center;gap:.5rem;font-size:.85rem;cursor:pointer;}
.rhyme-filters input {accent-color:var(--lime);width:18px;height:18px;flex-shrink:0;}
.rhyme-filters p {flex-basis:100%;margin:0;font-size:.75rem;color:var(--muted);}
.definition-preview,.definition-expand {display:none;}
@media (max-width:899px) {
 .definition-card:not([data-expanded="true"]) #definition-full {display:none;}
 .definition-card:not([data-expanded="true"]) .definition-preview {display:block;}
 .definition-expand:not([hidden]) {display:inline-flex;}
 .definition-preview-meaning {line-height:1.65;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;}
 .rhyme-filters label {min-height:32px;}
}

.favorite-word-pair {display:inline-flex;align-items:stretch;max-width:100%;gap:0;border:1px solid #343d46;border-radius:11px;background:#1c2229;}
.favorite-word-pair:has(.from-reference) {border-color:#586538;}
.favorite-word-pair:has(.selected-word),.favorite-word-pair:focus-within {border-color:var(--lime);}
.favorite-word-pair .rhyme-word {border:0;background:transparent;border-radius:10px 0 0 10px;padding-right:5px;min-width:0;}
.favorite-word-pair .rhyme-word:hover {transform:none;}
.favorite-toggle {flex-shrink:0;min-width:32px;min-height:44px;padding:6px 9px 6px 4px;border:0;border-radius:0 10px 10px 0;background:transparent;color:#cbd3dc;font-size:16px;cursor:pointer;}
.favorite-toggle[aria-pressed="true"],#definition-favorite[aria-pressed="true"] {color:var(--lime);border-color:var(--lime);}
.favorite-toggle:hover {border-color:var(--lime);}
#favorites-count {font-size:12px;margin-left:5px;}
#favorites-list {margin-top:24px;}
#definition-favorite {float:right;margin-left:8px;}

/* Ríma wordmark: the acute accent doubles as a pen stroke. */
.brand {display:inline-flex;flex-direction:column;align-items:flex-start;gap:4px;letter-spacing:0;padding:17px 0;}
.brand-wordmark {font-size:2.65rem;line-height:1.08;font-weight:900;letter-spacing:-.075em;}
.brand-accent {color:var(--lime);}
.brand-tagline {color:var(--muted);font-size:.8rem;line-height:1.5;font-weight:500;letter-spacing:.015em;}
.sponsor-slot {margin:40px 0 28px;padding:18px 22px;border:1px solid var(--line);border-radius:14px;background:var(--surface);}
.sponsor-label {margin:0 0 10px;color:var(--muted);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase;}
.sponsor-content {min-height:80px;display:flex;align-items:center;justify-content:center;gap:16px;flex-wrap:wrap;overflow-wrap:anywhere;}
.sponsor-content img {max-width:100%;height:auto;}
.sponsor-content a {color:var(--text);}
@media (max-width:680px) {
  .tabs {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin-bottom:28px;}
  .tab {min-height:44px;padding:9px 6px;overflow-wrap:anywhere;}
  .brand-wordmark {font-size:2.25rem;}
  .brand-tagline {font-size:.76rem;}
  .section-heading {margin-bottom:22px;}
  .rhyme-filters {gap:8px;padding:10px 12px;}
  .rhyme-filters label {min-height:44px;align-items:center;}
  .rhyme-filters input {flex-shrink:0;}
  .rhyme-filters p {line-height:1.6;}
  .result-summary strong {max-width:100%;overflow-wrap:anywhere;}
  .definition-card {min-width:0;}
  #definition-favorite {float:none;display:block;margin:0 0 12px;min-height:44px;}
  .definition-card .small-button {min-height:44px;max-width:100%;white-space:normal;}
  input:not([type="checkbox"]):not([type="radio"]),select,textarea {font-size:max(16px,1rem);}
  .search-wrap input {font-size:1.2rem;}
  .sponsor-slot {margin-top:32px;padding:14px;}
  .sponsor-content {min-height:60px;}
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {animation:none!important;transition:none!important;scroll-behavior:auto!important;}
}

footer {flex-wrap:wrap;gap:16px;}
.footer-contact {line-height:1.6;}
.footer-contact a {color:var(--lime);text-underline-offset:3px;overflow-wrap:anywhere;}
@media (max-width:680px) {.footer-contact a {display:block;padding:6px 0;min-height:44px;}}
