.kp-theory-page { min-width: 0; }
.kp-theory-page .theory-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 64px; }
.theory-eyebrow { margin: 16px 0 12px; color: #315ca5; font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.theory-shell h1 { margin: 0 0 18px; color: #102344; font-size: clamp(28px, 4.5vw, 44px); line-height: 1.4; }
.theory-lead { margin: 0 0 16px; font-size: clamp(17px, 2vw, 21px); font-weight: 700; line-height: 1.8; }
.theory-intro { max-width: 760px; line-height: 1.9; color: #52627d; }
.theory-breadcrumb { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; line-height: 1.7; }
.theory-breadcrumb a, .theory-related a, .theory-sources a { color: #2455b5; }
.theory-lesson-link { display: block; max-width: 820px; margin-top: 32px; padding: clamp(22px, 4vw, 36px); background: #fff; border: 1px solid #c7d7ed; border-radius: 16px; color: #102344; text-decoration: none; box-shadow: 0 12px 34px rgba(15, 35, 70, .06); }
.theory-lesson-link:hover { border-color: #315ca5; background: #fafdff; }
.theory-lesson-link h2 { margin: 12px 0; font-size: clamp(23px, 3vw, 30px); }
.theory-lesson-link p { line-height: 1.9; color: #52627d; }
.theory-lesson-link strong { display: block; margin-top: 24px; color: #2455b5; }
.theory-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.theory-chips > span { padding: 7px 12px; border-radius: 8px; background: #edf4ff; font-size: 13px; }
.theory-shell button { font: inherit; font-weight: 700; cursor: pointer; }
.theory-shell button:disabled { opacity: .5; cursor: default; }
.theory-shell [hidden] { display: none !important; }
.theory-shell :focus-visible { outline: 3px solid #315ca5; outline-offset: 4px; }
.theory-key-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; margin: 32px 0 20px; }
.theory-key-summary h2 { margin: 0; font-size: 29px; }
.theory-key-summary p { margin: 12px 0 0; font-size: 14px; color: #52627d; line-height: 1.8; }
.theory-shell ruby { ruby-align: center; }
.theory-shell rt { font-size: 10px; font-weight: 500; letter-spacing: .05em; }
.theory-separator { margin: 0 8px; }
.theory-scale { display: flex; flex-wrap: wrap; gap: 6px; }
.theory-scale span { min-width: 36px; padding: 8px 10px; background: #eaf1fc; border-radius: 8px; text-align: center; font-size: 14px; font-weight: 700; }
.theory-minor-note { padding: 16px 20px; border-left: 4px solid #8063c0; background: #f3efff; border-radius: 0 8px 8px 0; line-height: 1.9; font-size: 14px; }
.theory-chord-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 26px 0; }
.theory-chord-card { min-width: 0; display: flex; flex-direction: column; padding: 24px; background: #fff; border: 1px solid #d1dfed; border-top: 4px solid #3576d8; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 35, 70, .05); transition: box-shadow .15s; }
#chord-iv { border-top-color: #1a957b; }
#chord-v { border-top-color: #9b66bf; }
.theory-chord-card.is-playing { box-shadow: 0 0 0 3px #79a9ee; }
.theory-chord-top { display: flex; align-items: center; justify-content: space-between; color: #52627d; font-size: 13px; }
.theory-degree { font-size: 30px; color: #244d91; font-weight: 800; }
.theory-chord-card h3 { margin: 24px 0 8px; font-size: 25px; }
.theory-chord-symbol { margin: 8px 0; font-size: 25px; color: #102344; font-weight: 800; }
.theory-chord-symbol span { display: inline-block; margin-left: 8px; color: #52627d; font-size: 13px; font-weight: 500; }
.theory-score { display: flex; align-items: center; justify-content: center; min-height: 135px; margin: 8px 0; }
.theory-score img { display: block; width: 100%; height: 135px; object-fit: contain; }
.theory-note-names { margin: 6px 0; font-weight: 800; font-size: clamp(18px, 2vw, 23px); text-align: center; }
.theory-letter-names { margin: 4px 0 20px; font-size: 13px; color: #52627d; text-align: center; }
.theory-keyboard { display: block; width: 100%; max-width: 360px; margin: 0 auto; }
.theory-role-hint { margin: 16px 0 24px; line-height: 1.9; font-size: 14px; color: #52627d; flex: 1; }
.theory-play { display: block; width: 100%; min-height: 46px; padding: 12px; background: #eff5ff; color: #244d91; border: 1px solid #bdcfe8; border-radius: 8px; }
.theory-play:hover { background: #dfeaff; }
.theory-listen { padding: 26px; border: 1px solid #d1dfed; background: #fff; border-radius: 12px; }
.theory-listen h2 { margin: 0 0 10px; font-size: clamp(21px, 3vw, 27px); }
.theory-listen p { line-height: 1.9; }
.theory-listen-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.theory-stop { min-height: 46px; padding: 10px 20px; border: 1px solid #a8b8ce; border-radius: 8px; background: #fff; color: #102344; }
#theory-audio-status { margin: 18px 0 0; min-height: 1.9em; font-size: 14px; color: #52627d; }
.theory-explanation { margin: 26px 0; padding: 20px 24px; border: 1px solid #d1dfed; border-radius: 12px; background: #fff; }
.theory-explanation summary { cursor: pointer; font-weight: 700; line-height: 1.8; }
.theory-explanation p { line-height: 1.9; color: #52627d; }
.theory-related { display: flex; flex-wrap: wrap; gap: 18px; margin: 28px 0; line-height: 1.8; }
.theory-sources { margin-top: 36px; color: #52627d; font-size: 12px; line-height: 1.9; }
.theory-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; }
@media (max-width: 800px) {
  .theory-chord-grid { grid-template-columns: 1fr; }
  .theory-chord-card { padding: 24px; }
  .theory-keyboard { max-width: 360px; }
  .theory-score img { width: min(100%, 330px); }
}
@media (max-width: 420px) {
  .theory-listen { padding: 18px; }
  .theory-chord-card { padding: 20px; }
  .theory-shell .kp-button { width: 100%; }
}
@media print {
  .theory-play, .theory-listen-actions, .theory-breadcrumb, .theory-related, #theory-audio-status { display: none !important; }
  .theory-chord-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theory-chord-card { break-inside: avoid; padding: 12px; box-shadow: none; }
  .theory-shell { width: 100% !important; padding: 0 !important; }
}

.theory-signature-picker { margin: 30px 0; padding: clamp(16px, 3vw, 26px); border: 1px solid #d1dfed; border-radius: 14px; background: #fff; }
.theory-signature-picker h2 { margin: 0 0 12px; font-size: clamp(21px, 3vw, 27px); }
.theory-picker-hint { margin: 0 0 20px; color: #52627d; line-height: 1.8; }
.theory-signature-group + .theory-signature-group { margin-top: 24px; }
.theory-signature-group h3 { margin: 0 0 12px; font-size: 16px; color: #304b72; }
.theory-signature-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.theory-signature-grid-none { grid-template-columns: minmax(0, 280px); }
.theory-signature-card { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 10px 8px; border: 2px solid #d8e2ef; border-radius: 10px; background: #fff; color: #102344; text-decoration: none; }
.theory-signature-card:hover { border-color: #6e95d0; background: #f7faff; }
.theory-signature-card img { display: block; width: 100%; height: 94px; object-fit: contain; }
.theory-signature-caption { font-size: 15px; font-weight: 800; }
.theory-signature-check { display: block; margin-top: 7px; font-size: 11px; color: #52627d; }
.theory-signature-grid-none .theory-signature-card { display: grid; grid-template-columns: 135px 1fr; column-gap: 10px; text-align: center; }
.theory-signature-grid-none img { grid-row: span 2; height: 70px; }
.theory-signature-grid-none .theory-signature-caption { align-self: end; }
.theory-signature-grid-none .theory-signature-check { align-self: start; justify-self: center; }
#signature-picker-title, #theory-key-result { scroll-margin-top: 120px; }
.theory-key-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theory-mode-link { display: flex; flex-direction: column; min-width: 0; gap: 12px; padding: 20px; background: #fff; border: 2px solid #cedbec; border-radius: 10px; color: #102344; text-decoration: none; }
.theory-mode-link:hover { border-color: #6e95d0; }
.theory-mode-link.is-selected { border-color: #315fcc; }
.theory-mode-link strong { font-size: clamp(23px, 3vw, 29px); margin-top: 10px; }
.theory-mode-english { color: #52627d; font-size: 13px; }
.theory-mode-action { color: #2455b5; font-weight: 700; font-size: 13px; }
.theory-pick-again { display: inline-block; margin-top: 20px; color: #2455b5; line-height: 1.8; }
@media (max-width: 1000px) {
  .theory-signature-grid:not(.theory-signature-grid-none) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .theory-signature-grid:not(.theory-signature-grid-none) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .theory-signature-card { padding: 8px 4px; }
  .theory-signature-card img { height: 80px; }
  .theory-signature-caption { font-size: 14px; }
  .theory-key-pair { grid-template-columns: 1fr; }
  .theory-mode-link { gap: 9px; padding: 18px; }
}
@media print {
  .theory-signature-picker { display: none !important; }
}

.theory-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 780px; padding: 0; margin: 28px 0; list-style: none; }
.theory-steps li > a, .theory-steps li > span { display: flex; gap: 10px; align-items: center; padding: 14px 12px; border-radius: 10px; border: 1px solid #d6e1ef; background: #f0f3f8; color: #66758b; font-size: 14px; font-weight: 700; text-decoration: none; }
.theory-steps b { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: #fff; }
.theory-steps .is-current > span { background: #2457c5; color: #fff; border-color: #2457c5; }
.theory-steps .is-current b { color: #2457c5; }
.theory-steps .is-complete a { color: #2455b5; background: #eaf1ff; }
.theory-mode-question { max-width: 850px; margin: 28px 0; padding: clamp(20px, 4vw, 36px); border: 1px solid #d1dfed; border-radius: 14px; background: #fff; }
.theory-mode-question h2 { margin: 0 0 24px; font-size: clamp(24px, 4vw, 32px); line-height: 1.6; }
.theory-mode-question > p { color: #52627d; line-height: 1.9; margin: 20px 0 28px; }
.theory-selected-signature { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; padding: 16px; background: #f5f8fd; border-radius: 10px; }
.theory-selected-signature img { width: 210px; max-width: 100%; height: 160px; object-fit: contain; }
.theory-selected-signature span { display: block; color: #52627d; font-size: 13px; margin-bottom: 12px; }
.theory-selected-signature strong { font-size: 22px; }
.theory-answer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px; margin: 32px 0 18px; padding: clamp(22px, 4vw, 36px); background: #edf5ff; border: 1px solid #b9cfe9; border-radius: 14px; }
.theory-answer h2 { margin: 24px 0 12px; color: #143c85; font-size: clamp(36px, 6vw, 50px); line-height: 1.5; }
.theory-answer h2 rt { font-size: 13px; }
.theory-answer-english { margin: 0; color: #52627d; font-size: 18px; }
.theory-answer-signature { text-align: center; }
.theory-answer-signature img { display: block; width: 168px; height: 128px; object-fit: contain; }
.theory-answer-signature p { margin: 8px 0 0; color: #52627d; font-size: 14px; }
.theory-wizard-back { display: flex; flex-wrap: wrap; gap: 14px 24px; margin: 20px 0 34px; font-size: 14px; line-height: 1.8; }
.theory-wizard-back a { color: #2455b5; }
@media (max-width: 600px) {
  .theory-steps { gap: 6px; }
  .theory-steps li > a, .theory-steps li > span { flex-direction: column; gap: 8px; padding: 12px 5px; text-align: center; font-size: 12px; }
  .theory-selected-signature { flex-direction: column; gap: 8px; text-align: center; }
  .theory-selected-signature strong { display: block; }
  .theory-selected-signature span { margin: 0 0 6px; }
  .theory-answer { gap: 12px; }
  .theory-answer-signature img { width: 135px; height: 103px; }
}
@media print {
  .theory-steps, .theory-wizard-back { display: none; }
}
