.grammar-tabs{display:flex;gap:8px;flex-shrink:0}.grammar-tabs button{flex:1;background:#111;color:#fff;border:3px solid #fff;border-radius:8px;box-shadow:3px 3px 0 #ff69b4;padding:7px 10px;font-weight:900}.grammar-tabs button[aria-pressed=true]{background:#ffd700;color:#111}.grammar-catalog #btn-smash{display:block}.grammar-content{width:100%;height:100%;overflow-y:auto;padding:16px;display:flex;flex-direction:column;align-items:center;gap:12px}.grammar-toolbar{display:flex;align-items:center;justify-content:space-between;width:100%;gap:12px;flex-shrink:0}.grammar-topic{font-weight:900;background:#25f4ee;color:#111;border:3px solid #111;box-shadow:4px 4px 0 #ff69b4;padding:6px 10px;margin:8px 0}.grammar-content #grammar-step{margin:0;font-size:13px}.grammar-content h2{font-size:clamp(24px,5vw,38px);line-height:1.2;text-align:center;color:#111;background:#ffd700;padding:10px 14px;border:3px solid #111;box-shadow:5px 5px 0 #ff69b4;transform:rotate(-1deg);margin:auto 0 0;overflow-wrap:anywhere}.grammar-content>img{width:80px;height:80px;object-fit:contain}.grammar-buttons{display:flex;align-items:center;gap:12px;width:100%;justify-content:center}.grammar-buttons .help-button{position:static;transform:none;width:44px;height:44px;flex-shrink:0}.grammar-buttons #grammar-speak,#grammar-next{background:#25f4ee;border:3px solid #111;box-shadow:4px 4px 0 #ff69b4;border-radius:9px;padding:10px 12px;font-weight:900;color:#111;min-height:44px}#grammar-next{background:#ffd700;margin-bottom:0}.grammar-rule{font-size:12px;text-align:center;margin:0 0 auto;color:#ddd}#grammar-feedback{font-weight:800;text-align:center;font-size:14px;min-height:18px;margin:0}.grammar-dialog #grammar-choice-phrase{font-weight:900;font-size:22px;color:#fff}.grammar-dialog #grammar-choices{display:flex;flex-direction:column;gap:12px;margin-top:12px}.grammar-dialog #grammar-choices button{background:#ffd700;color:#111;border:3px solid #111;border-radius:8px;box-shadow:4px 4px 0 #ff69b4;padding:12px;font-size:16px;font-weight:900}.grammar-dialog #grammar-choices button:hover{background:#25f4ee}.grammar-dialog #grammar-choice-hint{font-size:14px}.camera-layout #grammar-screen .grammar-content{height:60%;gap:8px;padding:12px}.camera-layout #grammar-screen>.camera-panel{top:60%;bottom:0;z-index:0}.camera-layout #grammar-screen .grammar-content{position:relative;z-index:3}.camera-layout #grammar-screen h2{font-size:clamp(18px,3dvh,26px)}.camera-layout #grammar-screen .grammar-rule{margin-bottom:0}.camera-layout #grammar-screen .grammar-content>img{width:44px;height:44px}.grammar-dialog .close-button{position:sticky;float:right;top:0;z-index:5}@media(max-width:600px){.grammar-tabs button{font-size:13px;padding:6px}.grammar-dialog{padding:20px 16px}.grammar-dialog h2{font-size:21px;padding:6px 10px}.grammar-dialog #grammar-choice-phrase{font-size:20px}}

#grammar-screen{position:relative;overflow:hidden;background:#fff;color:#111}#grammar-screen.awaiting{background:#000;color:#fff}#grammar-screen .game-ui{z-index:3}#grammar-screen:not(.awaiting) .dice-area{position:absolute;top:18px;left:50%;transform:translateX(-50%);margin:0}#grammar-screen #grammar-reference{position:absolute;top:25%;left:50%;transform:translateX(-50%);width:100px;height:100px;object-fit:contain}#grammar-screen #grammar-phrase{font-size:clamp(24px,5vw,40px);line-height:1.2;color:#111;background:#ffd700;border:3px solid #111;box-shadow:4px 4px 0 #ff69b4;padding:8px 12px;border-radius:8px;text-shadow:none;margin:0 auto 16px;max-width:90%;overflow-wrap:anywhere}#grammar-screen .grammar-progress{text-align:center;background:#25f4ee;color:#111;border:3px solid #111;padding:4px 8px;font-size:13px;font-weight:900;width:max-content;max-width:100%;margin:0 auto 12px}#grammar-screen #grammar-feedback{position:absolute;top:43%;left:50%;transform:translateX(-50%);width:max-content;max-width:90%;color:#111;background:#ffd700}#grammar-screen #grammar-feedback:empty{display:none}.camera-layout #grammar-screen #grammar-phrase{position:absolute;top:60%;left:50%;transform:translate(-50%,-50%);font-size:clamp(18px,3dvh,27px);z-index:4}.camera-layout #grammar-screen .grammar-progress{position:absolute;top:40%;left:50%;transform:translateX(-50%)}.camera-layout #grammar-screen #grammar-reference{top:22%;width:60px;height:60px}@media(max-width:600px){#grammar-screen:not(.awaiting) .dice-button{width:98px;height:98px}#grammar-screen #grammar-phrase{font-size:25px}#grammar-screen #grammar-feedback{font-size:13px}.camera-layout #grammar-screen #grammar-phrase{font-size:20px}}

#grammar-screen #grammar-reference{width:min(52%,240px);height:clamp(100px,24dvh,240px);top:24%;filter:drop-shadow(4px 5px 0 #0001)}#grammar-screen #grammar-feedback[data-result=correct]{background:#ffd700;color:#111}#grammar-screen #grammar-feedback[data-result=wrong]{background:#ff4b57;color:#111;border:3px solid #111;box-shadow:4px 4px 0 #111}#grammar-vault-save[aria-pressed=true]{background:#ff69b4}.grammar-dialog{background:#111;border:4px solid #fff;box-shadow:7px 7px 0 #ff69b4;border-radius:16px;text-align:center;padding:22px;overflow-y:auto}.grammar-dialog h2{font-size:22px;line-height:1.2;margin:12px auto 18px;padding:9px 12px;background:#25f4ee;color:#111;text-shadow:none}.grammar-dialog #grammar-choice-phrase{font-size:clamp(19px,4vw,28px);font-weight:900;line-height:1.25;margin:16px 0}.grammar-dialog #grammar-choice-hint{font-size:13px;color:#eee}.grammar-dialog #grammar-choices{gap:13px;margin:18px 0}.grammar-dialog #grammar-choices .grammar-choice{display:flex;align-items:center;gap:12px;text-align:left;background:#fff;color:#111;padding:12px;border:3px solid #111;box-shadow:4px 4px 0 #ff69b4;font-size:16px;line-height:1.25;min-height:62px}.grammar-choice-letter{display:grid;place-items:center;background:#25f4ee;border:2px solid #111;width:32px;height:32px;flex-shrink:0;transform:rotate(-3deg);font-weight:900}.grammar-dialog #grammar-choices .grammar-choice:hover{background:#eee}.grammar-dialog #grammar-choices .grammar-choice[data-result=correct]{background:#ffd700;opacity:1}.grammar-dialog #grammar-choices .grammar-choice[data-result=wrong]{background:#ff4b57;opacity:1}#grammar-choice-feedback:not(:empty){font-weight:900;padding:10px;border:3px solid #111;box-shadow:3px 3px 0 #fff;color:#111}#grammar-choice-feedback[data-result=correct]{background:#ffd700}#grammar-choice-feedback[data-result=wrong]{background:#ff4b57}.saved-library-tabs{margin:12px 0}.grammar-smash-mode .word-order-options{display:none}@media(max-width:600px){.grammar-dialog{padding:16px}.grammar-dialog #grammar-choices .grammar-choice{font-size:14px;padding:9px;gap:9px;min-height:54px}#grammar-screen #grammar-reference{height:22dvh;max-width:55%}.camera-layout #grammar-screen #grammar-reference{top:22%;height:15dvh;width:30%}}

#grammar-screen .top-bar{position:relative;z-index:4;gap:12px;justify-content:flex-start}#grammar-screen #grammar-vault-save{flex-shrink:0;margin-right:auto}#grammar-screen #grammar-back{flex-shrink:0}

#grammar-screen #grammar-phrase{cursor:pointer;transition:background-color .2s,filter .15s}#grammar-screen #grammar-phrase:active{filter:brightness(.9)}#grammar-screen #grammar-phrase:focus-visible{outline:3px solid #111;outline-offset:5px}

#grammar-screen #grammar-phrase{align-items:center;justify-content:center;gap:10px}#grammar-screen #grammar-phrase:not([hidden]){display:flex}.grammar-phrase-audio{font-size:.55em;flex-shrink:0}.grammar-dialog{padding:32px 24px;box-shadow:8px 8px 0 var(--cyan);border-radius:20px}.grammar-dialog .subtitle{font-size:14px;margin:0 auto 16px;display:table}.grammar-dialog #grammar-listen{font-size:14px;min-height:40px;padding:8px 14px;margin:0 auto 12px}.grammar-dialog #grammar-choices{display:flex;flex-direction:column;gap:16px;margin:20px 0}.grammar-dialog #grammar-choices .grammar-choice{width:100%;display:grid;grid-template-columns:36px minmax(0,1fr);column-gap:14px;background:#222;color:#fff;border:2px solid #fff;border-radius:12px;padding:16px;font-weight:700;font-size:17px;min-height:68px;box-shadow:4px 4px 0 var(--cyan);white-space:normal;overflow-wrap:anywhere}.grammar-dialog #grammar-choices .grammar-choice:hover{background:#333}.grammar-dialog #grammar-choices .grammar-choice[data-result=correct]{background:#ffd700;color:#111;border-color:#111;opacity:1}.grammar-dialog #grammar-choices .grammar-choice[data-result=wrong]{background:#ff4b57;color:#111;border-color:#111;opacity:1}.grammar-dialog #grammar-choices .grammar-choice[hidden]{display:none}.grammar-dialog #grammar-choice-action{font-size:16px;min-height:44px;padding:10px 18px;margin-top:8px}.grammar-dialog #grammar-choice-action[hidden]{display:none}@media(max-width:600px){.grammar-dialog{padding:22px 16px}.grammar-dialog #grammar-choices .grammar-choice{font-size:15px;padding:12px;column-gap:12px;grid-template-columns:30px minmax(0,1fr);min-height:58px}.grammar-dialog h2{font-size:22px}.grammar-dialog .subtitle{font-size:12px}}

#grammar-screen #grammar-phrase{transition:translate .15s,rotate .15s,box-shadow .15s,background-color .2s,filter .15s}@media(hover:hover) and (pointer:fine){#grammar-screen #grammar-phrase:hover{translate:-2px -2px;rotate:-2deg;box-shadow:6px 6px 0 #111}#grammar-screen #grammar-phrase:active{translate:1px 1px;rotate:-2deg;box-shadow:2px 2px 0 #111}}

#grammar-reference-emoji{position:absolute;top:25%;left:50%;transform:translateX(-50%);font-size:clamp(70px,15dvh,140px);line-height:1}.camera-layout #grammar-reference-emoji{top:22%;font-size:10dvh}

/* Grammar owns its phrase layout; avoid vocabulary's clipped subtitle styles. */
#grammar-screen #grammar-phrase{height:auto;min-height:0;max-height:none;overflow:visible;white-space:normal;text-overflow:clip;word-break:normal;overflow-wrap:normal;line-height:1.2;width:fit-content;max-width:calc(100% - 12px);font-size:clamp(24px,4.5vw,36px);padding:10px 12px;gap:8px;flex-shrink:0}#grammar-phrase-text{display:block;min-width:0;white-space:normal;overflow:visible;overflow-wrap:break-word;word-break:normal;line-height:inherit}.grammar-phrase-audio{font-size:16px;line-height:1.2;align-self:center}#grammar-screen #grammar-reference{top:21%;width:min(76%,360px);max-width:76%;height:clamp(150px,38dvh,360px)}#grammar-screen #grammar-step.grammar-timed-status{position:static;transform:none;margin:0 0 0 auto;flex-shrink:0;width:auto;max-width:none;padding:8px 10px;font-size:18px;white-space:nowrap;background:#25f4ee;color:#111;border-radius:8px;box-shadow:3px 3px 0 #ff69b4}#grammar-screen .grammar-progress{font-size:12px}#grammar-screen #grammar-feedback{top:48%;z-index:5}
.camera-layout #grammar-screen #grammar-reference{top:17%;height:32dvh;width:65%;max-width:65%}.camera-layout #grammar-screen #grammar-phrase{top:60%;max-width:calc(100% - 40px);width:max-content;font-size:clamp(21px,3dvh,28px);overflow:visible;max-height:none}.camera-layout #grammar-screen .grammar-progress:not(.grammar-timed-status){top:49%;margin:0;width:max-content;max-width:90%;font-size:12px}
@media(max-width:600px){#grammar-screen .game-ui{padding:14px;gap:12px}#grammar-screen #grammar-phrase{font-size:clamp(23px,6.2vw,29px);padding:9px 10px;line-height:1.2;max-width:calc(100% - 8px);border-width:3px;box-shadow:3px 3px 0 #111}#grammar-screen #grammar-reference{width:78%;max-width:78%;height:38dvh;top:20%}#grammar-screen .top-bar{gap:10px}#grammar-screen #grammar-step.grammar-timed-status{font-size:16px;padding:7px 8px}.camera-layout #grammar-screen #grammar-phrase{font-size:clamp(22px,5.8vw,27px);max-width:calc(100% - 32px);padding:9px 10px;top:60%}.camera-layout #grammar-screen #grammar-reference{top:18%;width:68%;max-width:68%;height:29dvh}}

#grammar-screen #grammar-feedback{top:40%;left:50%;transform:translate(-50%,-50%);z-index:6;width:max-content;max-width:calc(100% - 36px);margin:0;text-align:center;line-height:1.3;overflow-wrap:break-word;font-size:16px;border:3px solid #111;box-shadow:4px 4px 0 #ff69b4;padding:10px 14px}.camera-layout #grammar-screen #grammar-feedback{top:32%}@media(max-width:600px){#grammar-screen #grammar-feedback{font-size:14px;padding:9px 12px;max-width:calc(100% - 32px)}}

.grammar-lesson-dialog{padding:28px 20px;overflow:auto}.grammar-lesson-dialog .close-button{position:sticky;top:0;float:right;z-index:5}.grammar-lesson-dialog h2{font-size:23px;line-height:1.25}.grammar-lesson-dialog #grammar-lesson-spanish{font-size:24px;font-weight:900;line-height:1.3}.grammar-lesson-dialog .subtitle{font-size:17px;text-transform:none}.grammar-lesson-dialog #grammar-lesson-content{text-align:left}.grammar-lesson-dialog #grammar-lesson-content p{font-size:15px;line-height:1.5;margin:10px 0}.grammar-lesson-part{background:#fff;color:#111;border:3px solid #111;border-radius:10px;box-shadow:4px 4px 0 #ff69b4;padding:12px;margin:16px 0}.grammar-lesson-part h3{font-size:17px;margin:0;color:#111}.grammar-lesson-dialog .grammar-lesson-part p{color:#111}.grammar-lesson-pattern{background:#ffd700;color:#111!important;padding:10px;border:3px solid #111;font-weight:900}.grammar-lesson-example{font-weight:900;color:#25f4ee}.grammar-lesson-dialog #grammar-lesson-listen{font-size:15px;padding:10px 14px;min-height:42px;margin-top:16px}@media(max-width:600px){#grammar-screen #grammar-lesson-open{width:36px;height:36px;font-size:22px}.grammar-lesson-dialog{padding:20px 16px}.grammar-lesson-dialog h2{font-size:20px}.grammar-lesson-dialog #grammar-lesson-spanish{font-size:21px}}



/* Stable Grammar help placement independent of the phrase and video layout. */
#grammar-screen #grammar-camera-controls #grammar-lesson-open{position:absolute;top:146px;right:20px;bottom:auto;transform:none!important;animation:none;transition:background-color .15s;z-index:12}
.camera-layout #grammar-screen #grammar-camera-controls #grammar-lesson-open{top:146px;right:12px}
@media(max-height:600px){.camera-layout #grammar-screen #grammar-camera-controls #grammar-lesson-open{top:128px}}
#grammar-screen #grammar-phrase{overflow:visible;height:auto;white-space:normal;overflow-wrap:break-word}

#grammar-screen #grammar-lesson-open[hidden]{display:none!important}

#grammar-screen #grammar-feedback{transform:translate(-50%,-50%)!important;margin:0;z-index:14}

/* Use vocabulary's compact phone button dimensions, including while listening. */
@media(max-width:600px){
 .camera-layout #grammar-screen .bottom-area .controls #grammar-speak{width:calc((100% - 80px)*.6);min-width:0;min-height:36px;padding:4px 8px;gap:5px;font-size:clamp(12px,1.8dvh,16px)}
 .camera-layout #grammar-screen #grammar-speak{line-height:1.15;overflow-wrap:normal}
}
