.reading-page {
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding-bottom: 56px !important;
}

.reading-hero,
.reading-section {
    background: #fff;
    border: 1px solid #f2c9c5;
    border-radius: 12px;
    padding: 34px;
    box-shadow: 0 8px 24px rgba(127, 0, 0, 0.08);
}

.reading-section--deep {
    padding-block: 42px;
}

.reading-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 28px;
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 246, 235, 0.94), rgba(235, 250, 255, 0.9)),
        #fff;
}

.reading-kicker {
    color: #b71c1c;
    font-weight: 850;
    text-transform: uppercase;
    font-size: 0.78rem;
    margin-bottom: 8px;
}

.reading-hero h2,
.reading-section h3 {
    color: #263238;
    font-weight: 900;
    margin: 0 0 10px;
}

.reading-hero p,
.reading-section p {
    color: #546e7a;
    line-height: 1.6;
}

.reading-hero-actions,
.reading-section-actions,
.word-bank,
.answer-list,
.reading-word-ribbons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.reading-section-actions {
    align-items: center;
    justify-content: flex-end;
}

.reading-hero-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #ffd6d2;
    color: #9d1919;
    font-weight: 850;
    text-decoration: none;
}

.reading-hero-scene {
    position: relative;
    min-height: 220px;
}

.reading-book {
    position: absolute;
    inset: 18px 34px 38px 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: center;
    padding: 28px;
    background: #fffef9;
    border: 2px solid #f0c9bd;
    border-radius: 10px;
    box-shadow: 12px 12px 0 rgba(183, 28, 28, 0.1);
}

.reading-book span {
    display: grid;
    place-items: center;
    min-height: 68px;
    border: 2px solid #f2bd9f;
    border-radius: 8px;
    font-size: 2.2rem;
    font-weight: 900;
    color: #8b1200;
    background: #fff7ef;
}

.reading-book small {
    grid-column: 1 / -1;
    color: #7a5a4a;
    font-weight: 800;
    text-align: center;
}

.reading-character {
    position: absolute;
    right: 4px;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reading-face {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffd54f;
    border: 3px solid #ffb300;
    color: #6d4c41;
    font-weight: 900;
    font-size: 1.6rem;
}

.reading-bubble {
    background: #e8f5e9;
    border: 2px solid #81c784;
    color: #1b5e20;
    border-radius: 18px;
    padding: 8px 14px;
    font-weight: 900;
}

.reading-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 28px;
    margin-bottom: 28px;
}

.reading-toggle,
.reading-replay,
.reading-reset {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: #b71c1c;
    color: #fff;
    font-weight: 850;
    box-shadow: 0 6px 16px rgba(183, 28, 28, 0.2);
}

.reading-tab-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reading-tab,
.story-tab {
    border: 1px solid #f0c9bd;
    border-radius: 10px;
    background: #fffdfb;
    color: #4b2b23;
    min-height: 62px;
    padding: 11px 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.reading-tab strong,
.reading-tab span,
.story-tab {
    display: block;
}

.reading-tab strong {
    color: #7f0000;
    font-size: 0.98rem;
    font-weight: 900;
    line-height: 1.25;
}

.reading-tab span {
    color: #7a5a4a;
    font-weight: 800;
    margin-top: 4px;
}

.reading-tab.is-active,
.story-tab.is-active {
    background: linear-gradient(135deg, #b71c1c, #e65100);
    border-color: #9f180f;
    color: #fff;
    box-shadow: 0 10px 22px rgba(183, 28, 28, 0.18);
    transform: translateX(3px);
}

.reading-tab.is-active strong,
.reading-tab.is-active span {
    color: #fff;
}

.reading-syllables-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.reading-family-panel {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 14px;
    max-height: calc(100vh - 150px);
    overflow: auto;
    padding: 16px;
    border: 1px solid #efc8bc;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffaf7, #fff3ec);
    box-shadow: 0 10px 24px rgba(127, 0, 0, 0.08);
}

.reading-family-panel > strong {
    color: #8b1200;
    font-size: 1.05rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.reading-syllable-workspace {
    min-width: 0;
}

.reading-selected-family {
    display: grid;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid #f0c9bd;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff7ef, #fffdfb);
    box-shadow: 0 8px 22px rgba(127, 0, 0, 0.06);
}

.reading-selected-family span {
    color: #9f180f;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reading-selected-family strong {
    color: #3b2018;
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 950;
    line-height: 1.1;
}

.reading-selected-family small {
    color: #755345;
    font-weight: 800;
}

.reading-custom-syllables {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
    gap: 22px;
    align-items: stretch;
    margin: 8px 0 28px;
    padding: 22px;
    border: 1px solid #efc8bc;
    border-radius: 12px;
    background:
        linear-gradient(#f7e4d9 1px, transparent 1px),
        linear-gradient(90deg, #f7e4d9 1px, transparent 1px),
        linear-gradient(135deg, #fffaf7, #fff3ec);
    background-size: 28px 28px, 28px 28px, auto;
    box-shadow: 0 12px 28px rgba(127, 0, 0, 0.08);
}

.reading-custom-form {
    display: grid;
    gap: 16px;
    align-content: start;
}

.reading-custom-form h4 {
    margin: 0;
    color: #3b2018;
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 950;
    line-height: 1.1;
}

.reading-custom-form p {
    margin: 8px 0 0;
    color: #6f5147;
    font-weight: 750;
}

.reading-word-input {
    display: grid;
    gap: 7px;
}

.reading-word-input span {
    color: #8b1200;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.reading-word-input input {
    width: 100%;
    border: 2px solid #efc8bc;
    border-radius: 10px;
    background: #fffdfb;
    color: #3b2018;
    padding: 13px 14px;
    font-size: 1.1rem;
    font-weight: 850;
    outline: none;
}

.reading-word-input input:focus {
    border-color: #e65100;
    box-shadow: 0 0 0 4px rgba(230, 81, 0, 0.12);
}

.reading-custom-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reading-custom-actions button {
    border: 1px solid #f0c9bd;
    border-radius: 999px;
    background: #fffdfb;
    color: #7f0000;
    padding: 8px 12px;
    font-weight: 900;
    cursor: pointer;
}

.reading-custom-actions button:hover {
    border-color: #e65100;
    background: #fff3e0;
}

.reading-custom-result {
    display: grid;
    gap: 16px;
    align-content: center;
    min-height: 230px;
    padding: 20px;
    border: 2px solid #f0d3c7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
}

.reading-custom-empty {
    display: grid;
    place-items: center;
    min-height: 160px;
    color: #8a6b5e;
    font-weight: 850;
    text-align: center;
}

.reading-custom-word {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: baseline;
}

.reading-custom-word span {
    color: #8a6b5e;
    font-size: 0.95rem;
    font-weight: 850;
}

.reading-custom-word strong {
    color: #1b5e20;
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    font-weight: 950;
}

.reading-custom-syllable-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.reading-custom-syllable {
    display: grid;
    justify-items: center;
    gap: 5px;
    min-width: 76px;
    padding: 12px 10px 8px;
    border: 1px solid #f0c9bd;
    border-radius: 12px;
    background: #fff7ef;
    color: #8b1200;
    font-size: clamp(1.7rem, 4vw, 2.8rem);
    font-weight: 950;
    line-height: 1;
}

.reading-custom-syllable svg {
    width: 86px;
    height: 26px;
    display: block;
    overflow: visible;
}

.reading-custom-syllable path {
    fill: none;
    stroke: #c62828;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    animation: syllableArc 0.75s ease forwards;
}

.reading-syllable-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
    padding: 28px;
    border: 2px solid #f1d4c7;
    border-radius: 12px;
    background:
        linear-gradient(#f4e2d8 1px, transparent 1px),
        linear-gradient(90deg, #f4e2d8 1px, transparent 1px),
        #fffdf8;
    background-size: 28px 28px;
}

.reading-syllable-token {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px;
    border: 2px solid #f0d3c7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(127, 0, 0, 0.07);
}

.reading-syllable-main {
    display: grid;
    grid-template-columns: minmax(104px, 140px) 1fr;
    gap: 22px;
    align-items: center;
}

.reading-syllable-symbol,
.syllable-piece {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 5px;
    color: #8b1200;
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 900;
}

.reading-syllable-symbol {
    min-height: 116px;
    padding: 16px 10px 12px;
    border-radius: 12px;
    background: #fff2e8;
    border: 2px solid #f2bd9f;
}

.reading-syllable-symbol span {
    line-height: 1;
}

.reading-syllable-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.reading-syllable-copy strong {
    color: #3b2018;
    font-size: 1.35rem;
    font-weight: 900;
}

.reading-syllable-copy span {
    color: #6f5147;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 750;
}

.reading-syllable-examples {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.reading-syllable-example {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid #f1ddd4;
    border-radius: 10px;
    background: #fff;
}

.reading-example-picture {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background:
        radial-gradient(circle at 70% 22%, rgba(255, 255, 255, 0.9) 0 13px, transparent 14px),
        linear-gradient(145deg, #fff4e6, #ffe0b2);
    border: 2px solid #f8c88e;
    font-size: 2.15rem;
    box-shadow: inset 0 -8px 18px rgba(183, 28, 28, 0.08);
}

.reading-example-picture[data-kind="cibo"],
.reading-example-picture[data-kind="frutta"] {
    background:
        radial-gradient(circle at 70% 22%, rgba(255, 255, 255, 0.9) 0 13px, transparent 14px),
        linear-gradient(145deg, #fff8e1, #ffecb3);
    border-color: #ffe082;
}

.reading-example-picture[data-kind="animale"],
.reading-example-picture[data-kind="natura"] {
    background:
        radial-gradient(circle at 70% 22%, rgba(255, 255, 255, 0.9) 0 13px, transparent 14px),
        linear-gradient(145deg, #e8f5e9, #c8e6c9);
    border-color: #a5d6a7;
}

.reading-example-picture[data-kind="scuola"],
.reading-example-picture[data-kind="oggetto"] {
    background:
        radial-gradient(circle at 70% 22%, rgba(255, 255, 255, 0.9) 0 13px, transparent 14px),
        linear-gradient(145deg, #fff3e0, #ffcc80);
    border-color: #ffb74d;
}

.reading-example-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reading-example-copy strong {
    color: #20343f;
    font-size: 1.25rem;
    font-weight: 900;
}

.reading-example-copy span {
    color: #b71c1c;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0;
}

.syllable-piece {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 5px;
    color: #8b1200;
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 900;
}

.reading-syllable-token .ap-idle-btn,
.syllable-piece .ap-idle-btn,
.reading-word-card .ap-idle-btn,
.syllable-stage .ap-idle-btn {
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    box-shadow: none;
}

.reading-syllable-token .ap-idle-icon,
.syllable-piece .ap-idle-icon,
.reading-word-card .ap-idle-icon,
.syllable-stage .ap-idle-icon {
    width: 18px;
    height: 18px;
}

.reading-syllable-symbol svg,
.reading-syllable-arc,
.syllable-piece svg {
    width: 82px;
    height: 26px;
    display: block;
    overflow: visible;
    flex: 0 0 auto;
}

.reading-syllable-symbol path,
.reading-syllable-arc path,
.syllable-piece path {
    fill: none;
    stroke: #c62828;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: syllableArc 0.75s ease forwards;
}

.reading-word-ribbons {
    margin-top: 14px;
}

.reading-word-ribbons span {
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #6d4c41;
    font-weight: 850;
}

@keyframes syllableArc {
    to {
        stroke-dashoffset: 0;
    }
}

.reading-word-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.reading-word-card {
    border: 2px solid #ffd6d2;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 126px;
}

.reading-word-card.is-active {
    border-color: #c62828;
    background: #fff7f6;
}

.reading-word-select {
    border: 0;
    background: transparent;
    color: inherit;
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 5px 12px;
    align-items: center;
    padding: 0;
    text-align: left;
}

.reading-word-picture {
    grid-row: span 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #fff3e0;
    font-size: 1.45rem;
}

.reading-word-text {
    font-weight: 900;
    color: #263238;
}

.reading-word-split {
    color: #b71c1c;
    font-weight: 850;
}

.syllable-stage {
    margin-top: 32px;
    min-height: 240px;
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 26px;
    align-items: center;
    background:
        linear-gradient(#e7f3fb 1px, transparent 1px),
        linear-gradient(90deg, #e7f3fb 1px, transparent 1px),
        #fbfdff;
    background-size: 30px 30px;
    border: 2px solid #d9edf7;
    border-radius: 12px;
    padding: 28px;
}

.syllable-picture {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: #fff8e1;
    border: 2px solid #ffe082;
    font-size: 3rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.syllable-picture.is-hidden {
    opacity: 0;
    transform: scale(0.92);
}

.syllable-board {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.reading-big-word {
    margin-top: 6px;
    color: #1b5e20;
    font-size: 1.5rem;
    font-weight: 900;
}

.sentence-grid,
.comic-grid,
.writing-grid,
.reading-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.reading-module-card {
    display: grid;
    gap: 14px;
    min-height: 220px;
    padding: 26px;
    border: 1px solid #f0c9bd;
    border-radius: 10px;
    background: #fffdfb;
    text-decoration: none;
    color: inherit;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.reading-module-card:hover {
    transform: translateY(-2px);
    border-color: #e65100;
    box-shadow: 0 12px 24px rgba(183, 28, 28, 0.14);
}

.reading-module-card span {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #b71c1c, #e65100);
    color: #fff;
    font-weight: 900;
}

.reading-module-card strong {
    color: #263238;
    font-size: 1.25rem;
    font-weight: 900;
}

.reading-module-card p {
    margin: 0;
}

.sentence-card,
.story-card,
.fill-card,
.reading-comic,
.writing-card,
.reading-plan-card {
    background: #fbfdff;
    border: 1px solid #d9edf7;
    border-radius: 10px;
}

.sentence-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 8px 12px;
    padding: 14px;
    align-items: center;
}

.sentence-card span {
    grid-row: span 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    font-size: 1.4rem;
}

.sentence-card p {
    color: #263238;
    font-weight: 850;
    margin: 0;
}

.sentence-card small,
.writing-card small {
    color: #9f180f;
    font-weight: 850;
}

.reading-story-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.story-tab {
    min-height: 44px;
    font-weight: 850;
    text-align: center;
}

.story-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
    gap: 16px;
}

.story-card {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 14px;
    padding: 18px;
}

.story-picture {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fff8e1;
    border: 2px solid #ffe082;
    font-size: 2.4rem;
}

.story-card h4,
.fill-card h4,
.reading-comic h4,
.writing-card h4,
.reading-plan-card h4 {
    margin: 0 0 8px;
    color: #263238;
    font-weight: 900;
}

.tf-panel {
    border: 1px solid #d9edf7;
    border-radius: 10px;
    background: #fff;
    padding: 8px 14px;
}

.tf-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #e6eef5;
}

.tf-row:first-child {
    border-top: 0;
}

.tf-row span {
    color: #263238;
    font-weight: 750;
}

.tf-button,
.answer-choice,
.word-bank button {
    border: 1px solid #b8d8ee;
    background: #fff;
    color: #2f617f;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 850;
}

.tf-button.is-correct,
.answer-choice.is-correct {
    background: #e8f5e9;
    border-color: #43a047;
    color: #1b5e20;
}

.tf-button.is-wrong,
.answer-choice.is-wrong {
    background: #ffebee;
    border-color: #e53935;
    color: #b71c1c;
}

.fill-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(240px, 0.7fr);
    gap: 16px;
}

.fill-card,
.reading-comic,
.writing-card {
    padding: 18px;
}

.fill-card p {
    padding: 14px;
    border-radius: 10px;
    background: #fff8e1;
    color: #4e342e;
    font-weight: 850;
}

.fill-slots {
    display: grid;
    gap: 8px;
}

.fill-slots span {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e6eef5;
    color: #263238;
}

.comic-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.comic-strip div {
    min-height: 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 4px 12px;
    align-items: start;
    border-radius: 10px;
    border: 2px solid #d9edf7;
    background:
        linear-gradient(135deg, rgba(255, 247, 236, 0.95), rgba(255, 253, 248, 0.95)),
        #fff;
    padding: 14px;
}

.comic-strip span {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffd54f;
    color: #5d4037;
    font-weight: 900;
    grid-row: 1 / span 2;
}

.comic-strip strong {
    display: block;
    color: #263238;
    line-height: 1.25;
}

.comic-strip p {
    margin: 0;
    color: #4b2b23;
    font-weight: 700;
    line-height: 1.45;
}

.reading-question {
    margin-top: 12px;
    font-weight: 850;
}

.writing-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 260px;
}

.reading-anchor {
    display: block;
    height: 1px;
    margin-top: -96px;
    padding-top: 96px;
    pointer-events: none;
}

.writing-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    font-size: 1.5rem;
}

.writing-lines {
    display: grid;
    gap: 10px;
    padding: 10px 0;
}

.writing-lines span {
    height: 2px;
    background: repeating-linear-gradient(90deg, #9fc6dd 0 18px, transparent 18px 24px);
}

.reading-plan {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.reading-plan-card {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 12px;
    padding: 16px;
}

.reading-plan-number {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #b71c1c;
    color: #fff;
    font-weight: 900;
}

.reading-plan-tools {
    color: #9f180f;
    font-weight: 850;
    font-size: 0.88rem;
}

[data-theme="dark"] .reading-hero,
[data-theme="dark"] .reading-section,
[data-theme="dark"] .reading-tab,
[data-theme="dark"] .story-tab,
[data-theme="dark"] .reading-module-card,
[data-theme="dark"] .sentence-card,
[data-theme="dark"] .story-card,
[data-theme="dark"] .fill-card,
[data-theme="dark"] .reading-comic,
[data-theme="dark"] .writing-card,
[data-theme="dark"] .reading-plan-card,
[data-theme="dark"] .reading-word-card,
[data-theme="dark"] .tf-panel,
[data-theme="dark"] .fill-slots span {
    background: var(--bp-surface);
    border-color: var(--bp-border);
}

[data-theme="dark"] .reading-hero h2,
[data-theme="dark"] .reading-section h3,
[data-theme="dark"] .reading-word-text,
[data-theme="dark"] .reading-module-card strong,
[data-theme="dark"] .sentence-card p,
[data-theme="dark"] .story-card h4,
[data-theme="dark"] .fill-card h4,
[data-theme="dark"] .reading-comic h4,
[data-theme="dark"] .writing-card h4,
[data-theme="dark"] .reading-plan-card h4,
[data-theme="dark"] .tf-row span,
[data-theme="dark"] .comic-strip strong {
    color: var(--bp-text);
}

[data-theme="dark"] .reading-hero p,
[data-theme="dark"] .reading-section p {
    color: var(--bp-text-muted);
}

@media (max-width: 820px) {
    .reading-hero,
    .syllable-stage,
    .story-layout,
    .fill-layout {
        grid-template-columns: 1fr;
    }

    .reading-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .reading-section-actions {
        justify-content: flex-start;
    }

    .reading-syllables-layout {
        grid-template-columns: 1fr;
    }

    .reading-family-panel {
        position: static;
        max-height: none;
    }

    .reading-custom-syllables {
        grid-template-columns: 1fr;
    }

    .comic-strip {
        grid-template-columns: 1fr;
    }

    .tf-row {
        grid-template-columns: 1fr;
    }

    .reading-syllable-main,
    .reading-syllable-example {
        grid-template-columns: 1fr;
    }

    .reading-example-picture {
        width: 100%;
        min-height: 92px;
    }
}

/* Lettura sillabe: layout pulito e audio separati */
.reading-syllables-layout {
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 28px;
}

.reading-family-panel {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
    align-self: start;
    padding: 20px;
}

.reading-tab-grid {
    display: grid;
    gap: 12px;
}

.reading-tab {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    min-height: 0;
    padding: 15px 16px;
    text-align: left;
}

.reading-tab strong,
.reading-tab span {
    display: block;
    min-width: 0;
}

.reading-tab strong {
    line-height: 1.18;
}

.reading-tab span {
    margin-top: 0;
    line-height: 1.2;
}

.reading-tab.is-active {
    transform: none;
}

.reading-syllable-board {
    padding: 32px;
}

.reading-syllable-token {
    padding: 28px 30px;
}

.reading-syllable-main {
    grid-template-columns: minmax(148px, 178px) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
}

.reading-syllable-copy {
    gap: 12px;
}

.reading-syllable-examples {
    gap: 16px;
}

.reading-syllable-example {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 16px 20px;
    align-items: start;
    padding: 18px 20px;
}

.reading-example-copy {
    align-self: center;
}

.reading-example-actions {
    grid-column: 2;
    display: grid;
    gap: 10px;
    justify-items: start;
}

.reading-example-syllable-audio,
.reading-custom-syllable-audio {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.reading-custom-listen {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.reading-example-syllable-audio .ap-idle-btn,
.reading-custom-syllable-audio .ap-idle-btn {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    box-shadow: none;
}

@media (max-width: 1100px) {
    .reading-syllables-layout {
        grid-template-columns: 1fr;
    }

    .reading-tab-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }
}

@media (max-width: 720px) {
    .reading-syllable-board,
    .reading-syllable-token {
        padding: 18px;
    }

    .reading-syllable-main,
    .reading-syllable-example {
        grid-template-columns: 1fr;
    }

    .reading-example-actions {
        grid-column: 1;
    }
}

/* Lettura parole: tab e flashcard allineati */
.reading-word-set-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 30px;
}

.reading-word-set-tabs .reading-tab {
    min-height: 86px;
    padding: 18px 20px;
    align-content: center;
    justify-items: start;
    gap: 7px;
    text-align: left;
}

.reading-word-set-tabs .reading-tab strong,
.reading-word-set-tabs .reading-tab span {
    display: block;
    width: 100%;
    min-width: 0;
    text-align: left;
}

.reading-word-set-tabs .reading-tab strong {
    font-size: 1.02rem;
    line-height: 1.2;
}

.reading-word-set-tabs .reading-tab span {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.25;
    color: #6d5148;
}

.reading-word-set-tabs .reading-tab.is-active span {
    color: rgba(255, 255, 255, 0.86);
}

.reading-word-grid--cards {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 24px;
    max-width: 980px;
}

.reading-word-grid--cards .reading-word-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    min-height: 124px;
    padding: 18px 22px;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(127, 0, 0, 0.06);
    align-items: center;
}

.reading-word-grid--cards .reading-word-select {
    grid-template-columns: 86px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 8px 18px;
    align-items: center;
    width: 100%;
}

.reading-word-grid--cards .reading-word-picture {
    grid-row: 1 / span 2;
    width: 82px;
    height: 82px;
    border-radius: 14px;
    font-size: 1.75rem;
}

.reading-word-grid--cards .reading-word-picture .reading-picture-svg {
    width: 74px;
    height: 74px;
}

.reading-word-grid--cards .reading-word-text,
.reading-word-grid--cards .reading-word-split {
    display: block;
    min-width: 0;
    text-align: left;
    line-height: 1.15;
}

.reading-word-grid--cards .reading-word-text {
    font-size: 1.55rem;
}

.reading-word-grid--cards .reading-word-split {
    font-size: 1.18rem;
    letter-spacing: 0.02em;
}

.reading-word-grid--cards .ap-idle-btn,
.syllable-stage .ap-idle-btn {
    justify-self: start;
}

.syllable-stage {
    align-items: center;
    gap: 24px;
    margin-top: 34px;
    padding: 28px;
}

.syllable-stage > div:nth-child(2) {
    display: grid;
    gap: 16px;
    justify-items: start;
    min-width: 0;
}

.syllable-board {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.reading-lead {
    max-width: 880px;
    margin: 0 0 24px;
    color: #5d4037;
    font-size: 1.02rem;
    line-height: 1.7;
}

.reading-exercises-panel,
.reading-quiz-panel {
    margin-top: 34px;
    padding: 28px;
    border: 1px solid rgba(141, 24, 0, 0.16);
    border-radius: 14px;
    background: rgba(255, 252, 247, 0.92);
}

.reading-exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.reading-exercise-card {
    display: grid;
    gap: 14px;
    align-content: start;
    padding: 20px;
    border: 1px solid rgba(141, 24, 0, 0.14);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(127, 0, 0, 0.06);
}

.reading-exercise-card strong {
    color: #2b1d18;
    font-size: 1.08rem;
    line-height: 1.35;
}

.reading-exercise-card small {
    color: #6d5148;
    line-height: 1.45;
}

.reading-exercise-type,
.reading-mini-split {
    width: fit-content;
    border-radius: 999px;
    font-weight: 800;
}

.reading-exercise-type {
    padding: 5px 10px;
    background: #fff1df;
    color: #8b1200;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.reading-mini-split {
    padding: 8px 12px;
    background: #fff7ec;
    color: #a01800;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.story-picture,
.writing-icon,
.sentence-card > span {
    display: grid;
    place-items: center;
}

.story-picture .reading-picture-svg,
.writing-icon .reading-picture-svg,
.sentence-card > span .reading-picture-svg {
    width: 58px;
    height: 58px;
}

.tf-panel h4,
.reading-quiz-panel h4 {
    margin: 0 0 12px;
    color: #8b1200;
    font-size: 1rem;
    text-transform: uppercase;
}

.writing-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 22px;
    align-items: stretch;
}

.writing-card {
    min-height: 0;
    gap: 16px;
    padding: 24px;
}

.writing-card h4 {
    margin: 0;
    line-height: 1.15;
}

.writing-card p {
    margin: 0;
    min-height: 0;
    color: #5d4037;
    line-height: 1.55;
}

.writing-steps,
.writing-examples {
    display: grid;
    gap: 8px;
}

.writing-steps span {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: start;
    color: #3d2b25;
    line-height: 1.35;
}

.writing-steps strong {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #8b1200;
    color: #fff;
    font-size: 0.86rem;
}

.writing-examples {
    padding: 12px;
    border-radius: 10px;
    background: #fff7ec;
    color: #2b1d18;
    font-weight: 700;
}

.writing-lines {
    margin: 0;
}

.comprehension-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.comprehension-hub-card {
    display: grid;
    gap: 14px;
    align-content: start;
    min-height: 230px;
    padding: 24px;
    border: 1px solid rgba(141, 24, 0, 0.16);
    border-radius: 12px;
    background: #fff;
    color: #2b1d18;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(127, 0, 0, 0.07);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.comprehension-hub-card:hover {
    transform: translateY(-2px);
    border-color: rgba(184, 28, 0, 0.34);
    box-shadow: 0 16px 32px rgba(127, 0, 0, 0.12);
}

.comprehension-hub-card span {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #fff7ec;
}

.comprehension-hub-card .reading-picture-svg {
    width: 66px;
    height: 66px;
}

.comprehension-hub-card strong {
    color: #8b1200;
    font-size: 1.35rem;
    line-height: 1.15;
}

.comprehension-hub-card p {
    margin: 0;
    color: #5d4037;
    line-height: 1.55;
}

.long-reading-list {
    display: grid;
    gap: 28px;
    margin-top: 24px;
}

.long-reading-card {
    display: grid;
    gap: 22px;
    margin-top: 22px;
    padding: 28px;
    border: 1px solid rgba(141, 24, 0, 0.16);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(127, 0, 0, 0.07);
}

.long-reading-card header {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.long-reading-card header > span {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #fff7ec;
}

.long-reading-card header .reading-picture-svg {
    width: 68px;
    height: 68px;
}

.long-reading-card h4 {
    margin: 0;
    color: #2b1d18;
    font-size: 1.55rem;
}

.long-reading-text {
    display: grid;
    gap: 14px;
    max-width: 900px;
    color: #2b1d18;
    font-size: 1.04rem;
    line-height: 1.75;
}

.long-reading-text p {
    margin: 0;
}

.written-prompts {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 12px;
    background: #fff7ec;
    border: 1px solid rgba(141, 24, 0, 0.12);
}

.written-prompts h5 {
    margin: 0 0 4px;
    color: #8b1200;
    font-size: 1rem;
    text-transform: uppercase;
}

.written-prompts span {
    color: #3d2b25;
    font-weight: 700;
}

.comic-grid {
    grid-template-columns: 1fr;
    max-width: 980px;
}

.reading-comic {
    display: grid;
    gap: 18px;
    padding: 22px;
    background:
        linear-gradient(#f7e4d9 1px, transparent 1px),
        linear-gradient(90deg, #f7e4d9 1px, transparent 1px),
        #fffdf8;
    background-size: 28px 28px, 28px 28px, auto;
    border-color: rgba(141, 24, 0, 0.18);
}

.reading-comic h4,
.reading-comic .reading-question {
    max-width: 820px;
}

.reading-comic .answer-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 820px;
}

.reading-comic .answer-choice {
    text-align: left;
    padding: 12px 14px;
}

@media (max-width: 760px) {
    .reading-exercises-panel,
    .reading-quiz-panel {
        padding: 18px;
    }

    .reading-exercise-grid,
    .writing-grid,
    .comprehension-hub-grid {
        grid-template-columns: 1fr;
    }

    .long-reading-card {
        padding: 20px;
    }

    .long-reading-card header {
        grid-template-columns: 1fr;
    }
}

.syllable-piece {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-width: 96px;
    padding: 14px 12px;
}

.reading-big-word {
    margin: 0;
    line-height: 1;
}

@media (max-width: 760px) {
    .reading-word-set-tabs,
    .reading-word-grid--cards {
        grid-template-columns: 1fr;
    }

    .reading-word-grid--cards .reading-word-card {
        grid-template-columns: 1fr;
    }

    .reading-word-grid--cards .reading-word-select {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .reading-word-grid--cards .reading-word-picture {
        width: 70px;
        height: 70px;
    }

    .syllable-stage {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

.reading-picture-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.reading-example-picture,
.reading-word-picture,
.syllable-picture {
    overflow: hidden;
}

.reading-word-picture .reading-picture-svg {
    width: 42px;
    height: 42px;
}

.reading-word-grid--cards .reading-word-picture .reading-picture-svg {
    width: 74px;
    height: 74px;
}

.syllable-picture .reading-picture-svg {
    width: 88px;
    height: 88px;
}

.ap-idle-btn--compact {
    min-width: 0;
    transition: background 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.ap-idle-btn--compact.is-loading {
    opacity: 0.72;
    cursor: wait;
}

.ap-idle-btn--compact.is-playing {
    background: #7f0000;
}

.ap-idle-btn--compact.is-loading .ap-idle-icon svg {
    animation: readingAudioPulse 0.8s ease-in-out infinite alternate;
}

@keyframes readingAudioPulse {
    from { transform: scale(0.9); opacity: 0.55; }
    to { transform: scale(1.05); opacity: 1; }
}

/* Grillo parlante: gioco di ascolto e scrittura */
.grillo-game-shell {
    overflow: hidden;
}

.grillo-stage {
    display: grid;
    grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1.18fr);
    gap: 28px;
    align-items: stretch;
}

.grillo-scene {
    position: relative;
    min-height: 520px;
    display: grid;
    place-items: center;
    padding: 32px;
    border-radius: 14px;
    background:
        linear-gradient(#f7e4d9 1px, transparent 1px),
        linear-gradient(90deg, #f7e4d9 1px, transparent 1px),
        linear-gradient(180deg, #fff7ec 0%, #ffe1ba 100%);
    background-size: 28px 28px, 28px 28px, auto;
    border: 1px solid rgba(141, 24, 0, 0.16);
    box-shadow: inset 0 -22px 42px rgba(127, 0, 0, 0.08);
}

.grillo-moon {
    position: absolute;
    top: 32px;
    right: 36px;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: #fff3cd;
    box-shadow: 0 0 0 12px rgba(255, 243, 205, 0.32);
}

.grillo-lantern {
    width: min(280px, 78%);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 45%, rgba(255, 245, 170, 0.9), rgba(255, 170, 64, 0.2) 62%, transparent 63%);
    filter: drop-shadow(0 20px 30px rgba(127, 0, 0, 0.18));
}

.grillo-svg {
    width: 100%;
    height: 100%;
}

.grillo-speech {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 28px;
    padding: 16px 18px;
    border-radius: 14px;
    background: #fffdfb;
    border: 2px solid #f0c9bd;
    color: #4b2b23;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.35;
    text-align: center;
}

.grillo-panel {
    display: grid;
    gap: 20px;
    align-content: start;
    padding: 28px;
    border: 1px solid rgba(141, 24, 0, 0.16);
    border-radius: 14px;
    background: #fffdfb;
    box-shadow: 0 12px 28px rgba(127, 0, 0, 0.08);
}

.grillo-panel h3 {
    margin-bottom: 0;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.grillo-panel p {
    margin: 0;
}

.grillo-audio-card {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 18px;
    border-radius: 14px;
    background: #fff7ec;
    border: 1px solid #f0c9bd;
}

.grillo-picture {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #fff;
    border: 2px solid #f3caa4;
}

.grillo-picture .reading-picture-svg {
    width: 78px;
    height: 78px;
}

.grillo-level {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff;
    color: #8b1200;
    border: 1px solid #f0c9bd;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.grillo-input {
    display: grid;
    gap: 8px;
}

.grillo-input span {
    color: #8b1200;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.grillo-input input {
    width: 100%;
    border: 2px solid #efc8bc;
    border-radius: 12px;
    background: #fff;
    color: #2b1d18;
    padding: 18px 20px;
    font-size: clamp(1.45rem, 3vw, 2.05rem);
    font-weight: 950;
    outline: none;
}

.grillo-input input:focus {
    border-color: #e65100;
    box-shadow: 0 0 0 4px rgba(230, 81, 0, 0.13);
}

.grillo-feedback,
.grillo-help {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 850;
}

.grillo-feedback.is-correct {
    background: #e8f5e9;
    border: 1px solid #81c784;
    color: #1b5e20;
}

.grillo-feedback.is-wrong {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #8b1200;
}

.grillo-help {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #4e342e;
}

.grillo-help strong {
    color: #b71c1c;
    font-size: 1.35rem;
    letter-spacing: 0.03em;
}

.grillo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.grillo-progress-section {
    display: grid;
    gap: 20px;
}

.grillo-score {
    min-width: 180px;
    padding: 16px;
    border-radius: 12px;
    background: #fff7ec;
    border: 1px solid #f0c9bd;
    color: #4b2b23;
}

.grillo-score strong {
    display: block;
    color: #8b1200;
    font-size: 2rem;
    line-height: 1;
}

.grillo-score span {
    font-weight: 850;
}

.grillo-round-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 10px;
}

.grillo-round-chip {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 48px;
    border: 1px solid #f0c9bd;
    border-radius: 10px;
    background: #fffdfb;
    color: #4b2b23;
    padding: 8px 10px;
    cursor: pointer;
}

.grillo-round-chip span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #fff7ec;
    color: #8b1200;
    font-weight: 900;
}

.grillo-round-chip strong {
    font-size: 0.86rem;
    font-weight: 900;
}

.grillo-round-chip.is-active {
    background: linear-gradient(135deg, #b71c1c, #e65100);
    border-color: #9f180f;
    color: #fff;
}

.grillo-round-chip.is-active span {
    background: rgba(255, 255, 255, 0.96);
}

.grillo-reset {
    justify-self: start;
}

@media (max-width: 900px) {
    .grillo-stage {
        grid-template-columns: 1fr;
    }

    .grillo-scene {
        min-height: 360px;
    }
}

@media (max-width: 620px) {
    .grillo-panel,
    .grillo-scene {
        padding: 20px;
    }

    .grillo-audio-card {
        grid-template-columns: 1fr;
    }
}

/* Grillo parlante: console ispirata al gioco fisico */
.reading-page--grillo {
    align-items: center;
}

.grillo-console-shell {
    width: min(1040px, 100%);
    display: grid;
    gap: 22px;
    justify-items: center;
}

.grillo-console {
    width: min(760px, 100%);
    display: grid;
    gap: 0;
    padding: 24px 24px 30px;
    border-radius: 32px;
    background:
        linear-gradient(180deg, #ff321f 0%, #e92314 42%, #f44719 100%);
    border: 5px solid #b91409;
    box-shadow:
        inset 0 3px 0 rgba(255, 255, 255, 0.35),
        inset 0 -10px 24px rgba(111, 0, 0, 0.22),
        0 22px 42px rgba(127, 0, 0, 0.25);
}

.grillo-handle {
    width: min(460px, 78%);
    height: 86px;
    justify-self: center;
    margin-bottom: 16px;
    border-radius: 28px;
    border: 18px solid #ff4a2b;
    border-bottom-width: 12px;
    background: transparent;
    box-shadow:
        inset 0 8px 12px rgba(120, 0, 0, 0.2),
        0 3px 0 rgba(255, 255, 255, 0.24);
}

.grillo-screen {
    min-height: 150px;
    display: grid;
    grid-template-columns: 165px minmax(0, 1fr) 128px;
    gap: 18px;
    align-items: center;
    padding: 20px 22px;
    background: #090909;
    border-radius: 9px;
    border: 4px solid #2a110d;
    color: #d8ffff;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.9);
}

.grillo-speaker {
    display: grid;
    gap: 6px;
}

.grillo-speaker span {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #171717, #4d4d4d, #111);
}

.grillo-display {
    min-height: 96px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 4px;
    padding: 10px;
    border-radius: 6px;
    background:
        radial-gradient(circle at 50% 50%, rgba(24, 255, 255, 0.16), transparent 58%),
        #050807;
    border: 1px solid rgba(70, 255, 255, 0.25);
    text-align: center;
}

.grillo-device-title,
.grillo-display small,
.grillo-brand {
    color: #fff7d6;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.grillo-device-title {
    font-size: 0.76rem;
}

.grillo-display strong {
    color: #64ffff;
    font-family: "Consolas", "Courier New", monospace;
    font-size: clamp(1.9rem, 5vw, 3.4rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.12em;
    text-shadow: 0 0 8px rgba(100, 255, 255, 0.65);
    max-width: 100%;
    overflow-wrap: anywhere;
}

.grillo-display small {
    color: rgba(216, 255, 255, 0.74);
    font-size: 0.72rem;
}

.grillo-brand {
    align-self: end;
    color: #fff;
    font-size: 0.92rem;
    text-align: center;
}

.grillo-control-deck {
    display: grid;
    gap: 14px;
    margin: 28px 16px 0;
    padding: 16px;
    border-radius: 22px;
    background: #ffc229;
    border: 8px solid #ffe933;
    outline: 10px solid #00a846;
    box-shadow: inset 0 0 0 3px #006c2e;
}

.grillo-command-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.grillo-command-row .ap-idle-btn,
.grillo-command {
    min-height: 48px;
    border: 3px solid #2b1d18;
    border-radius: 8px;
    background: #ffde3a;
    color: #2b1d18;
    font-size: 0.92rem;
    font-weight: 950;
    text-transform: uppercase;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16);
}

.grillo-command-row .ap-idle-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
}

.grillo-command-row .ap-idle-btn {
    background: #38c957;
    color: #fff;
}

.grillo-play-area {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) minmax(190px, 0.8fr);
    gap: 12px;
    align-items: stretch;
    padding: 12px;
    border-radius: 12px;
    background: #f7a813;
    border: 3px solid #2b1d18;
}

.grillo-picture-window {
    display: grid;
    place-items: center;
    min-height: 130px;
    border-radius: 10px;
    background:
        radial-gradient(circle at 68% 18%, rgba(255, 255, 255, 0.9) 0 16px, transparent 17px),
        linear-gradient(145deg, #fff8e1, #ffe0b2);
    border: 3px solid #2b1d18;
}

.grillo-picture-window span {
    width: 102px;
    height: 102px;
    display: grid;
    place-items: center;
}

.grillo-picture-window .reading-picture-svg {
    width: 100%;
    height: 100%;
}

.grillo-device-input {
    align-self: stretch;
    align-content: stretch;
}

.grillo-device-input span {
    color: #2b1d18;
    font-size: 0.78rem;
}

.grillo-write-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.grillo-write-head strong {
    color: #2b1d18;
    font-size: 0.78rem;
    font-weight: 950;
    letter-spacing: 0.04em;
}

.grillo-case-toggle {
    border: 2px solid #2b1d18;
    border-radius: 7px;
    background: #38c957;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.grillo-device-input input {
    height: 100%;
    min-height: 78px;
    border: 3px solid #2b1d18;
    border-radius: 10px;
    background: #fff7cc;
    color: #121212;
    font-family: "Consolas", "Courier New", monospace;
    font-size: clamp(1.4rem, 3vw, 2.3rem);
    letter-spacing: 0.06em;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.grillo-device-input.is-uppercase input {
    text-transform: uppercase;
}

.grillo-device-input.is-lowercase input {
    text-transform: lowercase;
}

.grillo-result-panel {
    display: grid;
    align-content: center;
    gap: 8px;
    min-height: 112px;
    padding: 12px;
    border-radius: 10px;
    background: #fff9d6;
    border: 3px solid #2b1d18;
    color: #2b1d18;
    font-weight: 850;
}

.grillo-result-panel > strong {
    color: #8b1200;
    font-size: 1.05rem;
}

.grillo-result-panel .grillo-feedback,
.grillo-result-panel .grillo-help {
    padding: 0;
    border: 0;
    background: transparent;
}

.grillo-result-panel .grillo-help strong,
.grillo-result-panel .grillo-feedback span {
    font-size: 1.25rem;
}

.grillo-keyboard {
    display: grid;
    gap: 8px;
}

.grillo-keyboard-row {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
}

.grillo-keyboard-row:nth-child(3) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: start;
    width: 60%;
}

.grillo-keyboard-row--actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
}

.grillo-key {
    min-height: 52px;
    border: 3px solid #2b1d18;
    border-radius: 8px;
    background: #21bce7;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 950;
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.2);
}

.grillo-key:active,
.grillo-command:active,
.grillo-command-row .ap-idle-btn:active {
    transform: translateY(2px);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

.grillo-key--action {
    background: #ffde3a;
    color: #2b1d18;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.grillo-key--ok {
    background: #38c957;
    color: #fff;
    font-size: 1rem;
}

.grillo-bottom-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 6px 8px 0;
    color: #145226;
    font-weight: 950;
}

.grillo-bottom-strip .grillo-score {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.grillo-bottom-strip .grillo-score strong {
    display: inline;
    color: #145226;
    font-size: 1.25rem;
}

.grillo-bottom-strip .grillo-reset {
    border: 0;
    border-radius: 8px;
    background: #128b3b;
    color: #fff;
    padding: 9px 12px;
    font-weight: 950;
}

.grillo-rounds-panel {
    width: min(760px, 100%);
    display: grid;
    gap: 12px;
    padding: 18px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(141, 24, 0, 0.16);
}

.grillo-round-list {
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 8px;
}

.grillo-round-chip {
    grid-template-columns: 26px minmax(0, 1fr);
    min-height: 42px;
    padding: 6px 8px;
    border-color: #e6b690;
}

.grillo-round-chip span {
    width: 24px;
    height: 24px;
    font-size: 0.76rem;
}

.grillo-round-chip strong {
    font-size: 0.75rem;
}

@media (max-width: 820px) {
    .grillo-console {
        padding: 18px 14px 24px;
        border-radius: 24px;
    }

    .grillo-screen,
    .grillo-play-area {
        grid-template-columns: 1fr;
    }

    .grillo-brand {
        align-self: center;
    }

    .grillo-command-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grillo-keyboard-row,
    .grillo-keyboard-row:nth-child(3) {
        width: 100%;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .grillo-key {
        min-height: 46px;
    }
}

/* Grillo parlante: layout compatto a tutto schermo */
.reading-page--grillo {
    padding-top: 12px !important;
    padding-bottom: 18px !important;
}

.reading-page--grillo .grillo-console-shell {
    width: min(1180px, 100%);
    grid-template-columns: minmax(560px, 760px) minmax(170px, 220px);
    gap: 18px;
    align-items: start;
    justify-content: center;
}

.reading-page--grillo .grillo-console {
    width: 100%;
    padding: 14px 16px 18px;
    border-radius: 26px;
}

.reading-page--grillo .grillo-handle {
    height: 58px;
    margin-bottom: 10px;
    border-width: 12px;
    border-bottom-width: 8px;
    border-radius: 22px;
}

.reading-page--grillo .grillo-screen {
    min-height: 108px;
    grid-template-columns: 140px minmax(0, 1fr);
    padding: 14px 18px;
}

.reading-page--grillo .grillo-display {
    min-height: 78px;
}

.reading-page--grillo .grillo-display strong {
    font-size: clamp(1.55rem, 4vw, 2.7rem);
}

.reading-page--grillo .grillo-control-deck {
    margin: 18px 10px 0;
    padding: 12px;
    gap: 10px;
    border-width: 7px;
    outline-width: 8px;
}

.reading-page--grillo .grillo-command-row {
    gap: 7px;
    align-items: stretch;
    grid-auto-rows: minmax(40px, 1fr);
}

.reading-page--grillo .grillo-command-row .ap-idle-btn,
.reading-page--grillo .grillo-command {
    min-height: 40px;
    font-size: 0.82rem;
    height: 100%;
}

.reading-page--grillo .grillo-command-row > .ap-idle-btn.ap-idle-btn--compact {
    width: 100%;
    height: 100% !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 3px solid #2b1d18 !important;
    border-radius: 8px !important;
    background: #38c957 !important;
    color: #fff !important;
    font-size: 0.82rem !important;
    font-weight: 950 !important;
    text-transform: uppercase;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16) !important;
}

.reading-page--grillo .grillo-play-area {
    grid-template-columns: 118px minmax(0, 1fr) minmax(180px, 0.78fr);
    gap: 10px;
    padding: 10px;
}

.reading-page--grillo .grillo-picture-window {
    min-height: 108px;
}

.reading-page--grillo .grillo-picture-window span {
    width: 94px;
    height: 94px;
}

.reading-page--grillo .grillo-device-input input {
    min-height: 66px;
}

.reading-page--grillo .grillo-result-panel {
    min-height: 96px;
    padding: 10px;
}

.reading-page--grillo .grillo-keyboard {
    gap: 6px;
}

.reading-page--grillo .grillo-keyboard-row {
    gap: 6px;
}

.reading-page--grillo .grillo-key {
    min-height: 39px;
    font-size: 1.08rem;
    border-width: 2px;
}

.reading-page--grillo .grillo-key--action,
.reading-page--grillo .grillo-key--ok {
    font-size: 0.82rem;
}

.reading-page--grillo .grillo-bottom-strip {
    padding-top: 2px;
}

.reading-page--grillo .grillo-rounds-panel {
    width: 100%;
    max-height: calc(100vh - 158px);
    overflow: auto;
    padding: 12px;
    align-self: stretch;
}

.reading-page--grillo .grillo-round-list {
    grid-template-columns: 1fr;
    gap: 7px;
}

.reading-page--grillo .grillo-round-chip {
    min-height: 38px;
}

@media (max-width: 980px) {
    .reading-page--grillo .grillo-console-shell {
        grid-template-columns: 1fr;
    }

    .reading-page--grillo .grillo-rounds-panel {
        max-height: none;
    }

    .reading-page--grillo .grillo-round-list {
        grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    }

    .reading-page--grillo .grillo-difficulty-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.reading-picture-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 7px 10px rgba(127, 0, 0, 0.14));
}

.grillo-command-row .grillo-command--check {
    background: #d32626;
    color: #fff;
}

.grillo-options-panel {
    background: linear-gradient(180deg, #fffaf2, #fff4df);
    border: 3px solid #e3a21d;
}

.grillo-difficulty-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.grillo-difficulty {
    min-height: 40px;
    border: 2px solid #2b1d18;
    border-radius: 8px;
    background: #fff7d6;
    color: #2b1d18;
    font-weight: 950;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.grillo-difficulty.is-active {
    background: linear-gradient(135deg, #b71c1c, #f4511e);
    color: #fff;
}

.reading-picture-svg--word text {
    font-family: "Consolas", "Courier New", monospace;
    letter-spacing: 0.02em;
}

@media (max-width: 700px) {
    .reading-page--grillo {
        gap: 6px;
        padding: 4px 6px 8px !important;
    }

    .reading-page--grillo .grillo-console-shell {
        width: 100%;
        gap: 8px;
    }

    .reading-page--grillo .grillo-console {
        padding: 8px;
        border-width: 3px;
        border-radius: 18px;
        box-shadow: 0 10px 20px rgba(127, 0, 0, 0.18);
    }

    .reading-page--grillo .grillo-handle {
        width: 54%;
        height: 28px;
        margin-bottom: 5px;
        border-width: 7px;
        border-bottom-width: 5px;
        border-radius: 14px;
    }

    .reading-page--grillo .grillo-screen {
        min-height: 58px;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 8px;
        padding: 6px 8px;
        border-width: 3px;
    }

    .reading-page--grillo .grillo-speaker {
        gap: 3px;
    }

    .reading-page--grillo .grillo-speaker span {
        height: 3px;
    }

    .reading-page--grillo .grillo-display {
        min-height: 44px;
        padding: 5px;
    }

    .reading-page--grillo .grillo-device-title {
        font-size: 0.54rem;
    }

    .reading-page--grillo .grillo-display strong {
        font-size: clamp(1rem, 8vw, 1.65rem);
        letter-spacing: 0.06em;
    }

    .reading-page--grillo .grillo-display small {
        font-size: 0.54rem;
    }

    .reading-page--grillo .grillo-control-deck {
        margin: 7px 2px 0;
        padding: 7px;
        gap: 6px;
        border-width: 5px;
        outline-width: 5px;
        border-radius: 14px;
    }

    .reading-page--grillo .grillo-command-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .reading-page--grillo .grillo-command-row .ap-idle-btn,
    .reading-page--grillo .grillo-command {
        min-height: 31px;
        height: 31px;
        padding: 3px 4px;
        border-width: 2px;
        border-radius: 6px;
        font-size: 0.58rem;
    }

    .reading-page--grillo .grillo-command-row > .ap-idle-btn.ap-idle-btn--compact {
        min-height: 31px !important;
        height: 31px !important;
        border-width: 2px !important;
        border-radius: 6px !important;
        font-size: 0.58rem !important;
        padding: 0 4px !important;
    }

    .reading-page--grillo .grillo-play-area {
        grid-template-columns: 74px minmax(0, 1fr);
        grid-template-areas:
            "pic input"
            "result result";
        gap: 6px;
        padding: 6px;
        border-width: 2px;
    }

    .reading-page--grillo .grillo-picture-window {
        grid-area: pic;
        min-height: 74px;
        border-width: 2px;
    }

    .reading-page--grillo .grillo-picture-window span {
        width: 62px;
        height: 62px;
    }

    .reading-page--grillo .grillo-device-input {
        grid-area: input;
    }

    .reading-page--grillo .grillo-write-head strong,
    .reading-page--grillo .grillo-device-input span,
    .reading-page--grillo .grillo-case-toggle {
        font-size: 0.58rem;
    }

    .reading-page--grillo .grillo-case-toggle {
        padding: 2px 5px;
        border-width: 1px;
    }

    .reading-page--grillo .grillo-device-input input {
        min-height: 48px;
        padding: 6px;
        border-width: 2px;
        font-size: 1.12rem;
    }

    .reading-page--grillo .grillo-result-panel {
        grid-area: result;
        min-height: 42px;
        padding: 6px;
        border-width: 2px;
        gap: 3px;
        font-size: 0.72rem;
    }

    .reading-page--grillo .grillo-result-panel > strong,
    .reading-page--grillo .grillo-result-panel .grillo-help strong,
    .reading-page--grillo .grillo-result-panel .grillo-feedback span {
        font-size: 0.78rem;
    }

    .reading-page--grillo .grillo-keyboard {
        gap: 4px;
    }

    .reading-page--grillo .grillo-keyboard-row {
        gap: 3px;
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }

    .reading-page--grillo .grillo-keyboard-row:nth-child(3) {
        width: 100%;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .reading-page--grillo .grillo-keyboard-row--actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reading-page--grillo .grillo-key {
        min-height: 27px;
        border-width: 2px;
        border-radius: 5px;
        font-size: 0.78rem;
    }

    .reading-page--grillo .grillo-key--action {
        font-size: 0.62rem;
    }

    .reading-page--grillo .grillo-bottom-strip {
        gap: 4px;
        padding: 0;
        font-size: 0.66rem;
    }

    .reading-page--grillo .grillo-bottom-strip .grillo-score strong {
        font-size: 0.8rem;
    }

    .reading-page--grillo .grillo-bottom-strip .grillo-reset {
        padding: 5px 8px;
        border-radius: 6px;
        font-size: 0.66rem;
    }

    .reading-page--grillo .grillo-options-panel {
        padding: 7px;
        border-width: 2px;
        max-height: none;
    }

    .reading-page--grillo .grillo-options-panel .reading-kicker {
        margin-bottom: 5px;
        font-size: 0.62rem;
    }

    .reading-page--grillo .grillo-difficulty-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
    }

    .reading-page--grillo .grillo-difficulty {
        min-height: 28px;
        padding: 2px 3px;
        border-width: 2px;
        font-size: 0.58rem;
    }
}

/* Grillo parlante: correzioni layout focus e ascolto diretto */
.reading-page--grillo .grillo-console-shell {
    width: min(980px, 100%);
    grid-template-columns: minmax(540px, 760px) minmax(150px, 190px);
    gap: 12px;
    align-items: start;
    justify-content: center;
}

.reading-page--grillo .grillo-options-panel {
    width: 100%;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border-width: 2px;
    align-self: start;
}

.reading-page--grillo .grillo-options-panel .reading-kicker {
    margin: 0 0 2px;
    white-space: normal;
    font-size: 0.72rem;
}

.reading-page--grillo .grillo-difficulty-list {
    grid-template-columns: 1fr;
    gap: 6px;
}

.reading-page--grillo .grillo-difficulty {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.7rem;
}

.reading-page--grillo .grillo-console {
    width: min(760px, 100%);
    padding: 10px 12px 14px;
}

.reading-page--grillo .grillo-handle {
    height: 44px;
    margin-bottom: 7px;
    border-width: 9px;
    border-bottom-width: 6px;
}

.reading-page--grillo .grillo-screen {
    min-height: 82px;
    grid-template-columns: 112px minmax(0, 1fr);
    padding: 10px 14px;
}

.reading-page--grillo .grillo-display {
    min-height: 60px;
}

.reading-page--grillo .grillo-display strong {
    font-size: clamp(1.35rem, 3.2vw, 2.2rem);
}

.reading-page--grillo .grillo-control-deck {
    margin: 10px 6px 0;
    padding: 9px;
    gap: 7px;
    border-width: 6px;
    outline-width: 6px;
}

.reading-page--grillo .grillo-command-row {
    gap: 6px;
    grid-auto-rows: 38px;
}

.reading-page--grillo .grillo-command,
.reading-page--grillo .grillo-command--listen {
    min-height: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 4px 8px;
    font-size: 0.78rem;
}

.reading-page--grillo .grillo-command--listen {
    background: #38c957;
    color: #fff;
}

.reading-page--grillo .grillo-voice-state {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 2px 8px;
    border: 1px solid rgba(100, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(100, 255, 255, 0.08);
    color: #bfffff;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reading-page--grillo .grillo-console[data-voice-state="thinking"] .grillo-voice-state {
    border-color: rgba(255, 194, 41, 0.72);
    background: rgba(255, 194, 41, 0.16);
    color: #ffe29a;
}

.reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-screen {
    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, 0.9),
        0 0 0 3px rgba(100, 255, 255, 0.2),
        0 0 24px rgba(100, 255, 255, 0.34);
}

.reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-voice-state {
    background: #64ffff;
    color: #042121;
    box-shadow: 0 0 16px rgba(100, 255, 255, 0.72);
}

.reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-speaker span {
    animation: grillo-speaker-pulse 680ms ease-in-out infinite alternate;
}

.reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-speaker span:nth-child(2n) {
    animation-delay: 160ms;
}

.reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-speaker span:nth-child(3n) {
    animation-delay: 320ms;
}

@keyframes grillo-speaker-pulse {
    from {
        opacity: 0.45;
        transform: scaleX(0.72);
    }

    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reading-page--grillo .grillo-console[data-voice-state="speaking"] .grillo-speaker span {
        animation: none;
    }
}

.reading-page--grillo .grillo-play-area {
    grid-template-columns: 154px minmax(0, 1fr) minmax(160px, 0.68fr);
    gap: 8px;
    padding: 8px;
}

.reading-page--grillo .grillo-picture-window {
    min-height: 142px;
    padding: 6px;
    overflow: hidden;
    background: var(--grillo-image-background, #fcf2da);
}

.reading-page--grillo .grillo-picture {
    display: contents;
}

.reading-page--grillo .grillo-picture-window span {
    width: 78px;
    height: 78px;
}

.reading-page--grillo .grillo-picture-window img {
    display: block;
    width: 100%;
    height: 132px;
    border-radius: 10px;
    object-fit: contain;
}

.reading-page--grillo .grillo-picture-window span:empty {
    width: 0;
    height: 0;
}

.reading-page--grillo .grillo-device-input input {
    min-height: 56px;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
}

.reading-page--grillo .grillo-result-panel {
    min-height: 72px;
    padding: 8px;
    font-size: 0.8rem;
}

.reading-page--grillo .grillo-result-panel .grillo-help strong,
.reading-page--grillo .grillo-result-panel .grillo-feedback span {
    font-size: 0.92rem;
}

.reading-page--grillo .grillo-keyboard,
.reading-page--grillo .grillo-keyboard-row {
    gap: 5px;
}

.reading-page--grillo .grillo-key {
    min-height: 32px;
    font-size: 0.95rem;
}

.reading-page--grillo .grillo-bottom-strip {
    padding-top: 0;
    font-size: 0.78rem;
}

@media (max-width: 700px) {
    .reading-page--grillo .grillo-console-shell {
        grid-template-columns: 1fr;
    }

    .reading-page--grillo .grillo-options-panel {
        width: 100%;
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 6px;
    }

    .reading-page--grillo .grillo-options-panel .reading-kicker {
        font-size: 0.58rem;
    }

    .reading-page--grillo .grillo-difficulty-list {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .reading-page--grillo .grillo-difficulty {
        min-height: 25px;
        padding: 2px 3px;
        font-size: 0.54rem;
    }

    .reading-page--grillo .grillo-command,
    .reading-page--grillo .grillo-command--listen {
        min-height: 30px;
        height: 30px;
        font-size: 0.56rem;
    }

}

/* Grillo parlante: selettore vista e workspace moderno */
.reading-page--grillo .grillo-view-control {
    display: grid;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(43, 29, 24, 0.12);
}

.reading-page--grillo .grillo-view-switch {
    width: 100%;
    min-height: 64px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    padding: 9px;
    border: 1px solid rgba(43, 29, 24, 0.16);
    border-radius: 12px;
    background: #fffaf0;
    color: #2b1d18;
    text-align: left;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.reading-page--grillo .grillo-view-switch:hover {
    border-color: #d32626;
    transform: translateY(-1px);
}

.reading-page--grillo .grillo-view-switch.is-active {
    border-color: #0d8060;
    background: #eaf9f3;
}

.reading-page--grillo .grillo-view-switch > span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.reading-page--grillo .grillo-view-switch strong {
    font-size: 0.78rem;
    line-height: 1.1;
}

.reading-page--grillo .grillo-view-switch small {
    color: #6f625c;
    font-size: 0.62rem;
    line-height: 1.25;
}

.reading-page--grillo .grillo-view-switch-icon {
    width: 34px;
    height: 34px;
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 3px;
    padding: 5px;
    border-radius: 9px;
    background: #2b1d18;
}

.reading-page--grillo .grillo-view-switch-icon span {
    border-radius: 3px;
    background: #ffde3a;
}

.reading-page--grillo .grillo-view-switch-icon span:last-child {
    background: #38c957;
}

.reading-page--grillo .grillo-console-shell,
.reading-page--grillo .grillo-console,
.reading-page--grillo .grillo-play-area,
.reading-page--grillo .grillo-picture-window {
    transition:
        width 240ms ease,
        max-width 240ms ease,
        grid-template-columns 240ms ease,
        padding 240ms ease,
        border-radius 240ms ease,
        background-color 240ms ease;
}

.reading-page--grillo .grillo-console-shell.is-modern {
    width: min(1280px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
    gap: 18px;
}

.reading-page--grillo .grillo-console.is-modern {
    width: 100%;
    max-width: none;
    padding: 10px 14px 12px;
    border: 1px solid rgba(23, 35, 49, 0.16);
    border-radius: 24px;
    background: #f4f1e9;
    box-shadow: 0 20px 48px rgba(45, 29, 20, 0.16);
}

.reading-page--grillo .grillo-console.is-modern .grillo-handle {
    width: 86px;
    height: 6px;
    margin-bottom: 7px;
    border: 0;
    border-radius: 999px;
    background: #d32626;
    box-shadow: none;
}

.reading-page--grillo .grillo-console.is-modern .grillo-screen {
    min-height: 76px;
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 8px 14px;
    border: 0;
    border-radius: 16px;
    background: #172331;
    box-shadow: none;
}

.reading-page--grillo .grillo-console.is-modern .grillo-display {
    min-height: 54px;
    justify-items: start;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    text-align: left;
}

.reading-page--grillo .grillo-console.is-modern .grillo-display strong {
    font-size: clamp(1.35rem, 2.5vw, 2.1rem);
    letter-spacing: 0.08em;
}

.reading-page--grillo .grillo-console.is-modern .grillo-control-deck {
    margin: 9px 0 0;
    padding: 10px;
    gap: 8px;
    border: 0;
    outline: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(23, 35, 49, 0.09);
}

.reading-page--grillo .grillo-console.is-modern .grillo-command-row {
    gap: 7px;
    grid-auto-rows: 36px;
}

.reading-page--grillo .grillo-console.is-modern .grillo-command {
    min-height: 36px;
    height: 36px;
    border-width: 1px;
    border-color: rgba(43, 29, 24, 0.22);
    border-radius: 10px;
    box-shadow: none;
}

.reading-page--grillo .grillo-console.is-modern .grillo-play-area {
    grid-template-columns: minmax(220px, 0.82fr) minmax(300px, 1.18fr);
    grid-template-rows: minmax(88px, 0.72fr) minmax(112px, 1.28fr);
    grid-template-areas:
        "picture input"
        "picture result";
    gap: 8px 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.reading-page--grillo .grillo-console.is-modern .grillo-picture-window {
    grid-area: picture;
    min-height: clamp(210px, 27vh, 260px);
    padding: 10px;
    overflow: hidden;
    border: 1px solid rgba(23, 35, 49, 0.12);
    border-radius: 16px;
    background: var(--grillo-image-background, #fcf2da);
}

.reading-page--grillo .grillo-console.is-modern .grillo-picture-window img {
    width: 100%;
    height: 100%;
    max-height: 250px;
    border-radius: 12px;
    object-fit: contain;
    animation: grillo-modern-picture-in 260ms ease-out;
}

.reading-page--grillo .grillo-console.is-modern .grillo-device-input {
    grid-area: input;
    align-self: stretch;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(23, 35, 49, 0.12);
    border-radius: 16px;
    background: #f9fafb;
}

.reading-page--grillo .grillo-console.is-modern .grillo-device-input input {
    min-height: 68px;
    height: 100%;
    padding: 10px 14px;
    border: 2px solid #172331;
    border-radius: 12px;
    background: #fff;
    font-size: clamp(1.55rem, 3.2vw, 2.5rem);
    box-shadow: none;
}

.reading-page--grillo .grillo-console.is-modern .grillo-result-panel {
    grid-area: result;
    min-height: 104px;
    padding: 12px;
    border: 1px solid rgba(23, 35, 49, 0.12);
    border-radius: 16px;
    background: #f9fafb;
    align-content: center;
    overflow: hidden;
}

.reading-page--grillo .grillo-console.is-modern .grillo-result-panel > strong {
    font-size: 1.15rem;
}

.reading-page--grillo .grillo-console.is-modern .grillo-result-panel .grillo-help strong,
.reading-page--grillo .grillo-console.is-modern .grillo-result-panel .grillo-feedback span {
    font-size: 1.12rem;
}

.reading-page--grillo .grillo-console.is-modern .grillo-keyboard {
    gap: 4px;
    padding-top: 0;
}

.reading-page--grillo .grillo-console.is-modern .grillo-keyboard-row {
    gap: 4px;
}

.reading-page--grillo .grillo-console.is-modern .grillo-key {
    min-height: 32px;
    border-width: 1px;
    border-radius: 7px;
    font-size: 0.92rem;
    box-shadow: none;
}

.reading-page--grillo .grillo-console.is-modern .grillo-key--action {
    font-size: 0.72rem;
}

.reading-page--grillo .grillo-console.is-modern .grillo-bottom-strip {
    min-height: 26px;
    padding: 0 2px;
}

@media (min-width: 701px) and (max-height: 820px) {
    .reading-page--grillo .grillo-console.is-modern .grillo-screen {
        min-height: 68px;
        padding-block: 6px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window {
        min-height: 190px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window img {
        max-height: 184px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-input input {
        min-height: 58px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel {
        min-height: 92px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-key {
        min-height: 28px;
    }
}

@keyframes grillo-modern-picture-in {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 980px) {
    .reading-page--grillo .grillo-console-shell.is-modern {
        grid-template-columns: 1fr;
    }

    .reading-page--grillo .grillo-console-shell.is-modern .grillo-options-panel {
        grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr);
        align-items: end;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-play-area {
        grid-template-columns: minmax(240px, 0.85fr) minmax(300px, 1.15fr);
    }
}

@media (max-width: 700px) {
    .reading-page--grillo .grillo-console.is-modern {
        padding: 10px;
        border-radius: 18px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-screen {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-control-deck {
        padding: 10px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 40px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-play-area {
        grid-template-columns: 1fr;
        grid-template-areas:
            "picture"
            "input"
            "result";
        gap: 10px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window {
        min-height: clamp(260px, 72vw, 360px);
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-input {
        padding: 12px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-input input {
        min-height: 76px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel {
        min-height: 96px;
        padding: 12px;
    }

    .reading-page--grillo .grillo-console-shell.is-modern .grillo-options-panel {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reading-page--grillo .grillo-console-shell,
    .reading-page--grillo .grillo-console,
    .reading-page--grillo .grillo-play-area,
    .reading-page--grillo .grillo-picture-window,
    .reading-page--grillo .grillo-view-switch {
        transition: none;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window img {
        animation: none;
    }
}

.reading-page--grillo .grillo-modern-image-actions,
.reading-page--grillo .grillo-keyboard-primary-actions,
.reading-page--grillo .grillo-mobile-view-toggle {
    display: none;
}

/* Grillo moderno mobile: console a viewport intero senza tastiera di sistema */
@media (max-width: 700px) {
    html.bp-grillo-modern-mobile,
    html.bp-grillo-modern-mobile body {
        width: 100%;
        height: 100%;
        overflow: hidden !important;
        overscroll-behavior: none;
    }

    .reading-page--grillo .grillo-console-shell.is-modern {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: block;
        width: 100vw;
        height: 100dvh;
        overflow: hidden;
        background: #ece8df;
    }

    .reading-page--grillo .grillo-console-shell.is-modern .grillo-options-panel {
        display: none;
    }

    .reading-page--grillo .grillo-console.is-modern {
        width: 100%;
        height: 100dvh;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 5px;
        padding: max(5px, env(safe-area-inset-top)) 6px max(5px, env(safe-area-inset-bottom));
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-handle,
    .reading-page--grillo .grillo-console.is-modern .grillo-speaker {
        display: none;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-screen {
        position: relative;
        min-height: 54px;
        grid-template-columns: 1fr;
        padding: 4px 44px;
        border-radius: 12px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-display {
        min-height: 46px;
        justify-items: center;
        align-content: center;
        gap: 1px;
        padding: 2px 6px;
        text-align: center;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-title {
        font-size: 0.58rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-display strong {
        font-size: clamp(1.15rem, 6vw, 1.65rem);
        line-height: 0.95;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-display small {
        font-size: 0.56rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-voice-state {
        min-height: 14px;
        padding: 1px 6px;
        font-size: 0.48rem;
    }

    .reading-page--grillo .grillo-mobile-view-toggle {
        position: absolute;
        top: 7px;
        right: 7px;
        z-index: 5;
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        padding: 6px;
        border: 2px solid rgba(255, 255, 255, 0.82);
        border-radius: 9px;
        background: #2b1d18;
        box-shadow: 0 2px 0 rgba(90, 0, 0, 0.3);
        touch-action: manipulation;
    }

    .reading-page--grillo .grillo-mobile-view-toggle svg,
    .reading-page--grillo .grillo-modern-image-action svg {
        width: 28px;
        height: 28px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.5;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .reading-page--grillo .grillo-mobile-view-toggle svg {
        stroke: #2b1d18;
        stroke-width: 1.2;
    }

    .reading-page--grillo .grillo-mobile-view-toggle .is-primary {
        fill: #ffde3a;
    }

    .reading-page--grillo .grillo-mobile-view-toggle .is-secondary {
        fill: #38c957;
    }

    .reading-page--grillo .grillo-mobile-view-toggle:active {
        transform: translateY(2px);
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-control-deck {
        min-height: 0;
        height: 100%;
        grid-template-rows: 40px minmax(0, 1fr) auto 28px;
        gap: 5px;
        margin: 0;
        padding: 5px;
        border-radius: 12px;
        overflow: hidden;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 40px;
        gap: 5px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command {
        min-height: 40px;
        height: 40px;
        font-size: 0.76rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command--check,
    .reading-page--grillo .grillo-console.is-modern .grillo-command--next {
        display: none;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-play-area {
        min-height: 0;
        grid-template-columns: minmax(112px, 0.9fr) minmax(0, 1.1fr);
        grid-template-rows: minmax(0, 1fr) 68px;
        grid-template-areas:
            "picture result"
            "input input";
        gap: 5px;
        overflow: hidden;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window {
        min-width: 0;
        min-height: 0;
        height: 100%;
        display: grid;
        grid-template-rows: minmax(0, 1fr);
        padding: 5px;
        border-radius: 11px;
        overflow: hidden;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-picture-window img {
        min-width: 0;
        min-height: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 8px;
        object-fit: contain;
    }

    .reading-page--grillo .grillo-modern-image-actions {
        display: none;
    }

    .reading-page--grillo .grillo-modern-image-action {
        min-width: 0;
        min-height: 52px;
        display: grid;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 9px;
        color: #fff;
    }

    .reading-page--grillo .grillo-modern-image-action.is-check {
        background: #d32626;
    }

    .reading-page--grillo .grillo-modern-image-action.is-next {
        background: #176fdb;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-input {
        min-height: 0;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 3px;
        padding: 6px;
        border-radius: 10px;
        overflow: hidden;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-write-head strong,
    .reading-page--grillo .grillo-console.is-modern .grillo-case-toggle {
        font-size: 0.52rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-case-toggle {
        padding: 2px 5px;
        border-width: 1px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-input input {
        min-height: 0;
        height: 100%;
        padding: 4px 7px;
        border-width: 1px;
        border-radius: 8px;
        font-size: clamp(1.05rem, 6vw, 1.65rem);
        caret-color: transparent;
        pointer-events: none;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel {
        min-height: 0;
        height: 100%;
        align-content: center;
        gap: 3px;
        padding: 6px;
        border-radius: 10px;
        overflow: hidden;
        font-size: 0.62rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel > strong,
    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel .grillo-help strong,
    .reading-page--grillo .grillo-console.is-modern .grillo-result-panel .grillo-feedback span {
        font-size: clamp(0.68rem, 3.1vw, 0.9rem);
        line-height: 1.12;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-keyboard {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
        min-height: 0;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-keyboard-row:not(.grillo-keyboard-row--actions) {
        display: contents;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-keyboard-primary-actions,
    .reading-page--grillo .grillo-console.is-modern .grillo-keyboard-row--actions {
        grid-column: 1 / -1;
        width: 100%;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-keyboard-row--actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-key {
        min-height: clamp(48px, 6.5dvh, 56px);
        border-radius: 9px;
        font-size: clamp(1.08rem, 5vw, 1.34rem);
        touch-action: manipulation;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-key:active {
        transform: translateY(2px);
    }

    .reading-page--grillo .grillo-keyboard-primary-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .reading-page--grillo .grillo-keyboard-primary-action {
        min-width: 0;
        min-height: 46px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 5px 10px;
        border: 2px solid #173447;
        border-radius: 8px;
        color: #fff;
        font-size: 0.76rem;
        font-weight: 900;
        text-transform: uppercase;
        box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
    }

    .reading-page--grillo .grillo-keyboard-primary-action svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 3;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .reading-page--grillo .grillo-keyboard-primary-action.is-check {
        background: #18a84b;
    }

    .reading-page--grillo .grillo-keyboard-primary-action.is-next {
        background: #176fdb;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-key--action {
        font-size: 0.74rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-bottom-strip {
        min-height: 24px;
        padding: 0 3px;
        font-size: 0.62rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-bottom-strip .grillo-score strong {
        font-size: 0.76rem;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-bottom-strip .grillo-reset {
        min-height: 28px;
        padding: 5px 9px;
        border-radius: 6px;
        font-size: 0.66rem;
    }
}

@media (max-width: 700px) and (max-height: 680px) {
    .reading-page--grillo .grillo-console.is-modern .grillo-screen {
        min-height: 48px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-device-title,
    .reading-page--grillo .grillo-console.is-modern .grillo-display small {
        display: none;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-control-deck {
        grid-template-rows: 30px minmax(0, 1fr) auto 22px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command-row {
        grid-auto-rows: 30px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-command {
        min-height: 34px;
        height: 34px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-play-area {
        grid-template-rows: minmax(0, 1fr) 58px;
    }

    .reading-page--grillo .grillo-console.is-modern .grillo-key {
        min-height: 38px;
        font-size: 0.94rem;
    }

    .reading-page--grillo .grillo-keyboard-primary-action {
        min-height: 38px;
        padding-block: 3px;
        font-size: 0.66rem;
    }
}

/* Grillo parlante: ogni vista resta interamente dentro il viewport */
html.bp-grillo-active,
html.bp-grillo-active body {
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
}

html.bp-grillo-active article.content {
    height: calc(100dvh - 76px);
    min-height: 0;
    margin-bottom: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

html.bp-grillo-active body.bp-focus-mode article.content {
    width: 100%;
    max-width: none;
    height: 100dvh;
    padding: 0 !important;
}

html.bp-grillo-active .topic-page {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

html.bp-grillo-active .topic-header {
    display: none;
}

html.bp-grillo-active .reading-page--grillo {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 8px !important;
    overflow: hidden;
}

html.bp-grillo-active .reading-page--grillo .grillo-console-shell {
    width: min(1180px, 100%);
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    overflow: hidden;
}

html.bp-grillo-active .reading-page--grillo .grillo-console {
    height: 100%;
    min-height: 0;
    max-height: 800px;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
}

html.bp-grillo-active .reading-page--grillo .grillo-control-deck {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    overflow: hidden;
}

html.bp-grillo-active .reading-page--grillo .grillo-play-area,
html.bp-grillo-active .reading-page--grillo .grillo-picture-window,
html.bp-grillo-active .reading-page--grillo .grillo-device-input,
html.bp-grillo-active .reading-page--grillo .grillo-result-panel {
    min-height: 0;
    overflow: hidden;
}

html.bp-grillo-active .reading-page--grillo .grillo-picture-window img {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
}

html.bp-grillo-active .reading-page--grillo .grillo-device-input input {
    height: 100%;
    min-height: 0;
}

html.bp-grillo-active .reading-page--grillo .grillo-options-panel {
    max-height: 100%;
    overflow: hidden;
}

@media (min-width: 701px) and (max-height: 700px) {
    html.bp-grillo-active .reading-page--grillo .grillo-console {
        padding-block: 8px 10px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-handle {
        display: none;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-screen {
        min-height: 68px;
        padding-block: 6px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-display {
        min-height: 52px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-control-deck {
        margin-top: 7px;
        padding: 7px;
        gap: 5px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-command-row {
        grid-auto-rows: 32px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-command,
    html.bp-grillo-active .reading-page--grillo .grillo-command--listen {
        min-height: 32px;
        height: 32px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-key {
        min-height: 26px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-bottom-strip {
        min-height: 22px;
    }
}

@media (max-width: 700px) {
    html.bp-grillo-active article.content {
        height: calc(100dvh - 76px);
    }

    html.bp-grillo-active body.bp-focus-mode article.content {
        height: 100dvh;
    }

    html.bp-grillo-active .reading-page--grillo {
        padding: 4px !important;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console-shell {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 4px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console {
        position: relative;
        width: 100%;
        height: 100%;
        max-height: none;
        padding: 6px;
        border-radius: 14px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-handle {
        height: 22px;
        margin-bottom: 3px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-screen {
        min-height: 52px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-control-deck {
        margin-top: 5px;
        padding: 5px;
        gap: 4px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-command-row .ap-idle-btn,
    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-command,
    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-command-row > .ap-idle-btn.ap-idle-btn--compact {
        min-height: 40px !important;
        height: 40px !important;
        font-size: 0.68rem !important;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-key {
        min-height: 38px;
        border-radius: 7px;
        font-size: 0.92rem;
        touch-action: manipulation;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-keyboard-row:nth-child(3) {
        grid-template-columns: repeat(10, minmax(0, 1fr));
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-key--action {
        font-size: 0.72rem;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console.is-classic .grillo-reset {
        min-height: 34px;
        padding-inline: 10px;
        font-size: 0.72rem;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-options-panel {
        min-height: 48px;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
        padding: 4px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-view-control {
        display: none;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-view-control .reading-kicker,
    html.bp-grillo-active .reading-page--grillo .grillo-options-panel > .reading-kicker,
    html.bp-grillo-active .reading-page--grillo .grillo-view-switch small {
        display: none;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-view-switch {
        min-height: 40px;
        grid-template-columns: 25px minmax(0, 1fr);
        gap: 5px;
        padding: 4px;
        border-radius: 8px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-view-switch-icon {
        width: 25px;
        height: 25px;
        padding: 4px;
        border-radius: 6px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-view-switch strong {
        font-size: 0.58rem;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-difficulty-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-self: center;
        gap: 3px;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-difficulty {
        min-height: 44px;
        padding: 2px;
        font-size: 0.58rem;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console-shell.is-modern {
        display: block;
        height: 100dvh;
    }

    html.bp-grillo-active .reading-page--grillo .grillo-console-shell.is-modern .grillo-options-panel {
        display: none;
    }
}
