@font-face{font-family:IHAccidentals;src:url('/persian-accidentals.ttf') format('truetype');unicode-range:U+1D1E9-1D1EA;font-display:swap}
:root{
 color-scheme:light;
 --ink:#463b37;--muted:#7c655c;--terra:#ca6948;--terra-dark:#a95134;
 --cream:#fff8ef;--paper:#fffdf8;--line:#eddbca;--soft:#ffedda;
 --teal:#2b8177;--teal-light:#e4f4ec;--gold:#efbb64;--shadow:0 13px 35px rgba(111,72,44,.075);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--cream);color:var(--ink);font:15px/1.66 IHAccidentals,Tahoma,"Segoe UI",system-ui,sans-serif}
button,input,select{font:inherit}
button{cursor:pointer}
a{color:#aa5836}
button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible{outline:3px solid #43958c;outline-offset:3px}
[hidden]{display:none!important}
.skip{position:absolute;right:13px;top:-100px;background:white;padding:10px;z-index:100}
.skip:focus{top:10px}
.site-header{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px;background:#fffdf9;border-bottom:1px solid #f0dfcf;padding:13px max(18px,calc((100vw - 1200px)/2))}
.brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:var(--ink)}
.brand-symbol{display:grid;place-items:center;background:#ffdfa7;width:47px;height:47px;border-radius:14px;color:#c16d3d;font-size:30px}
.brand strong{display:block;font-size:20px;line-height:1.15}
.brand small{display:block;color:#aa8770;font-size:11px;letter-spacing:.2px}
.main-nav{display:flex;align-items:center;flex-wrap:wrap;gap:4px}
.main-nav a{padding:9px 11px;border-radius:10px;text-decoration:none;font-size:13px;font-weight:800;color:#785e53}
.main-nav a.current{background:#ffead3;color:#b05635}
.main-nav a:hover{background:#fff1e1}
.lang-control{display:flex;direction:ltr;gap:4px;background:#fff3e6;border:1px solid #eedac4;border-radius:11px;padding:3px}
.lang-control button{font-size:11px;font-weight:850;border:0;padding:7px 9px;color:#96735d;background:transparent;border-radius:8px}
.lang-control button[aria-pressed=true]{background:#dfaa77;color:#53372a}
main{max-width:1200px;margin:0 auto;padding:28px 18px 60px}
.hero{border:1px solid #f0d7c0;border-radius:23px;padding:32px 36px;background:radial-gradient(circle at 91% 15%,#ffd49e88,transparent 33%),radial-gradient(circle at 8% 95%,#ecdcc174,transparent 42%),#ffeed8;display:flex;align-items:center;justify-content:space-between;gap:20px}
.hero-kicker{display:inline-block;color:#ad643f;font-weight:850;font-size:11px;letter-spacing:.7px}
.hero h1{font-size:clamp(30px,3.6vw,45px);line-height:1.33;letter-spacing:-.5px;margin:8px 0}
.hero p{max-width:690px;color:#80665a;font-size:15px;margin:0}
.hero-icon{font-size:105px;line-height:1;color:#d38458;opacity:.8;transform:rotate(-13deg);user-select:none}
.page-actions{display:flex;justify-content:flex-end;gap:10px;align-items:center;flex-wrap:wrap;margin:15px 0}
.page-actions a{font-size:12px;text-decoration:none;font-weight:800}
.page-actions a:after{content:"↗";margin-inline-start:5px}
.card{border:1px solid var(--line);background:var(--paper);border-radius:19px;box-shadow:var(--shadow);padding:25px;margin-top:21px}
.card h2{font-size:24px;margin:0 0 4px;line-height:1.4}
.card h3{font-size:18px;line-height:1.4;margin:0 0 8px}
.section-lead{font-size:13px;color:var(--muted);margin:3px 0 17px}
.eyebrow{font-size:11px;letter-spacing:.8px;font-weight:800;color:#bb7e56}
.control-grid{display:grid;grid-template-columns:minmax(215px,1.4fr) repeat(3,minmax(155px,1fr));gap:14px;align-items:end}
.control-grid label,.field-label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:900;color:#6f5045}
.control-grid select,.control-grid input,.compact-select{background:#fff;color:#574339;border:1px solid #e1cbb7;border-radius:11px;min-height:44px;width:100%;padding:7px 11px}
.tooltips{margin-top:15px;display:flex;align-items:center;flex-wrap:wrap;gap:9px}
.model-info{background:#f7eee4;padding:9px 13px;border-radius:11px;color:#886b58;font-size:12px;flex:1}
.model-info strong{color:#665244}
.model-info a{font-weight:850}
.variant{border:1px solid #dfd4a7;background:#fff8d8;border-radius:11px;padding:8px 12px;color:#74582e;font-size:12px;font-weight:800;cursor:pointer;display:flex;align-items:center;gap:9px}
.variant input{accent-color:#b76b35}
.sound-info{font-size:11px;color:#887465;line-height:1.5;margin-top:12px}
.status{font-size:12px;color:#26796e;font-weight:850;min-height:21px;margin:10px 0 0}
.play-row{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-top:17px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:11px;min-height:43px;padding:9px 16px;font-weight:850;font-size:13px;border:1px solid #e5c7af}
.btn.primary{background:var(--terra);color:white;border-color:#ae5b41}
.btn.primary:hover{background:#b9583c}
.btn.secondary{background:#fff1df;color:#ad6245}
.btn.secondary:hover{background:#ffe4d0}
.btn.neutral{background:white;color:#8d7368;border-color:#e6dbd2}
.btn.neutral:hover{background:#f9eee6}
.btn:disabled{opacity:.48;cursor:not-allowed}
.play-row .push{margin-inline-start:auto}
.degree-grid{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:9px}
.degree-btn{--color:#f0d3bc;background:var(--color);border:1px solid #ffffffb5;border-bottom:5px solid #6e473118;min-width:0;min-height:97px;border-radius:13px;padding:9px 6px;color:#493a36;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-weight:850;transition:transform .13s,box-shadow .13s}
.degree-btn strong{font-size:11px;color:#735c51}
.degree-btn span{font-size:14px;white-space:normal;word-break:break-word;line-height:1.45}
.degree-btn small{font-size:10px;color:#74665d}
.degree-btn:hover{transform:translateY(-3px);box-shadow:0 5px 13px #58402b1c}
.degree-btn:active{transform:translateY(2px)}
.degree-btn.active{outline:3px solid #b66d40;outline-offset:1px}
.degree-btn.suggested{box-shadow:0 0 0 3px #c6e6b5}
.piano-stage{margin:24px 0 15px;background:#f9f0e6;border:1px solid #efdfd0;border-radius:17px;padding:17px 15px}
.piano-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:8px}
.piano-top strong{font-size:13px;color:#765444}
.piano-top span{font-size:11px;color:#9a8270}
.piano-board{width:100%;position:relative;padding-top:46px;min-width:0;direction:ltr}
.piano-keys{height:125px;display:flex;position:relative;border:2px solid #9d8476;background:#fff;border-radius:0 0 7px 7px;overflow:hidden}
.white-key{width:calc(100% / 14);height:100%;background:linear-gradient(#fff,#fbf4eb);border-inline-end:1px solid #bdb2a7;position:relative}
.white-key:last-child{border:0}
.white-key span{position:absolute;bottom:5px;left:0;right:0;font-size:9px;color:#aa9581;text-align:center;direction:ltr}
.black-key{position:absolute;top:0;width:4.1%;height:65%;transform:translateX(-50%);background:linear-gradient(90deg,#42352f,#2c2624 70%);z-index:1;border-radius:0 0 5px 5px;box-shadow:2px 3px 5px #0004}
.pitch-pin{--color:#e7bd98;position:absolute;top:0;transform:translateX(-50%);border:2px solid white;background:var(--color);border-radius:50%;width:24px;height:24px;display:grid;place-items:center;font-size:10px;color:#4c3831;font-weight:900;z-index:3;box-shadow:0 2px 4px #0002}
.pitch-pin:after{content:"";position:absolute;top:22px;height:21px;width:2px;background:#ac846a}
.pitch-pin.selected{outline:3px solid #b36342}
.piano-detail{margin-top:9px;color:#846858;font-size:12px}
.steps-strip{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-top:17px}
.step-chip{padding:7px 11px;border-radius:13px;background:#ffebd2;border:1px solid #f0d2ae;color:#7a523a;font-size:12px;font-weight:800;white-space:nowrap}
.micro-tag{background:#ede3f5;color:#775d93;border:1px solid #e1ccea}
.micro-note{display:inline-block;background:#f3e4f1;padding:3px 8px;border-radius:10px;font-weight:850;color:#825c82}
.more{margin-top:15px;border-radius:13px;border:1px solid #efdfcf;background:#fffcf6;padding:11px 15px}
.more summary{cursor:pointer;color:#916b4c;font-size:13px;font-weight:850}
.more p,.more li{font-size:12px;color:#786b5f}
.table-scroll{overflow:auto;max-width:100%;margin-top:12px}
table{width:100%;border-collapse:collapse;min-width:540px;font-variant-numeric:tabular-nums}
th,td{padding:9px 8px;border-bottom:1px solid #eee0d2;text-align:start;font-size:12px}
th{color:#826655;background:#fff4e5}
.source-note{font-size:12px;color:#826b5e;line-height:1.8}
.source-note a{font-weight:800}
.progress-strip{display:flex;align-items:center;flex-wrap:wrap;gap:7px;background:#fff2e4;min-height:70px;padding:14px;border:1px dashed #dfb89c;border-radius:14px;margin:17px 0}
.phrase-chip{--color:#f3d6c4;display:flex;align-items:center;gap:7px;padding:9px 11px;font-weight:850;font-size:12px;border:1px solid #ffffffaa;border-radius:11px;background:var(--color);color:#61493a}
.phrase-chip small{opacity:.65}
.empty-text{font-size:13px;color:#9c7966}
.idea-card{background:#f7f2ec;border:1px solid #ebded3;border-radius:14px;padding:13px}
.idea-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin:14px 0}
.idea-card strong{display:block;color:#63544e;font-size:13px}
.idea-card p{font-size:12px;color:#876e60;line-height:1.6;min-height:40px}
.idea-card .btn{width:100%;padding:7px}
.harmony-recipes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px}
.recipe-card{border:1px solid #eddacb;border-radius:14px;background:#fffbf5;padding:17px;display:flex;flex-direction:column;gap:11px}
.recipe-card h3{font-size:17px;margin:0}
.recipe-card p{font-size:12px;color:#816d61;margin:0;flex:1}
.recipe-card .notes{font-size:11px;color:#855c48;font-weight:850}
.mini-chooser{display:flex;flex-wrap:wrap;gap:9px;margin:12px 0}
.mini-btn{border-radius:10px;background:#fff1df;border:1px solid #e9d3bf;color:#765447;padding:8px 12px;font-size:12px;font-weight:800}
.mini-btn[aria-pressed=true]{background:#2e8174;color:white;border-color:#257568}
.split-panel{display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start}
.next-link{display:block;margin-top:15px;padding:14px 17px;background:#e3f2e8;border:1px solid #c9e2d1;border-radius:13px;text-decoration:none;font-weight:850;color:#226a5a;font-size:13px}
.next-link:hover{background:#d1e9d8}
.tiny{font-size:11px;color:#997969;line-height:1.8}
footer{display:flex;align-items:center;justify-content:space-between;gap:11px;flex-wrap:wrap;border-top:1px solid #f0decd;margin-top:42px;padding:20px 2px;color:#a18472;font-size:11px}
@media(max-width:1020px){
 .site-header{gap:12px}
 .control-grid{grid-template-columns:1fr 1fr}
 .control-grid label:last-child{grid-column:auto}
 .degree-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 .idea-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .harmony-recipes{grid-template-columns:1fr 1fr}
}
@media(max-width:680px){
 .site-header{padding:12px}
 .main-nav{order:2;width:100%;justify-content:space-around}
 .main-nav a{font-size:12px;padding:5px}
 .brand strong{font-size:18px}
 main{padding:14px 10px 35px}
 .hero{padding:23px;display:block}
 .hero h1{font-size:29px}
 .hero p{font-size:13px}
 .hero-icon{display:none}
 .card{padding:17px 12px;margin-top:13px}
 .control-grid{grid-template-columns:1fr}
 .control-grid label:last-child{grid-column:auto}
 .degree-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
 .degree-btn{min-height:84px}
 .degree-btn span{font-size:11px}
 .degree-btn small{font-size:9px}
 .piano-stage{padding:11px 8px}
 .piano-board{padding-top:40px}
 .piano-keys{height:94px}
 .pitch-pin{width:20px;height:20px;font-size:9px}
 .pitch-pin:after{top:17px;height:22px}
 .white-key span{font-size:8px}
 .idea-grid,.harmony-recipes,.split-panel{grid-template-columns:1fr}
 .idea-card p{min-height:0}
}

/* Advanced interval editor stays closed until explicitly requested. */
.tune-editor{margin-top:14px;background:#fffbf4}
.edit-row{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:12px}
.edit-row input{min-height:43px;flex:1 1 270px;min-width:0;border:1px solid #e4cdb8;border-radius:10px;background:#fff;padding:8px 12px;color:#61493e;direction:ltr;text-align:left}
.edit-row button{white-space:nowrap}
@media(max-width:560px){.edit-row button{width:100%}.degree-btn small{line-height:1.3;overflow-wrap:anywhere}}

/* Shahed is a focus marker, not a tuning alteration. */
.shahed-hint{margin:11px 0 0;color:#765d49;font-size:12px;line-height:1.7;background:#fff4e3;border-inline-start:3px solid #daa668;border-radius:7px;padding:8px 11px}
.degree-btn.shahed{box-shadow:inset 0 0 0 2px #ce965b;position:relative}
.degree-btn .shahed-symbol{color:#89522f;font-size:10px;font-weight:900;line-height:1.15}
.pitch-pin.shahed{border-color:#c67b40;box-shadow:0 1px 4px #0003,0 0 0 3px #f8d19ab8}

/* Workshop 2: simple event-level rhythm without changing modal pitch distances. */
.melody-shahed{
 border:1px solid #e2d1a7;background:#fff8de;color:#815c3c;
 border-radius:13px;padding:11px 14px;font-size:13px;font-weight:750;margin:11px 0 15px;
}
.rhythm-controls{
 margin:14px 0 19px;padding:15px 17px;border-radius:16px;
 background:#f3f4ea;border:1px solid #dfe5d5;
}
.rhythm-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:6px}
.rhythm-head strong{font-size:14px;color:#5e7154}
.rhythm-head span{font-size:12px;color:#7d8c72}
.rhythm-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:11px}
.rhythm-option{
 min-height:45px;min-width:102px;flex:1 1 auto;padding:8px 13px;
 border-radius:12px;border:1px solid #cbdabb;background:#fffbf3;color:#5c694c;
 font-weight:850;font-size:13px;
}
.rhythm-option.active,.rhythm-option[aria-pressed=true]{
 background:#4b8375;color:#fff;border-color:#377268;
 box-shadow:0 3px 0 #31645c;
}
.rhythm-option.rest-option{background:#f7e5df;color:#a85b48;border-color:#ecc3b7}
.rhythm-option.rest-option:hover{background:#f4d7cb}
.phrase-chip.phrase-rest{
 border:1px dashed #bdb2a3;background:#e9e2d8!important;color:#6f655d;
}
.event-length{
 border:1px solid #cca989;background:#fffcf6;
 border-radius:9px;min-width:36px;min-height:36px;
 padding:6px 7px;margin-inline-start:2px;
 color:#7f543f;font-size:12px;font-weight:950;
}
.event-length:hover{background:#e9f5db;border-color:#96ad81}
.event-length:focus-visible{outline:3px solid #2b8177}
.fifth-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.fifth-card{
 border:1px solid #e5cdb2;background:linear-gradient(130deg,#fff5e5,#fffdf9);
 border-radius:17px;padding:20px 18px;box-shadow:0 4px 16px #aa754412;
 display:flex;flex-direction:column;gap:9px;
}
.fifth-card:nth-child(2){background:linear-gradient(130deg,#ecf3ef,#fffdf9);border-color:#c9ded2}
.fifth-card h3{margin:0;font-size:19px}
.fifth-card .fifth-name{font-weight:900;color:#6e5045;font-size:17px;margin:0}
.fifth-card .fifth-distance{
 font-size:12px;color:#7d695e;line-height:1.7;
 margin:0;padding:8px 10px;background:#ffffffb9;border-radius:10px;
}
.fifth-card .tiny{margin:0;font-size:11px}
.fifth-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto;padding-top:6px}
.fifth-actions .btn{flex:1 1 140px}
@media(max-width:680px){
 .fifth-grid{grid-template-columns:1fr}
 .rhythm-controls{padding:13px 11px}
 .rhythm-option{min-width:85px;font-size:12px}
 .fifth-card{padding:16px}
 .event-length{min-height:40px;min-width:40px}
}

/* Two discreet musical prompts; neither locks or transposes any degree. */
.melody-guide{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:13px 0 20px}
.guide-cell{min-height:150px;border:1px solid #e6d6c1;border-radius:16px;padding:17px;background:#fff8ec}
.guide-cell:first-child{background:#e9f4ec;border-color:#c9e3d2}
.guide-cell .eyebrow{display:block;margin-bottom:5px;color:#86634f}
.guide-cell strong{font-size:22px;color:#684635}
.guide-cell p{color:#775f55;font-size:12px;margin:7px 0 0;line-height:1.85}
.guide-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:13px}
.guide-actions .btn{font-size:12px;flex:1 1 125px}
@media(max-width:680px){.melody-guide{grid-template-columns:1fr}.guide-cell{min-height:auto;padding:14px}.guide-actions .btn{min-height:45px}}

/* Melody v4: playable acoustic-piano layout. All piano geometry remains LTR
   even when Persian is the document language. Gray keys are genuinely disabled. */
body[data-page="melody"] .control-grid{
 grid-template-columns:minmax(230px,1.4fr) minmax(165px,1fr) minmax(175px,1fr);
}
body[data-page="melody"] .melody-guide{margin:17px 0 12px}
.melody-keyboard-panel{margin:19px 0 15px;background:#fff5e5;border-color:#eacfae;padding:18px}
.melody-keyboard-panel .piano-top strong{font-size:18px;color:#684e3d}
.melody-keyboard-scroll{
 max-width:100%;overflow-x:auto;overflow-y:hidden;direction:ltr;
 padding:5px 1px 12px;-webkit-overflow-scrolling:touch;
 scrollbar-color:#c9a48c #f6e9d7;
}
.melody-keyboard-scroll:focus-visible{outline:3px solid #2b8177;outline-offset:2px}
.melody-keyboard{
 width:100%;min-width:755px;padding:4px 2px 0;direction:ltr;
}
.melody-physical-keys{
 height:183px;width:100%;display:flex;position:relative;
 background:#ecebe8;border:2px solid #988375;
 border-radius:8px 8px 12px 12px;
 box-shadow:0 7px 0 #d7c2b3,0 11px 13px #956d4b28;
 overflow:hidden;
}
.melody-key{
 appearance:none;-webkit-appearance:none;
 font-family:IHAccidentals,system-ui,"Segoe UI",sans-serif;
 border-radius:0;position:relative;cursor:pointer;
 user-select:none;-webkit-user-select:none;
 touch-action:manipulation;display:flex;flex-direction:column;
 justify-content:flex-end;align-items:center;gap:4px;
 text-align:center;transition:background .12s,transform .1s;
}
.melody-key:focus-visible,.micro-key-note:focus-visible{
 outline:3px solid #257f78;outline-offset:-3px;
 z-index:8;
}
.melody-key:disabled{cursor:not-allowed}
.melody-key .key-latin{font-weight:900;direction:ltr;line-height:1.1;white-space:nowrap}
.melody-key .key-persian{
 direction:rtl;unicode-bidi:plaintext;font-weight:850;
 font-family:IHAccidentals,Tahoma,"Segoe UI",system-ui,sans-serif;line-height:1.25;
}
.melody-key .key-dot{
 flex:0 0 auto;border-radius:50%;background:var(--note-color,#d3a876);
 box-shadow:0 0 0 3px #ffffffcf;
}
.melody-key .key-star{font-size:14px;font-weight:900;color:#af6b30}
.melody-key.key-white{
 width:calc(100% / 14);height:100%;flex:0 0 calc(100% / 14);
 padding:5px 1px 10px;border:0;border-inline-end:1px solid #b4aca4;
 background:linear-gradient(180deg,#f1f0ee 0%,#e1ded9 100%);color:#a09a95;
}
.melody-key.key-white:last-of-type{border-inline-end:0}
.melody-key.key-white.is-allowed{
 background:linear-gradient(180deg,#fffdfa 5%,var(--note-color,#ffe4b9) 100%);
 color:#503e33;border-bottom:7px solid #ffffff;
}
.melody-key.key-white.is-allowed:hover{filter:saturate(1.15) brightness(.97)}
.melody-key.key-white .key-latin{font-size:12px}
.melody-key.key-white .key-persian{font-size:10px}
.melody-key.key-white .key-dot{height:12px;width:12px;margin-bottom:auto;margin-top:12px}
.melody-key.key-black{
 position:absolute;top:0;left:0;
 transform:translateX(-50%);height:60%;width:4.7%;
 padding:6px 1px 10px;border:1px solid #585350;
 border-radius:0 0 7px 7px;z-index:2;
 box-shadow:3px 4px 7px #18161455;
 background:linear-gradient(90deg,#625e5b,#514d4b 55%,#4a4746);
 color:#bdb8b3;
}
.melody-key.key-black.is-allowed{
 background:linear-gradient(180deg,#57514e 0%,var(--note-color,#9ed3be) 95%);
 color:#252f2b;border-color:#a8a29a;
}
.melody-key.key-black.is-allowed:hover{filter:brightness(1.12)}
.melody-key.key-black .key-latin{font-size:10px}
.melody-key.key-black .key-persian{font-size:9px}
.melody-key.key-black .key-dot{height:9px;width:9px;margin-bottom:auto;margin-top:7px}
.melody-key.key-black .key-star{font-size:11px}
.micro-key-note{
 --note-color:#c7dbe5;
 appearance:none;border:2px solid #fff9f1;border-radius:12px;
 position:absolute;bottom:24px;left:0;transform:translateX(-50%);
 z-index:5;min-width:59px;max-width:82px;min-height:56px;
 padding:7px 5px 6px;display:flex;flex-direction:column;align-items:center;justify-content:center;
 background:var(--note-color);color:#433932;line-height:1.2;
 cursor:pointer;box-shadow:0 4px 11px #3a2b2540;
 white-space:normal;text-align:center;touch-action:manipulation;
}
.micro-key-note[data-lane="1"]{bottom:91px}
.micro-key-note .micro-fa{font-size:11px;font-family:IHAccidentals,Tahoma,"Segoe UI",system-ui,sans-serif;direction:rtl;font-weight:900}
.micro-key-note .micro-latin{font-size:10px;font-weight:800;direction:ltr}
.micro-key-note .micro-star{font-size:13px;color:#7a4d29;font-weight:900}
.micro-key-note:after{content:"";position:absolute;height:12px;width:3px;bottom:-12px;background:#937c6a;border-radius:3px}
.micro-key-note:hover{filter:brightness(1.07);box-shadow:0 5px 13px #3a2b2560}
.keyboard-legend{display:flex;align-items:center;flex-wrap:wrap;gap:11px;margin:12px 0 11px}
.legend-chip{display:inline-flex;gap:7px;align-items:center;font-size:11px;color:#776053;font-weight:750}
.legend-dot{display:inline-block;width:14px;height:14px;border:1px solid #9b8570;border-radius:5px}
.legend-dot.allowed{background:#b4d8c5}
.legend-dot.disabled{background:#ddd9d4}
.legend-dot.quarter{background:#edc49f;transform:rotate(-13deg);border-radius:50%}
.legend-star{font-style:normal;color:#aa793a;font-size:17px}
body[data-page="melody"] .piano-detail{direction:rtl;text-align:right;margin:13px 2px 3px}
body[data-page="melody"] .melody-keyboard-scroll .melody-keyboard .key-latin{unicode-bidi:plaintext}
@media(max-width:1020px){
 body[data-page="melody"] .control-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body[data-page="melody"] .control-grid label:last-child{grid-column:1/-1}
}
@media(max-width:680px){
 body[data-page="melody"] .control-grid{grid-template-columns:1fr}
 body[data-page="melody"] .control-grid label:last-child{grid-column:auto}
 .melody-keyboard-panel{padding:14px 8px}
 .melody-keyboard-panel .piano-top strong{font-size:15px}
 .melody-keyboard{min-width:755px;padding-top:4px}
 .melody-physical-keys{height:183px}
 .keyboard-legend{gap:8px}
 .legend-chip{font-size:10px}
}

/* v8: Sound and Harmony have exactly three top controls; no editable Shahed. */
body[data-page="theory"] .control-grid,body[data-page="harmony"] .control-grid{
  grid-template-columns:minmax(230px,1.5fr) repeat(2,minmax(150px,1fr))
}
.sound-piano-details{margin-top:17px;padding:13px 15px}
.sound-piano-details summary{font-size:13px;font-weight:850}
.sound-reference-piano{
 padding:10px 8px;box-shadow:none;background:#f9efe4;overflow-x:auto;
}
.sound-reference-piano .piano-board{
 padding:0;min-width:720px;width:100%;position:relative;direction:ltr
}
.sound-reference-piano .piano-detail{
 margin-top:12px;line-height:1.8;font-size:11px;
 overflow-wrap:anywhere;
}
.sound-keyboard-row{
 height:133px;display:flex;direction:ltr;position:relative;
 background:#efeeec;border:2px solid #a18b78;
 border-radius:6px 6px 9px 9px;overflow:hidden;
}
.sound-key{
 display:flex;flex-direction:column;align-items:center;
 justify-content:flex-end;text-align:center;gap:3px;
 box-sizing:border-box;position:relative;
 font-weight:800;user-select:none;padding:7px 1px;
}
.sound-key.sound-white{
 background:linear-gradient(#f0eeea,#ddd9d3);
 width:calc(100% / 14);flex:0 0 calc(100% / 14);
 height:100%;border-inline-end:1px solid #b5aca3;
 color:#a4a09c;
}
.sound-key.sound-white.is-active{
 background:linear-gradient(#fffdf8,var(--tone,#f8d5ae));color:#514337;
}
.sound-key.sound-black{
 background:linear-gradient(90deg,#6d6965,#403d3c);
 position:absolute;top:0;height:66%;width:4.6%;
 transform:translateX(-50%);z-index:2;
 border-radius:0 0 6px 6px;
 box-shadow:2px 3px 4px #201b1850;color:#a9a29b;
}
.sound-key.sound-black.is-active{
 background:linear-gradient(#665e56,var(--tone,#bddace));
 color:#292d2a
}
.sound-key-latin{font-size:10px;direction:ltr}
.sound-key-persian{font-family:IHAccidentals,Tahoma,"Segoe UI",system-ui,sans-serif;font-size:10px;direction:rtl;line-height:1.3}
.sound-key.sound-black .sound-key-persian{font-size:9px}
.sound-key-accidental{
 font-size:20px;line-height:1.05;
 font-family:IHAccidentals,"Noto Sans Symbols 2","Segoe UI Symbol",system-ui,sans-serif;
 color:#85532d;
 margin-bottom:auto;margin-top:7px;
}
.sound-key-accidental-label{font-size:9px;color:#79563b}
.sound-key.sound-black .sound-key-accidental{font-size:15px;margin-top:4px}
.harmony-one-line{
 background:#f1f4e9;border-inline-start:3px solid #74a88e;
 border-radius:9px;color:#456754!important;padding:11px 13px;margin-top:10px!important
}
body[data-page="harmony"] .fifth-grid{
 grid-template-columns:repeat(3,minmax(0,1fr))
}
body[data-page="harmony"] .fifth-card{
 min-width:0;overflow-wrap:anywhere;padding:17px 14px
}
body[data-page="harmony"] .fifth-card h3{font-size:16px}
body[data-page="harmony"] .fifth-card .fifth-name{font-size:13px}
body[data-page="harmony"] .fifth-actions .btn{padding-inline:9px;font-size:12px;min-width:0}
body[data-page="harmony"] .fifth-card.octave-card{
 background:linear-gradient(130deg,#f4e8f4,#fffdf9);
 border-color:#e0c9e5
}
@media(max-width:980px){
 body[data-page="harmony"] .fifth-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:680px){
 body[data-page="theory"] .control-grid,
 body[data-page="harmony"] .control-grid{
  grid-template-columns:minmax(0,1fr);
 }
 body[data-page="theory"] .control-grid label:last-child,
 body[data-page="harmony"] .control-grid label:last-child{grid-column:auto}
 body[data-page="harmony"] .fifth-grid{grid-template-columns:minmax(0,1fr)}
 .sound-reference-piano .piano-board{min-width:670px}
}

.sound-key.is-selected{
 box-shadow:inset 0 -5px 0 #2f887a,0 0 0 2px #2f887a;
 z-index:3;
}
.sound-key.sound-black.is-selected{box-shadow:inset 0 -4px 0 #2f887a,0 0 0 2px #f3e3ca}

/* Language-sensitive notes: Latin solfege/C–G stays left-to-right while
   the Persian word کُرُن/سُری retains its natural joined Arabic shaping. */
.degree-btn span,.sound-key-latin,.sound-key-accidental-label,
.fifth-name,.fifth-distance,.pitch-pin,.mini-btn{
 unicode-bidi:plaintext;
}
.sound-key-latin{direction:ltr}
.sound-key-accidental-label{direction:rtl;unicode-bidi:isolate}
.degree-btn span{overflow-wrap:anywhere}
