/* Playable Theory: Songwriter's Idea Book, Rhyming Dictionary, Thesaurus.
   Matches app/styles.css light mode and Stage Mode. No rose or magenta hues. Offline UI only. */

.sw-panel {
  --sw-teal: #2f6b63;
  --sw-amber: #e0a030;
  --sw-gold: #a86f10;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--card, #fffaf1);
  color: var(--ink, #1c1712);
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 1px 2px rgba(40, 24, 8, 0.08), 0 8px 24px rgba(40, 24, 8, 0.06));
  padding: 16px 16px 20px;
  margin: 18px 0;
}

.sw-panel * { box-sizing: border-box; }

.sw-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.sw-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent, #5a3a22);
}

.sw-header h2 {
  margin: 0;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sw-lede {
  margin: 0 0 12px;
  color: var(--muted, #5c4f40);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 46rem;
}

.sw-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.sw-tab {
  font: 600 0.9rem/1 system-ui, -apple-system, sans-serif;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule, #d7c8ae);
  background: #fff;
  color: var(--ink, #1c1712);
  cursor: pointer;
}

.sw-tab[aria-selected="true"] {
  background: var(--play, #2d5a3d);
  border-color: var(--play, #2d5a3d);
  color: #fff;
}

.sw-btn {
  font: 600 0.88rem/1 system-ui, -apple-system, sans-serif;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule, #d7c8ae);
  background: #fff;
  color: var(--ink, #1c1712);
  cursor: pointer;
}

.sw-btn:hover, .sw-tab:hover { background: var(--accent-soft, #e6dac4); }

.sw-btn.primary {
  background: var(--play, #2d5a3d);
  border-color: var(--play, #2d5a3d);
  color: #fff;
}

.sw-btn.primary:hover { filter: brightness(1.08); }

.sw-btn.danger { color: #7a2e18; border-color: #c9a090; }

.sw-btn:disabled { opacity: 0.5; cursor: default; }

.sw-input, .sw-select, .sw-area {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #1c1712);
  font: 500 0.95rem/1.35 system-ui, -apple-system, sans-serif;
}

.sw-area {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
  font-size: 1rem;
}

.sw-area.notes { min-height: 72px; font-size: 0.92rem; }

.sw-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; }

.sw-field label, .sw-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #5c4f40);
}

.sw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}

.sw-row .sw-input, .sw-row .sw-select { width: auto; flex: 1 1 140px; }

.sw-pane[hidden], .sw-panel [hidden] { display: none !important; }

/* ---- Idea book ---- */
.sw-ideas {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 14px;
  align-items: start;
}

.sw-list {
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 10px;
  background: var(--paper, #f4efe4);
  max-height: 640px;
  overflow: auto;
}

.sw-idea {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--rule, #d7c8ae);
  background: transparent;
  color: var(--ink, #1c1712);
  padding: 10px 12px;
  cursor: pointer;
  font: 0.92rem/1.35 system-ui, sans-serif;
}

.sw-idea:hover, .sw-idea:focus { background: #f3ead9; outline: none; }

.sw-idea.active {
  background: var(--accent-soft, #e6dac4);
  font-weight: 600;
}

.sw-idea .sw-idea-title { display: block; font-weight: 650; }

.sw-idea .sw-idea-meta {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted, #5c4f40);
  margin-top: 2px;
}

.sw-idea.pinned .sw-idea-title::before { content: "★ "; color: var(--sw-gold, #a86f10); }

.sw-empty {
  margin: 0;
  padding: 16px 12px;
  color: var(--muted, #5c4f40);
  font-size: 0.9rem;
}

.sw-editor {
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 10px;
  padding: 12px;
  background: var(--card, #fffaf1);
}

.sw-stamp {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent, #5a3a22);
  background: #f6efe6;
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink, #1c1712);
}

.sw-syl {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--paper, #f4efe4);
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink, #1c1712);
  max-height: 140px;
  overflow: auto;
}

.sw-syl ol { margin: 0; padding-left: 1.3rem; }

.sw-syl .sw-syl-total {
  margin: 6px 0 0;
  color: var(--muted, #5c4f40);
  font-weight: 600;
}

.sw-peek {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px dashed var(--rule, #d7c8ae);
  border-radius: 8px;
  background: var(--paper, #f4efe4);
}

.sw-peek h3, .sw-group h3, .sw-bank h3 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #5c4f40);
  font-weight: 700;
}

/* ---- Rhymes & thesaurus ---- */
.sw-lookup-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.sw-lookup-bar .sw-input { flex: 1 1 200px; }

.sw-meta-line {
  margin: 0 0 10px;
  color: var(--muted, #5c4f40);
  font-size: 0.9rem;
}

.sw-group { margin: 0 0 14px; }

.sw-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.sw-chip {
  font: 550 0.86rem/1 system-ui, sans-serif;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule, #d7c8ae);
  background: #fff;
  color: var(--ink, #1c1712);
  cursor: pointer;
}

.sw-chip:hover, .sw-chip:focus {
  background: var(--accent-soft, #e6dac4);
  outline: none;
}

.sw-chip.rhyme { border-color: #c9b48a; }
.sw-chip.syn { border-color: #8fb3ad; }
.sw-chip.rel { border-color: #c9b48a; background: #fbf6ea; }
.sw-chip.bank-word { background: #f6efe6; }

.sw-banks { display: grid; gap: 10px; margin-top: 8px; }
.sw-bank {
  border: 1px solid var(--rule, #d7c8ae);
  border-radius: 10px;
  padding: 10px;
  background: var(--paper, #f4efe4);
}
.sw-bank-btn {
  font: 650 0.88rem/1.2 system-ui, sans-serif;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #5a3a22);
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.sw-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  background: #29231d;
  color: #f1e6d2;
  border-radius: 999px;
  padding: 10px 16px;
  font: 600 0.9rem/1 system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.sw-loading, .sw-miss {
  margin: 8px 0;
  color: var(--muted, #5c4f40);
}

/* ---- Stage Mode (html[data-theme=stage] or body.stage-mode) ---- */
html[data-theme="stage"] .sw-tab,
html[data-theme="stage"] .sw-btn,
html[data-theme="stage"] .sw-input,
html[data-theme="stage"] .sw-select,
html[data-theme="stage"] .sw-area,
html[data-theme="stage"] .sw-chip,
body.stage-mode .sw-tab,
body.stage-mode .sw-btn,
body.stage-mode .sw-input,
body.stage-mode .sw-select,
body.stage-mode .sw-area,
body.stage-mode .sw-chip,
[data-theme="stage"] .sw-tab,
[data-theme="stage"] .sw-btn,
[data-theme="stage"] .sw-input,
[data-theme="stage"] .sw-select,
[data-theme="stage"] .sw-area,
[data-theme="stage"] .sw-chip {
  background: #332b23;
  color: var(--ink, #f1e6d2);
  border-color: var(--rule, #4d3f31);
}

html[data-theme="stage"] .sw-tab[aria-selected="true"],
html[data-theme="stage"] .sw-btn.primary,
body.stage-mode .sw-tab[aria-selected="true"],
body.stage-mode .sw-btn.primary,
[data-theme="stage"] .sw-tab[aria-selected="true"],
[data-theme="stage"] .sw-btn.primary {
  background: #3f7a52;
  border-color: #3f7a52;
  color: #fffaf1;
}

html[data-theme="stage"] .sw-tab:hover,
html[data-theme="stage"] .sw-btn:hover,
html[data-theme="stage"] .sw-chip:hover,
html[data-theme="stage"] .sw-idea:hover,
html[data-theme="stage"] .sw-idea:focus,
body.stage-mode .sw-tab:hover,
body.stage-mode .sw-btn:hover,
body.stage-mode .sw-chip:hover,
body.stage-mode .sw-idea:hover,
body.stage-mode .sw-idea:focus,
[data-theme="stage"] .sw-tab:hover,
[data-theme="stage"] .sw-btn:hover,
[data-theme="stage"] .sw-chip:hover,
[data-theme="stage"] .sw-idea:hover,
[data-theme="stage"] .sw-idea:focus {
  background: #3d3024;
}

html[data-theme="stage"] .sw-idea.active,
body.stage-mode .sw-idea.active,
[data-theme="stage"] .sw-idea.active { background: #4a3a28; }

html[data-theme="stage"] .sw-list,
html[data-theme="stage"] .sw-stamp,
html[data-theme="stage"] .sw-syl,
html[data-theme="stage"] .sw-peek,
html[data-theme="stage"] .sw-bank,
body.stage-mode .sw-list,
body.stage-mode .sw-stamp,
body.stage-mode .sw-syl,
body.stage-mode .sw-peek,
body.stage-mode .sw-bank,
[data-theme="stage"] .sw-list,
[data-theme="stage"] .sw-stamp,
[data-theme="stage"] .sw-syl,
[data-theme="stage"] .sw-peek,
[data-theme="stage"] .sw-bank {
  background: #3d3024;
  color: var(--ink, #f1e6d2);
  border-color: var(--rule, #4d3f31);
}

html[data-theme="stage"] .sw-chip.rel,
html[data-theme="stage"] .sw-chip.bank-word,
body.stage-mode .sw-chip.rel,
body.stage-mode .sw-chip.bank-word,
[data-theme="stage"] .sw-chip.rel,
[data-theme="stage"] .sw-chip.bank-word { background: #4a3a28; }

html[data-theme="stage"] .sw-btn.danger,
body.stage-mode .sw-btn.danger,
[data-theme="stage"] .sw-btn.danger { color: #f0c0a8; border-color: #6a4030; }

html[data-theme="stage"] .sw-bank-btn,
body.stage-mode .sw-bank-btn,
[data-theme="stage"] .sw-bank-btn { color: #e8b860; }

/* ---- Phone ---- */
@media (max-width: 720px) {
  .sw-panel { padding: 12px 10px 16px; }
  .sw-ideas { grid-template-columns: 1fr; }
  .sw-list { max-height: 220px; }
  .sw-header h2 { font-size: 1.25rem; }
  .sw-tab, .sw-btn { padding: 10px 12px; }
  .sw-area { min-height: 140px; }
}

/* ---- Print lyric sheet ---- */
@media print {
  /* only while the lyric sheet is out (Nov 25: the old body * rule blanked
     Print This Key and the Song Builder sheet) */
  body:has(#sw-print:not([hidden])) * { visibility: hidden; }
  .sw-print, .sw-print * { visibility: visible; }
  .sw-print {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    background: #fff;
    color: #1c1712;
    padding: 24px;
  }
}

.sw-print {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
}

.sw-print h1 { margin: 0 0 6px; font-size: 1.8rem; }
.sw-print .sw-print-meta { color: #5c4f40; margin: 0 0 16px; font-size: 0.95rem; }
.sw-print .sw-print-lyrics { white-space: pre-wrap; font-size: 1.15rem; line-height: 1.6; }
.sw-print .sw-print-notes { margin-top: 18px; }
.sw-print .sw-print-foot { margin-top: 24px; font-size: 0.8rem; color: #5c4f40; }
