.hw-studio,
.hw-play {
    color: #352521;
}

.hw-switch-shell,
.hw-studio {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
}

.hw-studio.hw-wizard {
    --hw-red: #C93632;
    --hw-red-deep: #A92B28;
    --hw-cream: #F6F1E6;
    --hw-surface: #FFFCF6;
    --hw-rose: #F4DDD7;
    --hw-sand: #E8DFCF;
    --hw-text: #302924;
    --hw-muted: #81766C;
    --hw-ok: #5F7A5A;
    --hw-ok-bg: #DDE5D5;
    /* Shared content rail so stepper, editor cards, and footer share one width. */
    --hw-wizard-rail: min(100%, 58rem);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: calc(100dvh - 1.1rem);
    padding: 0;
    overflow-x: clip;
    color: var(--hw-text);
}

.hw-wizard > .hw-page-head,
.hw-wizard > .hw-flow-steps,
.hw-wizard > .hw-layout,
.hw-wizard > .hw-flow-panel,
.hw-wizard > .hw-wizard-foot {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--hw-wizard-rail);
    margin-inline: auto;
}

.hw-studio.hw-switch-shell {
    padding-left: 0;
}

.hw-tabs {
    display: inline-flex;
    align-self: flex-start;
    justify-self: start;
    gap: 0.25rem;
    margin: 0 0 1.15rem;
    padding: 0.25rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #E9E1D8;
}

#hub-panel-platform:has(.hw-switch-shell),
#hub-panel:has(.hw-switch-shell),
#hub-panel-platform:has(.hw-studio),
#hub-panel:has(.hw-studio) {
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
}

/* Equal gap above/below the studio title (workspace pad would skew the top). */
.gc-workspace:has(.hw-studio),
.gc-workspace:has(.hw-switch-shell) {
    padding-top: 0;
}

.hw-tab {
    min-height: 40px;
    padding: 0.35rem 1rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #786962;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.hw-tab:hover {
    color: #E64618;
    background: #FFF5EA;
}

.hw-tab.is-current {
    background: #fff;
    color: #E64618;
    box-shadow: 0 1px 2px rgba(53, 37, 33, 0.06);
}

header.hw-page-head,
.hw-q > header {
    background: none;
    color: #352521;
    padding: 0;
    box-shadow: none;
}

header.hw-page-head {
    --hw-title-gap: 0.85rem;
    display: block;
    margin: 0.35rem 0 var(--hw-title-gap);
}

.hw-wizard header.hw-page-head {
    --hw-title-gap: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.hw-wizard header.hw-page-head > .hw-lib-back {
    align-self: flex-start;
    margin: 0 0 0.15rem;
}

.hw-wizard .hw-page-head-copy h2 {
    font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.55rem);
}

.hw-wizard .hw-page-head-actions .hw-head-draft {
    min-height: 2.4rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 10px;
    background: var(--hw-surface, #FFFCF6);
    color: var(--hw-red, #C93632);
    font-size: 0.9rem;
}

.hw-page-head-row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55rem 0.75rem;
    max-width: 100%;
    min-width: 0;
    padding-left: 0;
}

.hw-page-head-row > .hw-page-head-copy,
.hw-page-head-row > .hw-page-head-actions {
    margin-top: 0.15rem;
}

.hw-page-head-copy {
    min-width: 0;
    flex: 1 1 12rem;
}

.hw-page-head-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 1 auto;
    gap: 0.4rem;
    margin-left: 0;
    max-width: 100%;
}

.hw-page-head-actions .hw-head-draft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.95rem;
    border: none;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    color: #E64618;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
}

.hw-page-head-actions .hw-head-draft .hw-btn-ico {
    width: 1.25rem;
    height: 1.25rem;
}

.hw-page-head-actions .hw-head-draft .hw-btn-ico svg {
    width: 1.2rem;
    height: 1.2rem;
}

.hw-page-head-actions .hw-head-draft:hover:not(:disabled) {
    background: transparent;
    border: none;
    color: #D53E14;
}

.hw-page-head-actions .hw-head-draft:disabled {
    opacity: 0.4;
    cursor: default;
}

.hw-head-draft-status {
    margin: 0;
    padding: 0.55rem 0.85rem;
    border: 1px solid #C9E5D4;
    border-radius: 999px;
    background: #EEF8F1;
    color: #1E7A49;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;
}

.hw-head-draft-status[hidden] { display: none !important; }

.hw-head-draft-status.is-ok {
    border-color: #C9E5D4;
    background: #EEF8F1;
    color: #1E7A49;
}

.hw-head-draft-status.is-bad {
    border-color: #F3D0CB;
    background: #FFF7F6;
    color: #B3382C;
}

.hw-page-head-ico {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin-right: 0.55rem;
    vertical-align: -0.35rem;
    border-radius: 10px;
    background: #FFF1E6;
    color: #E07A55;
}

.hw-page-head-ico svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-lib-back {
    position: absolute;
    left: -3.15rem;
    top: 50%;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #E9E1D8;
    border-radius: 999px;
    background: #fff;
    color: #352521;
    box-shadow: 0 1px 2px rgba(53, 37, 33, 0.04);
    cursor: pointer;
    transform: translateY(-50%);
}

.hw-lib-back svg {
    width: 1.15rem;
    height: 1.15rem;
}

.hw-lib-back:hover {
    background: #FFF8F2;
    border-color: #E6B7A4;
    color: #E64618;
}

@media (max-width: 820px) {
    .hw-lib-back {
        position: static;
        transform: none;
        margin: 0 0.7rem 0 0;
    }

    .hw-page-head-row {
        align-items: center;
    }
}

.hw-page-head .hw-kicker {
    margin: 0 0 0.35rem;
    color: #E64618;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hw-page-head h2 {
    display: flex;
    align-items: center;
    margin: 0;
    color: #352521;
    font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hw-lead {
    margin: 0.35rem 0 0;
    max-width: 36rem;
    color: #786962;
    font-size: 0.9rem;
    line-height: 1.55;
}

.hw-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(0.9rem, 1.6vw, 1.35rem);
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.hw-wizard .hw-layout {
    flex: 1 1 auto;
    min-width: 0;
}

.hw-wizard .hw-flow-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.hw-composer,
.hw-sidepane,
.hw-card,
.hw-q,
.hw-dialog-card {
    background: #fff;
    border: 1px solid #E9E1D8;
    border-radius: 22px;
    box-shadow: 0 10px 28px rgba(53, 37, 33, 0.05);
}

.hw-composer,
.hw-sidepane {
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    overflow: visible;
}

.hw-section {
    padding: 1.2rem 1.25rem 1.15rem;
    border-bottom: 1px solid #F0E8DF;
}

.hw-section:last-child,
.hw-composer-foot {
    border-bottom: none;
}

.hw-section-head {
    margin-bottom: 0.95rem;
}

.hw-section-head-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.hw-section-head h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hw-sec-ico {
    display: inline-grid;
    place-items: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 10px;
    background: #FFF1E6;
    color: #C45E34;
    flex: 0 0 auto;
}

.hw-sec-ico svg {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-section-head p,
.hw-section-head small,
.hw-section-hint {
    margin: 0.2rem 0 0;
    color: #9A8B82;
    font-size: 0.8rem;
    font-weight: 600;
}

.hw-field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.hw-field-ico {
    display: inline-grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    color: #B08978;
}

.hw-field-ico svg {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-ico-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.hw-ico-only {
    width: 2.55rem;
    min-height: 2.55rem;
    padding: 0;
    gap: 0;
    overflow: hidden;
    transition: width 0.18s ease, padding 0.18s ease, gap 0.18s ease;
}

.hw-ico-only .hw-btn-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.18s ease, opacity 0.15s ease;
}

.hw-ico-only:hover,
.hw-ico-only:focus-visible {
    width: auto;
    padding: 0.35rem 0.85rem;
    gap: 0.4rem;
}

.hw-ico-only:hover .hw-btn-label,
.hw-ico-only:focus-visible .hw-btn-label {
    max-width: 8rem;
    opacity: 1;
}

.hw-btn-ico {
    display: inline-grid;
    place-items: center;
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}

.hw-btn-ico svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-fields {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(150px, 0.7fr) minmax(120px, 0.55fr);
    gap: 0.85rem 1rem;
    align-items: end;
}

.hw-fields-basic {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

.hw-section-basic {
    display: grid;
    gap: 1.35rem;
}

.hw-title-input {
    width: 100%;
    min-height: 3.1rem;
    margin: 0;
    padding: 0.7rem 1rem;
    border: 1.5px solid #E9E1D8;
    border-radius: 14px;
    background: #fff;
    color: #352521;
    font: inherit;
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hw-title-input:focus {
    outline: none;
    border-color: #E8B896;
    box-shadow: 0 0 0 3px rgba(226, 122, 85, 0.16);
}

.hw-fields-meta {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(120px, 0.55fr);
    gap: 0.85rem 1rem;
    align-items: end;
    justify-content: start;
}

.hw-field,
.hw-checkline,
.hw-q label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    font-weight: 800;
    font-size: 0.86rem;
    color: #5C4B45;
}

.hw-field-hint {
    margin: 0;
    color: #9A8176;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
}

.hw-checkline {
    flex-direction: row;
    align-items: center;
    width: max-content;
    max-width: 100%;
    gap: 0.55rem;
    margin-top: 0.35rem;
    cursor: pointer;
}

.hw-composer input[type="text"],
.hw-composer input[type="number"],
.hw-composer input[type="date"],
.hw-composer select,
.hw-composer textarea,
.hw-dialog textarea,
.hw-q input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0.7rem 0.85rem;
    border: 1px solid #E9E1D8;
    border-radius: 14px;
    background: #FFFcf8;
    color: inherit;
    font: inherit;
    font-weight: 500;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.hw-composer input:hover,
.hw-composer select:hover,
.hw-composer textarea:hover,
.hw-dialog textarea:hover {
    border-color: #DCCFBF;
}

.hw-composer input:focus,
.hw-composer select:focus,
.hw-composer textarea:focus,
.hw-dialog textarea:focus,
.hw-q input:focus {
    outline: none;
    border-color: #E64618;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(230, 70, 24, 0.14);
}

.hw-words {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#hw-words {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hw-word-head,
.hw-word {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) 44px;
    gap: 0.65rem;
    align-items: center;
}

.hw-word-head {
    padding: 0 0.2rem;
    color: #9A8B82;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.hw-word {
    padding: 0.35rem;
    border: 1px solid #F0E8DF;
    border-radius: 16px;
    background: #FFFCF9;
    transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.hw-word.is-dragging {
    opacity: 0.55;
}

.hw-word.is-drop {
    border-color: #E8B896;
    box-shadow: 0 0 0 2px rgba(226, 122, 85, 0.18);
}

.hw-word-drag {
    display: grid;
    place-items: center;
    width: 36px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #B7A79C;
    cursor: grab;
    touch-action: none;
}

.hw-word-drag:active {
    cursor: grabbing;
}

.hw-word-drag svg {
    width: 1rem;
    height: 1rem;
}

.hw-word-shuffle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.2rem 0.65rem;
    align-items: start;
    margin: 0.15rem 0 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid #F0E8DF;
    border-radius: 14px;
    background: #FFFCF9;
    color: #5C4B45;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
}

.hw-word-shuffle input {
    margin: 0.15rem 0 0;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #E07A55;
}

.hw-word-shuffle span {
    grid-column: 2;
}

.hw-word-shuffle small {
    grid-column: 2;
    color: #9A8176;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.4;
}

.hw-word-x {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #9A8B82;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.hw-word-x svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-word-x:hover {
    background: #FFF1EE;
    border-color: #F3D0C8;
    color: #D94B48;
}

.hw-add-word {
    width: 100%;
    justify-content: center;
}

.hw-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.hw-type-card {
    position: relative;
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin: 0;
    padding: 0.8rem 0.9rem;
    border: 1.5px solid #E9E1D8;
    border-radius: 16px;
    background: #FFFcf8;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.hw-type-card .hw-type-copy small { display: none; }

.hw-type-card:hover {
    border-color: #E6B7A4;
    background: #fff;
    transform: translateY(-1px);
}

.hw-type-card:has(input:checked) {
    box-shadow: 0 0 0 3px rgba(230, 70, 24, 0.08);
}

.hw-type-card.is-mcq:has(input:checked) { border-color: #E8A78A; background: #FFF5EF; }
.hw-type-card.is-match:has(input:checked) { border-color: #8EB6E0; background: #F3F8FD; }
.hw-type-card.is-spell:has(input:checked) { border-color: #8EC9A8; background: #F2FAF5; }
.hw-type-card.is-sentence:has(input:checked) { border-color: #B5A6E0; background: #F7F4FD; }

.hw-type-card:has(input:focus-visible) {
    outline: 2px solid #E64618;
    outline-offset: 2px;
}

.hw-type-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hw-type-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 12px;
    background: #fff;
    color: #E64618;
    border: 1px solid #F0E0D5;
}

.hw-type-icon svg {
    width: 1.15rem;
    height: 1.15rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-type-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.hw-type-copy strong {
    font-size: 0.98rem;
    font-weight: 800;
    color: #352521;
}

.hw-type-copy small {
    color: #786962;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.35;
}

.hw-flow-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0.35rem 0 1.25rem;
    padding: 0.35rem 0.15rem 0.5rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.hw-flow-step {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--hw-muted, #81766C);
    font: inherit;
    text-align: center;
    cursor: pointer;
}

.hw-flow-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 1.05rem;
    left: calc(50% + 1.15rem);
    right: calc(-50% + 1.15rem);
    height: 2px;
    background: var(--hw-sand, #E8DFCF);
    pointer-events: none;
}

.hw-flow-step.is-done:not(:last-child)::after,
.hw-flow-step.is-current:not(:last-child)::after {
    background: #9BB59A;
}

.hw-flow-step.is-current:not(:last-child)::after {
    background: linear-gradient(90deg, #9BB59A 0%, var(--hw-sand, #E8DFCF) 100%);
}

.hw-flow-step:hover:not(:disabled) {
    color: var(--hw-text, #302924);
}

.hw-flow-step.is-current {
    color: var(--hw-red, #C93632);
    background: transparent;
    box-shadow: none;
}

.hw-flow-step.is-done {
    color: var(--hw-ok, #5F7A5A);
    background: transparent;
}

.hw-flow-step.is-locked,
.hw-flow-step:disabled {
    opacity: 0.55;
    cursor: default;
}

.hw-flow-num {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    background: #D9D0C4;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
}

.hw-flow-num em {
    font-style: normal;
}

.hw-flow-step.is-current .hw-flow-num {
    background: var(--hw-red, #C93632);
}

.hw-flow-step.is-done .hw-flow-num {
    background: #6F9B72;
}

.hw-flow-step.is-done .hw-flow-num em {
    display: none;
}

.hw-flow-mark {
    display: none;
    place-items: center;
    width: 1rem;
    height: 1rem;
    color: #fff;
}

.hw-flow-step.is-done .hw-flow-mark:not(:empty) {
    display: grid;
}

.hw-flow-mark svg {
    width: 0.95rem;
    height: 0.95rem;
}

.hw-flow-label {
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.25;
}

.hw-flow-ico,
.hw-flow-copy {
    display: none;
}

.hw-flow-panel {
    margin: 0 0 1rem;
}

.hw-flow-panel[hidden] { display: none !important; }

.hw-flow-card {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 14px;
    background: var(--hw-surface, #FFFCF6);
    box-shadow: none;
}

.hw-options-section {
    background: var(--hw-surface, #FFFCF6);
}

.hw-assign-banner {
    margin: 0 0 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--hw-rose, #F4DDD7);
    color: var(--hw-text, #302924);
}

.hw-assign-banner strong {
    display: block;
    color: var(--hw-red, #C93632);
    font-size: 0.95rem;
}

.hw-assign-banner p {
    margin: 0.25rem 0 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.86rem;
    font-weight: 600;
}

.hw-wizard-foot {
    position: sticky;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex: none;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: auto 0 0;
    padding: 0.75rem clamp(0.75rem, 1.5vw, 1.15rem);
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 14px 14px 0 0;
    background: rgba(255, 252, 246, 0.96);
    backdrop-filter: blur(8px);
    box-shadow: 0 -8px 24px rgba(48, 41, 36, 0.06);
}

.hw-wizard-foot-step {
    margin: 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.86rem;
    font-weight: 700;
}

.hw-wizard-foot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
}

.hw-wizard-foot-actions > * {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.hw-wizard-foot .hw-primary {
    background: var(--hw-red, #C93632);
    border-radius: 10px;
    min-height: 2.55rem;
    padding: 0 1.1rem;
}

.hw-wizard-foot .hw-primary:hover {
    background: var(--hw-red-deep, #A92B28);
}

.hw-wizard-foot .hw-primary.is-needed {
    box-shadow: 0 8px 18px rgba(224, 122, 85, 0.28);
}

.hw-wizard-foot .hw-primary.is-retry-voice {
    background: #E64618;
    border-color: #E64618;
    box-shadow: 0 8px 18px rgba(230, 70, 24, 0.22);
}

.hw-wizard-foot .hw-primary.is-retry-voice:hover:not(:disabled) {
    background: #D53E14;
}

.hw-wizard-foot .hw-quiet {
    min-height: 2.55rem;
    border-radius: 10px;
    border: 1px solid var(--hw-sand, #E8DFCF);
    background: var(--hw-cream, #F6F1E6);
    color: var(--hw-text, #302924);
}

.hw-lib-back.hw-lib-back-text {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    height: auto;
    min-height: 2rem;
    margin: 0;
    padding: 0.28rem 0.8rem 0.28rem 0.5rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 999px;
    background: var(--hw-surface, #FFFCF6);
    box-shadow: 0 1px 2px rgba(48, 41, 36, 0.04);
    transform: none;
    color: var(--hw-text, #302924);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.hw-lib-back.hw-lib-back-text .hw-lib-back-ico {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: var(--hw-cream, #F6F1E6);
    color: var(--hw-red, #C93632);
    transition: transform 160ms ease, background 160ms ease;
}

.hw-lib-back.hw-lib-back-text:hover {
    color: var(--hw-red, #C93632);
    background: #FFF8F2;
    border-color: #E6B7A4;
    box-shadow: 0 2px 8px rgba(169, 43, 40, 0.08);
}

.hw-lib-back.hw-lib-back-text:hover .hw-lib-back-ico {
    background: var(--hw-rose, #F4DDD7);
    transform: translateX(-2px);
}

.hw-lib-back.hw-lib-back-text:focus-visible {
    outline: 2px solid var(--hw-red, #C93632);
    outline-offset: 2px;
}

.hw-lib-back.hw-lib-back-text svg {
    width: 0.95rem;
    height: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
    .hw-lib-back.hw-lib-back-text,
    .hw-lib-back.hw-lib-back-text .hw-lib-back-ico {
        transition: none;
    }
}

.hw-confirm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.hw-confirm-card {
    display: grid;
    gap: 0.55rem;
    align-content: start;
    padding: 1rem 1.05rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 14px;
    background: var(--hw-surface, #FFFCF6);
}

.hw-confirm-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.hw-confirm-card-head h4 {
    margin: 0;
    font-size: 0.95rem;
}

.hw-confirm-edit {
    border: 0;
    background: transparent;
    color: var(--hw-red, #C93632);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-confirm-title {
    font-size: 1.05rem;
}

.hw-confirm-level {
    display: inline-flex;
    width: fit-content;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--hw-ok-bg, #DDE5D5);
    color: var(--hw-ok, #5F7A5A);
    font-size: 0.75rem;
    font-weight: 800;
}

.hw-confirm-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.hw-confirm-stats span {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.25rem 0.65rem;
    border-radius: 10px;
    background: var(--hw-cream, #F6F1E6);
    color: var(--hw-text, #302924);
    font-size: 0.8rem;
    font-weight: 800;
}

.hw-confirm-stats span.is-ok {
    background: var(--hw-ok-bg, #DDE5D5);
    color: var(--hw-ok, #5F7A5A);
}

.hw-confirm-audio-note {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.15rem 0 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.82rem;
    font-weight: 700;
}

.hw-confirm-audio-note.is-ok {
    color: var(--hw-ok, #5F7A5A);
}

.hw-confirm-audio-note svg {
    width: 1rem;
    height: 1rem;
}

.hw-confirm-dl {
    display: grid;
    gap: 0.55rem;
    margin: 0;
}

.hw-confirm-dl div {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
}

.hw-confirm-dl dt {
    margin: 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-confirm-dl dd {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.hw-confirm-recipients {
    margin: 0.25rem 0 0;
    color: var(--hw-red, #C93632);
    font-size: 0.84rem;
    font-weight: 700;
}

.hw-assign-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.55rem;
}

.hw-assign-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-assign-pill.is-class {
    background: var(--hw-rose, #F4DDD7);
    color: var(--hw-red-deep, #A92B28);
}

.hw-assign-pill.is-people {
    background: var(--hw-cream, #F6F1E6);
    color: var(--hw-text, #302924);
}

.hw-assign-due-hint {
    margin: 0.4rem 0 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.8rem;
    font-weight: 600;
}

.hw-assign-summary-card {
    padding: 0.9rem 0.95rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 14px;
    background: var(--hw-surface, #FFFCF6);
}

.hw-assign-pane-summary {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

.hw-option-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
}

.hw-option-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1.5px solid #E8D0BC;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(196, 94, 52, 0.05);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hw-option-card:hover {
    border-color: #E0B89E;
    box-shadow: 0 6px 14px rgba(196, 94, 52, 0.08);
}

.hw-option-kicker {
    color: #C45E34;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.hw-option-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.hw-option-row input[type="checkbox"],
.hw-class-card input[type="checkbox"],
.hw-hub .hw-select-all input[type="checkbox"],
.hw-hub .hw-card-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 1.2rem;
    height: 1.2rem;
    min-width: 1.2rem;
    min-height: 1.2rem;
    margin: 0;
    padding: 0;
    border: 2px solid #C4B8AE;
    border-radius: 50%;
    background: #fff;
    color: #fff;
    cursor: pointer;
    vertical-align: middle;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hw-option-row input[type="checkbox"]:hover,
.hw-class-card input[type="checkbox"]:hover,
.hw-hub .hw-select-all input[type="checkbox"]:hover,
.hw-hub .hw-card-check input[type="checkbox"]:hover {
    border-color: #E07A55;
}

.hw-option-row input[type="checkbox"]:checked,
.hw-class-card input[type="checkbox"]:checked,
.hw-hub .hw-select-all input[type="checkbox"]:checked,
.hw-hub .hw-card-check input[type="checkbox"]:checked {
    border-color: #E07A55;
    background: #E07A55
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5 9.5 17 19 7.5'/%3E%3C/svg%3E")
        center / 0.78rem 0.78rem no-repeat;
}

.hw-hub .hw-select-all input[type="checkbox"]:checked,
.hw-hub .hw-card-check input[type="checkbox"]:checked {
    border-color: #E64618;
    background-color: #E64618;
}

.hw-option-row input[type="checkbox"]:focus-visible,
.hw-class-card input[type="checkbox"]:focus-visible,
.hw-hub .hw-select-all input[type="checkbox"]:focus-visible,
.hw-hub .hw-card-check input[type="checkbox"]:focus-visible {
    outline: 2px solid #E07A55;
    outline-offset: 2px;
}

.hw-option-text {
    color: #352521;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
}

.hw-option-select,
.hw-composer .hw-option-select {
    grid-column: 2;
    width: 100%;
    max-width: 22rem;
    min-height: 2.6rem;
    padding: 0.55rem 0.8rem;
    border: 1.5px solid #E5C8B4;
    border-radius: 12px;
    background: #FFF8F1;
    color: #352521;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
}

.hw-option-note {
    grid-column: 2;
    color: #8A7468;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .hw-option-select,
    .hw-composer .hw-option-select {
        max-width: none;
    }

    .hw-option-text,
    .hw-option-note {
        white-space: normal;
    }
}

.hw-class-tools {
    display: grid;
    gap: 0.55rem;
}

.hw-class-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.55rem;
    padding: 0.35rem 0.8rem 0.35rem 2.35rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 12px;
    background: var(--hw-cream, #F6F1E6);
}

.hw-class-search-ico {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    display: grid;
    place-items: center;
    color: var(--hw-muted, #81766C);
    transform: translateY(-50%);
    pointer-events: none;
}

.hw-class-search:focus-within {
    border-color: var(--hw-red, #C93632);
    box-shadow: 0 0 0 3px rgba(201, 54, 50, 0.12);
    background: #fff;
}

.hw-class-search input {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: #352521;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
}

.hw-class-search input:focus {
    outline: none;
}

.hw-class-search input::placeholder {
    color: #B79B8C;
    font-weight: 650;
}

.hw-class-scope {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hw-class-scope[hidden] {
    display: none !important;
}

.hw-class-scope button {
    min-height: 2rem;
    padding: 0.25rem 0.8rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 999px;
    background: var(--hw-cream, #F6F1E6);
    color: var(--hw-muted, #81766C);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-class-scope button[aria-pressed="true"] {
    border-color: #E5C4BA;
    background: var(--hw-rose, #F4DDD7);
    color: var(--hw-red-deep, #A92B28);
}

.hw-classes {
    display: grid;
    align-content: start;
    gap: 0.65rem;
    max-height: min(52vh, 28rem);
    overflow: auto;
    padding-right: 0.15rem;
}

.hw-class-day {
    display: grid;
    grid-template-columns: 4.4rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.hw-class-day-mark {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.05rem;
    min-height: 4.6rem;
    padding: 0.45rem 0.2rem;
    border: 1px solid #EADCCF;
    border-radius: 16px;
    background: #fff;
    color: #9A7B68;
    font-size: 0.72rem;
    font-weight: 800;
}

.hw-class-day-mark strong {
    color: #3B2C26;
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 800;
}

.hw-class-day.is-today .hw-class-day-mark {
    border-color: #E64618;
    background: #E64618;
    color: #fff;
}

.hw-class-day.is-today .hw-class-day-mark strong {
    color: #fff;
}

.hw-class-day-list {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.hw-class-day-kicker {
    margin: 0;
    color: #C45E34;
    font-size: 0.75rem;
    font-weight: 800;
}

.hw-class-empty,
.hw-class-past-note {
    margin: 0;
    color: #9A7B68;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.45;
}

.hw-class-empty {
    padding: 0.9rem 1rem;
    border: 1px dashed #E5D0BF;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.hw-assign-card {
    gap: 1rem;
}

.hw-assign-grid {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.95fr);
    gap: clamp(0.75rem, 1.4vw, 1.15rem);
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.hw-assign-pane {
    display: grid;
    gap: 0.7rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 14px;
    background: var(--hw-surface, #FFFCF6);
    min-height: 0;
}

.hw-assign-pane-classes {
    min-height: 18rem;
}

.hw-assign-pane-summary {
    padding: 0;
    border: 0;
    background: transparent;
    gap: 0.75rem;
}

.hw-assign-pane-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.hw-assign-pane-head h4 {
    margin: 0;
    color: var(--hw-text, #302924);
    font-size: 0.95rem;
    font-weight: 800;
}

.hw-assign-pane-head p {
    margin: 0;
    color: var(--hw-muted, #81766C);
    font-size: 0.78rem;
    font-weight: 700;
}

.hw-assign-students-head {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}


.hw-class-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hw-class-card:hover {
    border-color: #D5C4B0;
    background: #FFF9F4;
}

.hw-class-card.is-on {
    border-color: var(--hw-red, #C93632);
    background: var(--hw-rose, #F4DDD7);
    box-shadow: none;
}

.hw-class-card input[type="checkbox"] {
    flex: 0 0 auto;
}

.hw-class-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.1rem 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.hw-class-when,
.hw-class-teacher {
    grid-column: 1;
}

.hw-class-when {
    color: var(--hw-red, #C93632);
    font-size: 0.76rem;
    font-weight: 800;
}

.hw-class-teacher {
    color: #9A7B68;
    font-size: 0.75rem;
    font-weight: 700;
}

.hw-class-card-body strong {
    grid-column: 1;
    color: #352521;
    font-size: 0.95rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.hw-class-card-body small {
    grid-column: 2;
    grid-row: 1 / span 3;
    flex: 0 0 auto;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(53, 37, 33, 0.06);
    color: #8A7468;
    font-size: 0.75rem;
    font-weight: 800;
}

.hw-class-card.is-on .hw-class-card-body small {
    background: rgba(224, 122, 85, 0.16);
    color: #C45E34;
}

.hw-assign-due {
    margin: 0;
}

.hw-assign-due input[type="date"] {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--hw-sand, #E8DFCF);
    border-radius: 10px;
    background: #fff;
    color: var(--hw-text, #302924);
    font: inherit;
    font-weight: 700;
}

.hw-assign-due input[type="date"]:focus {
    outline: none;
    border-color: var(--hw-red, #C93632);
    box-shadow: 0 0 0 3px rgba(201, 54, 50, 0.12);
}

.hw-wizard .hw-primary {
    background: var(--hw-red, #C93632);
    border-radius: 10px;
}

.hw-wizard .hw-primary:hover:not(:disabled) {
    background: var(--hw-red-deep, #A92B28);
}

.hw-wizard .hw-class-day-mark {
    display: none;
}

.hw-wizard .hw-class-day {
    grid-template-columns: minmax(0, 1fr);
}

.hw-wizard .hw-class-day-kicker {
    margin: 0 0 0.35rem;
    color: var(--hw-muted, #81766C);
    font-size: 0.75rem;
    font-weight: 800;
}

.hw-assign-due-label {
    font-size: 0.82rem;
}

.hw-assign-students {
    display: grid;
    gap: 0.7rem;
    max-height: 22rem;
    overflow: auto;
    padding-right: 0.15rem;
}

.hw-assign-students-empty,
.hw-assign-students-loading {
    margin: 0;
    padding: 0.9rem 1rem;
    border: 1px dashed #E5D0BF;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
    color: #9A7B68;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.45;
}

.hw-student-group {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #EADCCF;
    border-radius: 16px;
    background: #fff;
}

.hw-student-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.hw-student-group-head strong {
    color: #3B2C26;
    font-size: 0.88rem;
    font-weight: 800;
}

.hw-student-group-head span {
    color: #C45E34;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-student-list {
    list-style: none;
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.hw-student-chip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
    border-radius: 12px;
    background: #FFF8F1;
}

.hw-student-avatar {
    display: grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: #E07A55;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-student-name {
    color: #352521;
    font-size: 0.88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.hw-student-index {
    color: #B29A8A;
    font-size: 0.72rem;
    font-weight: 800;
}

@container hub-main (max-width: 920px) {
    .hw-assign-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .hw-assign-grid,
    .hw-confirm-grid {
        grid-template-columns: 1fr;
    }

    .hw-flow-label {
        font-size: 0.68rem;
    }

    .hw-wizard-foot {
        flex-wrap: wrap;
    }

    .hw-assign-pane {
        min-height: 0;
    }
}

.hw-confirm-summary {
    padding: 0.2rem 0;
}

.hw-summary-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
}

.hw-summary-list > div {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding: 0.7rem 0.85rem;
    border: 1px solid #F0E8DF;
    border-radius: 14px;
    background: #FFFCF8;
}

.hw-summary-list dt {
    margin: 0;
    color: #9A7B68;
    font-size: 0.8rem;
    font-weight: 800;
}

.hw-summary-list dd {
    margin: 0;
    color: #352521;
    font-size: 0.95rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .hw-flow-steps {
        display: flex;
        gap: 0.15rem;
        overflow-x: auto;
    }

    .hw-flow-step {
        flex: 1 0 auto;
        min-width: 3.5rem;
    }

    .hw-flow-step:not(:last-child)::after {
        display: none;
    }

    .hw-summary-list > div {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
}

.hw-composer-foot {
    padding: 1.1rem 1.25rem 1.2rem;
    background: #fff;
    border-top: 1px solid #F0E8DF;
}

.hw-actions,
.hw-row,
.hw-tools .hw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.hw-actions-inline {
    flex: none;
}

.hw-actions-foot {
    justify-content: flex-end;
    margin-top: 0.85rem;
}

#hw-flow-assign .hw-actions-foot > button,
#hw-flow-confirm .hw-actions-foot > button {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 12.5rem;
    width: 12.5rem;
    padding-inline: 0.85rem;
    white-space: nowrap;
}

#hw-lesson-text {
    min-height: 6.5rem;
    line-height: 1.55;
    resize: vertical;
}

#hw-lesson-status:not([hidden]) {
    margin-top: 0.55rem;
}

.hw-type-picker {
    display: grid;
    gap: 0.8rem;
    margin-top: 0;
    padding-top: 1.15rem;
    border-top: 1px solid #EFE4DA;
}

.hw-type-picker-head {
    margin: 0;
}

.hw-type-picker-head p {
    margin: 0.28rem 0 0;
}

.hw-type-toggles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.hw-type-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin: 0;
    padding: 0.72rem 0.85rem;
    border: 1.5px solid #E9E1D8;
    border-radius: 16px;
    background: #FFFcf8;
    cursor: pointer;
    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.hw-type-toggle:hover {
    border-color: #E6B7A4;
    background: #fff;
    transform: translateY(-1px);
}

.hw-type-toggle-copy {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.hw-type-toggle-copy strong {
    color: #3D2F28;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
}

.hw-type-toggle-copy small {
    color: #8A7468;
    font-size: 0.74rem;
    font-weight: 650;
    line-height: 1.35;
}

.hw-type-toggle input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
    white-space: nowrap;
}

.hw-type-switch {
    position: relative;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 1.55rem;
    border-radius: 999px;
    background: #E3D5C8;
    box-shadow: inset 0 1px 2px rgba(61, 47, 40, 0.08);
    transition: background 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-type-switch-knob {
    position: absolute;
    top: 0.16rem;
    left: 0.16rem;
    width: 1.22rem;
    height: 1.22rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(53, 37, 33, 0.16);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-type-toggle:has(input:checked) {
    border-color: #F0B5A4;
    background: #FFF8F5;
    box-shadow: 0 0 0 3px rgba(230, 70, 24, 0.08);
}

.hw-type-toggle:has(input:checked) .hw-type-switch {
    background: #E64618;
}

.hw-type-toggle:has(input:checked) .hw-type-switch-knob {
    transform: translateX(1.18rem);
}

.hw-type-toggle:has(input:focus-visible) {
    outline: none;
    box-shadow: 0 0 0 4px rgba(230, 70, 24, 0.16);
}

.hw-type-toggle.is-mcq:has(input:checked) .hw-type-switch { background: #E64618; }
.hw-type-toggle.is-match:has(input:checked) .hw-type-switch { background: #2F8F6B; }
.hw-type-toggle.is-spell:has(input:checked) .hw-type-switch { background: #C9851A; }
.hw-type-toggle.is-sentence:has(input:checked) .hw-type-switch { background: #3B6FBF; }

@media (max-width: 640px) {
    .hw-type-toggles {
        grid-template-columns: minmax(0, 1fr);
    }
}

.hw-flow-status {
    margin: 0.85rem 0 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid #EADCCF;
    border-radius: 16px;
    background: #FFFCF8;
    color: #5C463C;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.45;
}

.hw-flow-status[hidden] { display: none !important; }

.hw-flow-status.is-ok {
    border-color: #C9E5D4;
    background: #EEF8F1;
    color: #1E7A49;
}

.hw-flow-status.is-bad {
    border-color: #F3D0CB;
    background: #FFF7F6;
    color: #B3382C;
}

.hw-draft-note {
    margin: 0.55rem 0 0;
    color: #9A8176;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: right;
}

.hw-draft-label {
    display: inline;
}

.hw-actions button,
.hw-row button,
.hw-check,
.hw-next,
.hw-speaker,
.hw-choice,
.hw-pair,
.hw-tile {
    min-height: 48px;
    border-radius: 14px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.hw-primary,
.hw-check {
    border: none;
    background: #E64618;
    color: #fff;
    box-shadow: 0 8px 18px rgba(230, 70, 24, 0.22);
}

.hw-primary:hover:not(:disabled),
.hw-check:hover:not(:disabled) {
    background: #D53E14;
    transform: translateY(-1px);
}

.hw-quiet,
.hw-text,
.hw-speaker {
    border: 1px solid #E9E1D8;
    background: #fff;
    color: #352521;
}

.hw-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 12px;
    font: inherit;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(48, 41, 36, 0.04);
}

.hw-preview-btn .hw-preview-label {
    font: inherit;
    font-family: inherit;
    font-weight: 800;
}

.hw-preview-ico {
    display: inline-grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    color: inherit;
}

.hw-preview-ico svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none !important;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-preview-ico svg path,
.hw-preview-ico svg circle {
    fill: none !important;
    stroke: currentColor;
}

.hw-preview-ico[hidden] { display: none !important; }

.hw-word-bar-top #hw-preview {
    flex: 0 0 auto;
    align-self: center;
    margin-left: auto;
    white-space: nowrap;
}

.hw-quiet:hover:not(:disabled),
.hw-text:hover:not(:disabled) {
    background: #FFF8F2;
    border-color: #E6B7A4;
    color: #E64618;
}

.hw-primary:disabled,
.hw-quiet:disabled,
.hw-check:disabled,
.hw-choice:disabled,
.hw-pair:disabled:not(.is-done),
.hw-tile:disabled,
.hw-next:disabled {
    cursor: default;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.hw-help,
.hw-note,
.hw-flag {
    margin: 0;
    color: #786962;
    font-size: 0.9rem;
    line-height: 1.5;
}

.hw-status {
    min-height: 1.35em;
    margin: 0;
    font-weight: 800;
}

.hw-status.is-ok { color: #1E7A49; }
.hw-status.is-bad { color: #B3382C; }

.hw-side-status {
    margin: 0 0 0.55rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #EADCCF;
    border-radius: 16px;
    background: #FFFCF8;
    color: #5C463C;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.45;
}

.hw-side-status[hidden] { display: none !important; }

.hw-side-status.is-ok {
    border-color: #C9E5D4;
    background: #EEF8F1;
    color: #1E7A49;
}

.hw-side-status.is-bad {
    border-color: #F3D0CB;
    background: #FFF7F6;
    color: #B3382C;
}

.hw-voice-panel {
    display: grid;
    gap: 0.2rem;
    margin: 0 0 0.15rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #F0DCC4;
    border-radius: 16px;
    background: #FFF6E8;
    color: #8A5A00;
}

.hw-voice-panel[hidden] { display: none !important; }

.hw-voice-panel.is-busy {
    border-color: #F0DCC4;
    background: #FFF6E8;
    color: #8A5A00;
}

.hw-voice-panel.is-ok {
    border-color: #C9E5D4;
    background: #EEF8F1;
    color: #1E7A49;
}

.hw-voice-panel.is-bad {
    border-color: #F3D0CB;
    background: #FFF7F6;
    color: #B3382C;
}

.hw-voice-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.hw-voice-panel-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

.hw-voice-stop {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.15rem;
    height: 2.15rem;
    margin: 0;
    padding: 0;
    border: 1px solid #E0B89E;
    border-radius: 10px;
    background: #fff;
    color: #C45E34;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.hw-voice-stop svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: currentColor;
    stroke: none;
}

.hw-voice-stop:hover:not(:disabled) {
    background: #FFF0E8;
    border-color: #D46845;
    color: #B3382C;
}

.hw-voice-stop:active:not(:disabled) {
    transform: scale(0.96);
}

.hw-voice-stop:disabled {
    opacity: 0.55;
    cursor: default;
}

.hw-voice-stop[hidden] {
    display: none !important;
}

.hw-voice-dots {
    display: none;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.55rem;
    vertical-align: middle;
}

.hw-voice-panel.is-busy .hw-voice-dots {
    display: inline-flex;
}

.hw-voice-dots span {
    display: block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.28;
    animation: hw-voice-dot 1.05s ease-in-out infinite;
}

.hw-voice-dots span:nth-child(2) { animation-delay: 0.18s; }
.hw-voice-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes hw-voice-dot {
    0%,
    80%,
    100% { opacity: 0.25; transform: translateY(0) scale(0.85); }
    40% { opacity: 1; transform: translateY(-0.28rem) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .hw-voice-dots span { animation: none; opacity: 0.85; transform: none; }
}

.hw-voice-panel-text {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.45;
}

.hw-voice-panel-note {
    margin: 0.55rem 0 0;
    color: #E64618;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.4;
}

.hw-voice-panel.is-ok .hw-voice-panel-note,
.hw-voice-panel.is-bad .hw-voice-panel-note {
    display: none;
}

.hw-voice-panel-now {
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(224, 180, 120, 0.55);
    color: #6E3F00;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.hw-voice-panel-now[hidden] { display: none !important; }

.hw-voice-panel.is-ok .hw-voice-panel-now,
.hw-voice-panel.is-bad .hw-voice-panel-now {
    display: none !important;
}

.hw-sidepane {
    padding: clamp(0.85rem, 1.4vw, 1.15rem) clamp(0.9rem, 1.5vw, 1.2rem) 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 12rem;
    min-width: 0;
}

.hw-wizard .hw-composer,
.hw-wizard .hw-sidepane {
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    overflow-x: clip;
}

.hw-wizard .hw-composer {
    display: flex;
    flex-direction: column;
}

.hw-wizard .hw-composer .hw-section:last-of-type {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 0;
}

.hw-wizard .hw-composer #hw-lesson-text {
    flex: 0 0 auto;
    min-height: 6.5rem;
    max-height: 14rem;
    height: auto;
    field-sizing: content;
    resize: vertical;
}

.hw-wizard .hw-composer .hw-actions-foot {
    margin-top: 0.15rem;
}

.hw-wizard .hw-sidepane {
    overflow: hidden;
}

.hw-wizard .hw-assign-grid {
    min-height: min(52dvh, 36rem);
    align-items: stretch;
}

.hw-wizard .hw-review {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.hw-wizard .hw-empty {
    flex: 1 1 auto;
    min-height: 12rem;
}

.hw-wizard .hw-list {
    padding-bottom: 0.35rem;
}

.hw-empty {
    display: grid;
    gap: 0.35rem;
    place-content: center;
    min-height: 10rem;
    padding: 1.5rem 1rem;
    border-radius: 16px;
    background: #FFFcf8;
    border: 1px dashed #E4D8CB;
    text-align: center;
}

.hw-empty strong {
    font-size: 0.98rem;
}

.hw-empty p {
    margin: 0;
    color: #786962;
    font-size: 0.9rem;
    line-height: 1.5;
}

.hw-empty[hidden] { display: none; }

.hw-tools {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.hw-tools .hw-actions,
.hw-tools .hw-toolbar {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.hw-toolbar-lead {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 0;
    color: #5C463C;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.45;
}

.hw-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-left: auto;
    justify-content: flex-end;
    max-width: 100%;
    min-width: 0;
}

.hw-flow-copy strong {
    font-size: 0.82rem;
    line-height: 1.25;
}

@media (max-width: 1100px) {
    .hw-flow-steps {
        display: flex;
        gap: 0.2rem;
    }

    .hw-flow-label {
        font-size: 0.7rem;
    }

    .hw-flow-num {
        width: 1.85rem;
        height: 1.85rem;
        font-size: 0.78rem;
    }
}

.hw-review {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 0;
}

.hw-review[hidden] { display: none; }

.hw-review-summary {
    display: grid;
    gap: 0.4rem;
}

.hw-review-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hw-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 30px;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    background: #F6F1EB;
    color: #5C4B45;
    font-size: 0.82rem;
    font-weight: 700;
}

.hw-stat strong {
    font-weight: 800;
    color: #352521;
}

.hw-stat.is-warn {
    background: #FFF4D8;
    color: #8A5A00;
}

.hw-stat.is-ok {
    background: #E7F6EE;
    color: #1E7A49;
}

.hw-review-lead {
    margin: 0;
    color: #786962;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
}

.hw-word-bar {
    display: grid;
    gap: 0.7rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid #EADCCF;
    border-radius: 20px;
    background: linear-gradient(180deg, #FFFCF8 0%, #FFF6EE 100%);
}

.hw-word-bar[hidden] { display: none !important; }

.hw-word-bar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 0.85rem;
    min-width: 0;
}

.hw-word-bar-kinds {
    display: grid;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-width: 0;
}

.hw-word-bar-kinds[hidden] {
    display: none !important;
}

.hw-word-bar-label {
    margin: 0;
    color: #9A7B68;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.hw-word-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.05rem;
}

.hw-word-subfilters {
    display: grid;
    gap: 0.4rem;
    padding-top: 0.7rem;
    border-top: 1px dashed #EAD3C2;
}

.hw-word-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 0.75rem;
}

.hw-word-subfilters .hw-filters {
    gap: 0.3rem;
}

.hw-word-subfilters .hw-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.85);
}

.hw-filter-ico {
    display: inline-grid;
    place-items: center;
    width: 0.9rem;
    height: 0.9rem;
}

.hw-filter-ico svg {
    width: 0.85rem;
    height: 0.85rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-progress-widget {
    margin: 0 0 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #ECE3DA;
    border-radius: 16px;
    background: linear-gradient(180deg, #FFFCF8 0%, #FFF8F2 100%);
}

.hw-progress-widget[hidden] { display: none !important; }

.hw-progress-label {
    margin: 0 0 0.45rem;
    color: #9A7B68;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.hw-progress-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.hw-progress-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #EDE4DB;
    color: #5C463C;
    font-size: 0.8rem;
    font-weight: 800;
}

.hw-progress-stat.is-wait { border-color: #F0D2B8; color: #C45E34; background: #FFF8F1; }
.hw-progress-stat.is-ok { border-color: #C9E5D4; color: #2F7A52; background: #F4FBF6; }

.hw-progress-ico {
    display: inline-grid;
    place-items: center;
    width: 0.9rem;
    height: 0.9rem;
}

.hw-progress-ico svg {
    width: 0.85rem;
    height: 0.85rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-toolbar {
    gap: 0.55rem !important;
}

.hw-toolbar .hw-primary,
.hw-toolbar .hw-quiet {
    min-height: 2.7rem;
}

.hw-confirm-all-word {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    min-height: 2rem;
    padding: 0.25rem 0.85rem;
    border: 1px solid #E6B7A4;
    border-radius: 999px;
    background: #FFF8F2;
    color: #C45E34;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.hw-confirm-all-word:hover:not(:disabled) {
    background: #FFEFE4;
    border-color: #E07A55;
}

.hw-confirm-all-word:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hw-confirm-all-word[hidden] {
    display: none !important;
}

.hw-filter-dot {
    position: absolute;
    top: 0.15rem;
    right: 0.2rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #E07A55;
    box-shadow: 0 0 0 2px #FFFCF8;
}

.hw-filter.is-current .hw-filter-dot {
    background: #D46845;
    box-shadow: 0 0 0 2px #FFF1E6;
}

.hw-word-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    min-height: 2.35rem;
    padding: 0.35rem 0.85rem;
    border: 1.5px solid #E5D0BF;
    border-radius: 999px;
    background: #fff;
    color: #5C463C;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.hw-word-tab:hover {
    background: #FFF4EA;
    border-color: #E5C8B4;
}

.hw-word-tab.is-current {
    border-color: #E07A55;
    background: #FFF1E6;
    color: #C45E34;
    box-shadow: 0 2px 8px rgba(196, 94, 52, 0.12);
}

.hw-word-tab.is-confirmed:not(.is-current) {
    border-color: #C9E5D4;
    background: #F4FBF6;
    color: #2F7A52;
}

.hw-word-tab.has-pending:not(.is-current) {
    border-color: #F0D2B8;
    background: #FFF8F1;
}

.hw-word-status {
    display: inline-grid;
    place-items: center;
    width: 0.95rem;
    height: 0.95rem;
    color: inherit;
    opacity: 0.9;
}

.hw-word-status svg {
    width: 0.85rem;
    height: 0.85rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-word-tab.has-pending {
    padding-right: 1.05rem;
}

.hw-word-dot {
    position: absolute;
    top: 0.15rem;
    right: 0.2rem;
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 999px;
    background: #E07A55;
    box-shadow: 0 0 0 2px #FFFCF8;
    pointer-events: none;
}

.hw-word-tab.is-current .hw-word-dot {
    background: #D46845;
    box-shadow: 0 0 0 2px #FFF1E6;
}

.hw-word-tab.is-confirmed .hw-word-dot {
    display: none;
}

.hw-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.3rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #F0E4D8;
    color: #7A655A;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.hw-filter.is-current .hw-filter-count {
    background: rgba(224, 122, 85, 0.18);
    color: #C45E34;
}

.hw-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.hw-filter {
    min-height: 36px;
    padding: 0.3rem 0.8rem;
    border: 1px solid #E9E1D8;
    border-radius: 999px;
    background: #fff;
    color: #786962;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-filter.is-current {
    border-color: #E07A55;
    background: #FFF5EA;
    color: #C45E34;
}

.hw-list,
.hw-questions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.hw-card {
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #E9E1D8;
    border-left-width: 4px;
    border-radius: 16px;
    background: #fff;
}

.hw-card.is-mcq { border-left-color: #E8A78A; }
.hw-card.is-match { border-left-color: #8EB6E0; }
.hw-card.is-spell { border-left-color: #8EC9A8; }
.hw-card.is-sentence { border-left-color: #B5A6E0; }

.hw-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-height: 1.45rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: #F7F1EB;
    color: #6E584E;
    font-size: 0.74rem;
    font-weight: 800;
}

.hw-card.is-mcq .hw-type-pill { background: #FFF1E8; color: #C45E34; }
.hw-card.is-match .hw-type-pill { background: #EAF3FB; color: #3F74A8; }
.hw-card.is-spell .hw-type-pill { background: #EAF7F0; color: #2F7A52; }
.hw-card.is-sentence .hw-type-pill { background: #F2EDFB; color: #6B57A8; }

.hw-type-pill-ico,
.hw-pill-ico {
    display: inline-grid;
    place-items: center;
    width: 0.85rem;
    height: 0.85rem;
}

.hw-type-pill-ico svg,
.hw-pill-ico svg {
    width: 0.8rem;
    height: 0.8rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-card.is-pending {
    border-color: #EAD7A8;
    background: #FFFcf3;
}

.hw-card.is-confirmed {
    border-color: #C9E6D4;
}

.hw-card.is-active {
    border-color: #E64618;
    box-shadow: 0 0 0 2px rgba(230, 70, 24, 0.12);
}

.hw-card.is-clickable {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.hw-card.is-clickable:hover {
    border-color: #E8C4A8;
    box-shadow: 0 6px 18px rgba(90, 50, 30, 0.08);
}

.hw-card.is-clickable:focus-visible {
    outline: none;
    border-color: #E64618;
    box-shadow: 0 0 0 3px rgba(230, 70, 24, 0.18);
}

.hw-card.is-clickable:active {
    transform: scale(0.995);
}

.hw-card-open {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.3rem 0.75rem;
    border: 1px solid #E7D9CE;
    border-radius: 12px;
    background: #fff;
    color: #5C463C;
    font-size: 0.86rem;
    font-weight: 800;
    pointer-events: none;
}

.hw-card.is-clickable:hover .hw-card-open {
    border-color: #E0C2AE;
    background: #FFF8F3;
}

.hw-card-top,
.hw-card-foot {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.hw-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    min-width: 0;
}

.hw-q-num {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 0.5rem;
    border-radius: 8px;
    background: #F3EEE8;
    color: #5C4B45;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-card-ja,
.hw-card-en {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.hw-card-ja {
    color: #352521;
    font-weight: 800;
}

.hw-card-en {
    color: #786962;
    font-weight: 600;
    font-size: 0.92rem;
}

.hw-card-audio {
    color: #8A5A00;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-card-foot .hw-quiet {
    min-height: 36px;
    padding: 0.3rem 0.75rem;
    font-size: 0.86rem;
}

.hw-menu {
    position: relative;
    flex: none;
}

.hw-menu > summary {
    list-style: none;
}

.hw-menu > summary::-webkit-details-marker { display: none; }

.hw-menu-panel {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 5;
    display: grid;
    min-width: 9.5rem;
    padding: 0.35rem;
    border: 1px solid #E9E1D8;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(53, 37, 33, 0.12);
}

.hw-menu-panel button {
    min-height: 36px;
    padding: 0.35rem 0.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #352521;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.hw-menu-panel button:hover {
    background: #FFF5EA;
    color: #E64618;
}

.hw-icon-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #786962;
    cursor: pointer;
}

.hw-icon-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-icon-btn:hover,
.hw-menu[open] > summary {
    background: #FFF5EA;
    border-color: #F0E0D5;
    color: #E64618;
}

.hw-q-prompt {
    margin: 0 0 0.45rem;
    color: #352521;
    font-weight: 700;
    line-height: 1.45;
}

.hw-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 0.55rem;
    border-radius: 999px;
    background: #F6F1EB;
    color: #5C4B45;
    font-size: 0.76rem;
    font-weight: 800;
}

.hw-pill.is-warn {
    background: #FFF4D8;
    color: #8A5A00;
}

.hw-pill.is-ok {
    background: #E7F6EE;
    color: #1E7A49;
}

.hw-key {
    margin: 0.15rem 0;
    color: #2F9E62;
    font-weight: 800;
}

.hw-choices-preview,
.hw-match-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.15rem 0 0;
}

.hw-match-preview { flex-direction: column; }

.hw-chip {
    min-height: 34px;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #F6F1EB;
    font-size: 0.9rem;
    font-weight: 700;
}

.hw-drawer[hidden] { display: none; }

.hw-studio,
.hw-drawer {
    --hw-drawer-cream: #FBF5EE;
    --hw-drawer-surface: #FFFCF8;
    --hw-drawer-card: #FFFFFF;
    --hw-drawer-peach: #FFF6EE;
    --hw-drawer-border: #EADCCF;
    --hw-drawer-ink: #3B2C26;
    --hw-drawer-muted: #8A7468;
    --hw-drawer-coral: #E07A55;
    --hw-drawer-coral-deep: #D46845;
    --hw-drawer-coral-soft: rgba(224, 122, 85, 0.16);
    --hw-drawer-mint: #EAF6EF;
    --hw-drawer-mint-ink: #2F7A52;
    --hw-drawer-mint-border: #C9E5D4;
}

.hw-drawer {
    position: fixed;
    inset: 0;
    /* Above hub top bar (200) and bell panel (220) so the drawer head isn't clipped. */
    z-index: 300;
    display: grid;
    justify-items: end;
}

.hw-drawer-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    background: rgba(53, 37, 33, 0.16);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.hw-drawer.is-open .hw-drawer-backdrop { opacity: 1; }

.hw-drawer-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(100%, 32rem);
    height: 100%;
    background:
        radial-gradient(circle at 12% -8%, rgba(255, 236, 220, 0.9), transparent 42%),
        radial-gradient(circle at 100% 0%, rgba(236, 247, 240, 0.55), transparent 36%),
        var(--hw-drawer-cream);
    border-radius: 24px 0 0 24px;
    box-shadow: -18px 0 48px rgba(53, 37, 33, 0.1);
    transform: translateX(1.25rem);
    opacity: 0.88;
    transition: transform 0.28s ease, opacity 0.22s ease;
    overflow: hidden;
}

.hw-drawer.is-open .hw-drawer-panel {
    transform: translateX(0);
    opacity: 1;
}

.hw-drawer-panel.is-confirmed-flash {
    animation: hw-drawer-success 0.45s ease;
}

/* Beat global `header:not(.app-header)` orange gradient from style.css */
.hw-drawer header.hw-drawer-head,
.hw-drawer .hw-drawer-head,
header.hw-drawer-head,
.hw-drawer-head {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: nowrap;
    margin: 0;
    padding: 1.35rem 1.35rem 1rem;
    border: none;
    border-bottom: 1px solid rgba(234, 220, 207, 0.7);
    border-radius: 0;
    background: transparent !important;
    color: var(--hw-drawer-ink) !important;
    box-shadow: none;
}

.hw-drawer-head-copy {
    min-width: 0;
    display: grid;
    gap: 0.28rem;
}

.hw-drawer-kicker {
    margin: 0;
    color: #A38474;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.hw-drawer-head h3,
header.hw-drawer-head h3 {
    margin: 0;
    color: var(--hw-drawer-ink);
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.3;
}

.hw-drawer-sub,
header.hw-drawer-head .hw-drawer-sub {
    margin: 0;
    color: var(--hw-drawer-muted);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
}

.hw-drawer-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    margin: 0;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 999px;
    background: #fff;
    color: #7A655A;
    box-shadow: 0 4px 14px rgba(53, 37, 33, 0.06);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hw-drawer-close svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.hw-drawer-close:hover {
    background: var(--hw-drawer-peach);
    border-color: #E5C8B4;
    color: var(--hw-drawer-coral-deep);
    transform: scale(1.04);
}

.hw-drawer-close:active { transform: scale(0.96); }

.hw-drawer-body {
    display: grid;
    gap: 1.05rem;
    align-content: start;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.35rem 1.25rem 1.35rem;
}

.hw-drawer-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hw-soft-badge,
.hw-voice-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0 0.7rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.hw-soft-badge.is-wait,
.hw-voice-badge.is-wait,
.hw-voice-badge.is-missing {
    background: #FFF3E4;
    border-color: #F0DCC4;
    color: #9A6330;
}

.hw-soft-badge.is-ok,
.hw-voice-badge.is-ready {
    background: var(--hw-drawer-mint);
    border-color: var(--hw-drawer-mint-border);
    color: var(--hw-drawer-mint-ink);
}

.hw-soft-badge.is-busy,
.hw-voice-badge.is-busy {
    background: #EEF3FF;
    border-color: #D7E0F5;
    color: #3A5EA8;
}

.hw-soft-badge.is-error,
.hw-voice-badge.is-error {
    background: #FDECEA;
    border-color: #F3D0CB;
    color: #B3382C;
}

.hw-review-card,
.hw-soft-card {
    display: grid;
    gap: 0.95rem;
    min-width: 0;
    max-width: 100%;
    padding: 1.05rem 1.1rem 1.15rem;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 20px;
    background: var(--hw-drawer-card);
    box-shadow: 0 8px 22px rgba(70, 42, 28, 0.04);
}

.hw-drawer header.hw-review-card-head,
.hw-drawer header.hw-soft-card-head,
.hw-drawer .hw-review-card-head,
.hw-drawer .hw-soft-card-head,
header.hw-review-card-head,
header.hw-soft-card-head,
.hw-review-card-head,
.hw-soft-card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent !important;
    color: var(--hw-drawer-ink) !important;
    box-shadow: none;
}

.hw-drawer .hw-review-card-head h4,
.hw-drawer .hw-soft-card-head h4,
.hw-review-card-head h4,
.hw-soft-card-head h4,
header.hw-review-card-head h4,
header.hw-soft-card-head h4 {
    margin: 0;
    color: var(--hw-drawer-ink) !important;
    font-size: 1rem;
    font-weight: 800;
}

.hw-review-ico,
.hw-soft-ico {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: #FFEFD9;
    color: #C4794A;
    box-shadow: inset 0 0 0 1px rgba(196, 121, 74, 0.08);
}

.hw-review-ico.is-audio,
.hw-soft-ico.is-audio {
    background: #EAF6EF;
    color: #3F8F63;
    box-shadow: inset 0 0 0 1px rgba(63, 143, 99, 0.1);
}

.hw-review-ico svg,
.hw-soft-ico svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-soft-field {
    display: grid;
    gap: 0.45rem;
    color: #7A655A;
    font-size: 0.84rem;
    font-weight: 800;
}

.hw-soft-field textarea {
    width: 100%;
    min-height: 5.4rem;
    padding: 1rem 1.05rem;
    border: 1.5px solid #E8D9CC;
    border-radius: 16px;
    background: var(--hw-drawer-peach);
    color: var(--hw-drawer-ink);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.hw-soft-field textarea:focus {
    outline: none;
    border-color: #E8B896;
    background: #fff;
    box-shadow: 0 0 0 3px var(--hw-drawer-coral-soft);
}

.hw-audio-player {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.9rem;
    align-items: center;
    padding: 0.95rem 1rem;
    border: 1px solid #E8D9CC;
    border-radius: 18px;
    background: linear-gradient(180deg, #FFFCF8 0%, #FFF4EA 100%);
}

.hw-play-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    border: none;
    border-radius: 999px;
    background: var(--hw-drawer-coral);
    color: #fff;
    box-shadow: 0 8px 18px rgba(208, 108, 72, 0.22);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.hw-play-orb svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
    stroke: none;
    position: relative;
    z-index: 1;
}

.hw-play-orb:hover:not(:disabled) {
    background: var(--hw-drawer-coral-deep);
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(208, 108, 72, 0.28);
}

.hw-play-orb:active:not(:disabled) { transform: scale(0.96); }

.hw-play-orb:disabled {
    cursor: default;
    filter: grayscale(0.25);
    opacity: 0.55;
    box-shadow: none;
}

.hw-play-pulse {
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 2px solid rgba(224, 122, 85, 0.28);
    opacity: 0;
}

.hw-audio-player.is-playing .hw-play-pulse {
    animation: hw-play-pulse 1.2s ease-out infinite;
}

.hw-audio-player.is-busy {
    background: #F7F9FF;
    border-color: #D7E0F5;
}

.hw-audio-player.is-error {
    border-color: #F5C7C1;
    background: #FFF7F6;
}

.hw-audio-player.is-ready {
    border-color: var(--hw-drawer-mint-border);
    background: linear-gradient(180deg, #FBFFFC 0%, #EEF8F1 100%);
}

.hw-audio-player.is-ready .hw-play-orb {
    background: #5FA87A;
    box-shadow: 0 8px 18px rgba(63, 143, 99, 0.22);
}

.hw-audio-player.is-ready .hw-play-orb:hover:not(:disabled) {
    background: #4F996B;
    box-shadow: 0 12px 24px rgba(63, 143, 99, 0.28);
}

.hw-audio-player.is-ready .hw-play-pulse {
    border-color: rgba(95, 168, 122, 0.3);
}

.hw-audio-meta {
    display: grid;
    gap: 0.22rem;
    min-width: 0;
}

.hw-audio-phrase {
    margin: 0;
    color: var(--hw-drawer-ink);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.hw-audio-caption {
    margin: 0;
    color: var(--hw-drawer-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-audio-player.is-ready .hw-audio-caption {
    color: var(--hw-drawer-mint-ink);
}

.hw-audio-regen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: fit-content;
    min-height: 2.4rem;
    padding: 0.4rem 0.95rem;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 999px;
    background: #fff;
    color: #7A655A;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hw-audio-regen svg {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-audio-regen:hover:not(:disabled) {
    background: var(--hw-drawer-peach);
    border-color: #E5C8B4;
    color: var(--hw-drawer-coral-deep);
}

.hw-audio-regen:active:not(:disabled) { transform: scale(0.97); }

.hw-audio-regen:disabled {
    opacity: 0.5;
    cursor: default;
}

.hw-audio-lines {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    max-width: 100%;
}

.hw-audio-lines.is-compact {
    gap: 0.35rem;
}

.hw-audio-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 0.55rem 0.7rem;
    border: 1px solid #E8D9CC;
    border-radius: 14px;
    background: #FFFCF8;
}

.hw-retry-panel .hw-audio-line {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

.hw-audio-line-reading {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    margin: 0.05rem 0 0;
}

.hw-audio-line-reading-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #9A7B63;
    white-space: nowrap;
}

/* Studio list + drawer. Beat global login input padding (3rem left). */
input.hw-audio-line-reading-input[type="text"],
.hw-drawer input.hw-audio-line-reading-input[type="text"],
.gc-homework input.hw-audio-line-reading-input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    min-height: 2.1rem;
    margin: 0;
    padding: 0.35rem 0.55rem;
    border: 1px solid #E8D9CC;
    border-radius: 10px;
    background: #fff;
    color: var(--hw-drawer-ink, #3B2A1F);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
}

input.hw-audio-line-reading-input[type="text"]:focus,
.hw-drawer input.hw-audio-line-reading-input[type="text"]:focus,
.gc-homework input.hw-audio-line-reading-input[type="text"]:focus {
    outline: 2px solid #E07A55;
    outline-offset: 1px;
    border-color: #E07A55;
    box-shadow: none;
    padding: 0.35rem 0.55rem;
}

input.hw-audio-line-reading-input[type="text"]:disabled,
.hw-drawer input.hw-audio-line-reading-input[type="text"]:disabled,
.gc-homework input.hw-audio-line-reading-input[type="text"]:disabled {
    opacity: 0.55;
    cursor: default;
}

.hw-audio-line.has-reading input.hw-audio-line-reading-input[type="text"],
.hw-drawer .hw-audio-line.has-reading input.hw-audio-line-reading-input[type="text"] {
    border-color: #D4B89A;
    background: #FFF8F1;
}

.hw-audio-line.is-heard {
    border-color: var(--hw-drawer-mint-border);
    background: #F4FBF6;
}

.hw-audio-line.is-unconfirmed {
    border-color: #F0C89A;
    background: #FFF8EE;
}

.hw-audio-line.is-missing {
    opacity: 0.92;
}

.hw-audio-line.is-generate {
    border-color: #E8B896;
    background: #FFF8F1;
}

.hw-audio-line.is-generate .hw-audio-line-cap {
    color: #C45E34;
    font-weight: 800;
}

.hw-audio-line.is-busy {
    opacity: 0.9;
    border-color: #F0DCC4;
    background: #FFF8EE;
}

.hw-audio-line-play {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--hw-drawer-coral, #E07A55);
    color: #fff;
    cursor: pointer;
    box-shadow: none;
}

.hw-audio-line-play svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: currentColor;
    stroke: none;
}

.hw-audio-line-play svg path {
    fill: currentColor;
    stroke: none;
}

.hw-audio-line-play:disabled {
    opacity: 0.45;
    cursor: default;
}

.hw-audio-line.is-heard .hw-audio-line-play {
    background: #5FA87A;
}

.hw-audio-line-ok {
    flex: 0 0 auto;
    min-height: 2.1rem;
    padding: 0 0.7rem;
    border: 0;
    border-radius: 999px;
    background: #E64618;
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(230, 70, 24, 0.18);
}

.hw-audio-line-ok:hover:not(:disabled) {
    background: #D53E14;
}

.hw-audio-line-ok:disabled {
    background: #E8DDD6;
    color: #8A756C;
    box-shadow: none;
    cursor: default;
}

.hw-audio-line.is-heard .hw-audio-line-ok {
    background: #E5F6ED;
    color: #2F7A52;
}

.hw-audio-line-role {
    display: inline-flex;
    align-items: center;
    margin-right: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #FFF0E9;
    color: #C45E34;
    font-size: 0.68rem;
    font-weight: 800;
    vertical-align: 0.1em;
}

.hw-audio-line-copy {
    min-width: 0;
}

.hw-audio-line-text {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--hw-drawer-ink);
    overflow-wrap: anywhere;
}

.hw-audio-line-cap {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--hw-drawer-muted);
}

.hw-audio-line.is-heard .hw-audio-line-cap {
    color: var(--hw-drawer-mint-ink);
}

.hw-audio-line.is-unconfirmed .hw-audio-line-cap {
    color: #C45E34;
}

.hw-audio-line.is-queued .hw-audio-line-cap {
    color: #B07A3A;
}

.hw-audio-line.is-unconfirmed .hw-audio-line-mark {
    color: #C45E34;
}

.hw-audio-line-regen {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid #E5C8B4;
    border-radius: 999px;
    background: #fff;
    color: #8A6A58;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hw-audio-line-regen.is-generate {
    width: auto;
    min-width: 4.6rem;
    height: 2.15rem;
    padding: 0 0.7rem;
    border-color: #E07A55;
    border-radius: 999px;
    background: #E07A55;
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.hw-audio-line-regen svg {
    width: 0.9rem;
    height: 0.9rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-audio-line-regen:hover:not(:disabled) {
    background: var(--hw-drawer-peach);
    border-color: #E0B89E;
    color: var(--hw-drawer-coral-deep);
}

.hw-audio-line-regen.is-generate:hover:not(:disabled) {
    background: #D46845;
    border-color: #D46845;
    color: #fff;
}

.hw-audio-line-regen:disabled {
    opacity: 0.45;
    cursor: default;
}

.hw-audio-line-delete {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid #F0C4BE;
    border-radius: 999px;
    background: #FFF7F5;
    color: #C45A4A;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hw-audio-line-delete svg {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-audio-line-delete:hover:not(:disabled) {
    background: #FDECEA;
    border-color: #E89A90;
    color: #A63D30;
}

.hw-audio-line-delete:disabled {
    opacity: 0.4;
    cursor: default;
}

.hw-audio-line-mark {
    min-width: 1rem;
    color: #5FA87A;
    font-weight: 800;
    text-align: center;
}

.hw-retry-voice {
    display: none !important;
}

.hw-retry-panel {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    padding: 1rem 1.05rem 1.1rem;
    border: 1px solid #EADCCF;
    border-radius: 20px;
    background: linear-gradient(180deg, #FFFCF8 0%, #FFF6EE 100%);
}

.hw-retry-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.hw-retry-panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--hw-ink, #3D2F28);
}

.hw-word-tab.is-retry {
    border-style: dashed;
}

.hw-soft-switch {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 18px;
    background: var(--hw-drawer-surface);
    cursor: pointer;
}

.hw-soft-switch-copy {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.hw-soft-switch-copy strong {
    color: var(--hw-drawer-ink);
    font-size: 0.92rem;
}

.hw-soft-switch-copy small {
    color: var(--hw-drawer-muted);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
}

.hw-soft-switch input[type="checkbox"] {
    appearance: none;
    width: 2.8rem;
    height: 1.6rem;
    margin: 0;
    border: none;
    border-radius: 999px;
    background: #E3D5C8;
    position: relative;
    flex: 0 0 auto;
    cursor: pointer;
    transition: background 0.18s ease;
}

.hw-soft-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 0.18rem;
    left: 0.18rem;
    width: 1.24rem;
    height: 1.24rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(53, 37, 33, 0.14);
    transition: transform 0.18s ease;
}

.hw-soft-switch input[type="checkbox"]:checked {
    background: var(--hw-drawer-coral);
}

.hw-soft-switch input[type="checkbox"]:checked::after {
    transform: translateX(1.15rem);
}

.hw-soft-switch input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--hw-drawer-coral-soft);
}

.hw-drawer-foot {
    display: grid;
    gap: 0.5rem;
    padding: 0.95rem 1.25rem 1.2rem;
    background: rgba(255, 252, 248, 0.92);
    border-top: 1px solid rgba(234, 220, 207, 0.85);
    backdrop-filter: blur(8px);
}

.hw-drawer-block {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-radius: 14px;
    background: #FFF3E4;
    color: #8A5A28;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.4;
}

.hw-drawer-block[hidden] { display: none; }

.hw-drawer-foot-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: space-between;
}

.hw-drawer-foot-sec,
.hw-drawer-foot-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.hw-drawer-foot-main {
    margin-left: auto;
}

.hw-drawer-ghost {
    min-height: 2.55rem;
    padding: 0.45rem 0.95rem;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 999px;
    background: #fff;
    color: #6E584E;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.hw-drawer-ghost:hover {
    background: var(--hw-drawer-peach);
    border-color: #E5C8B4;
    color: var(--hw-drawer-coral-deep);
}

.hw-drawer-ghost:active { transform: scale(0.97); }

.hw-drawer-link {
    min-height: 2.55rem;
    padding: 0.45rem 0.55rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--hw-drawer-muted);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.hw-drawer-link:hover { color: var(--hw-drawer-coral-deep); }

.hw-drawer-skip {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    padding: 0;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 999px;
    background: #fff;
    color: #6E584E;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.hw-drawer-skip svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-drawer-skip:hover {
    background: var(--hw-drawer-peach);
    border-color: #E5C8B4;
    color: var(--hw-drawer-coral-deep);
}

.hw-drawer-skip:active { transform: scale(0.97); }

.hw-drawer-skip:disabled,
.hw-drawer-skip[hidden] { display: none; }

.hw-drawer-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.9rem;
    min-width: 6.5rem;
    padding: 0.65rem 1.1rem;
    border: 1px solid var(--hw-drawer-border);
    border-radius: 999px;
    background: #fff;
    color: #6E584E;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.hw-drawer-save-ico {
    display: grid;
    place-items: center;
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
}

.hw-drawer-save-ico svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-drawer-save:hover:not(:disabled) {
    background: var(--hw-drawer-peach);
    border-color: #E5C8B4;
    color: var(--hw-drawer-coral-deep);
}

.hw-drawer-save.is-dirty:not(:disabled) {
    border-color: #E07A55;
    color: #C45E34;
    box-shadow: 0 0 0 3px rgba(224, 122, 85, 0.14);
}

.hw-drawer-save:active:not(:disabled) { transform: scale(0.98); }

.hw-drawer-save:disabled {
    opacity: 0.45;
    cursor: default;
}

.hw-drawer-save[hidden] { display: none; }

.hw-drawer-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.9rem;
    min-width: 10.5rem;
    padding: 0.7rem 1.3rem;
    border: none;
    border-radius: 999px;
    background: var(--hw-drawer-coral);
    color: #fff;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(208, 108, 72, 0.22);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.hw-drawer-confirm-ico {
    display: grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
    border: 2px solid currentColor;
    border-radius: 999px;
    flex: 0 0 auto;
}

.hw-drawer-confirm-ico::before {
    content: "";
    width: 0.34rem;
    height: 0.6rem;
    margin-top: -0.1rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}

.hw-drawer-confirm:hover:not(:disabled) {
    background: var(--hw-drawer-coral-deep);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(208, 108, 72, 0.28);
}

.hw-drawer-confirm:active:not(:disabled) { transform: scale(0.98); }

.hw-drawer-confirm:disabled {
    cursor: default;
    filter: grayscale(0.15);
    opacity: 0.42;
    box-shadow: none;
    transform: none;
}

.hw-drawer-confirm[hidden] { display: none; }

.hw-edit-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.hw-drawer-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    min-width: 2.55rem;
    min-height: 2.55rem;
    padding: 0;
}

.hw-drawer-icon-btn svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-drawer-danger {
    min-height: 2.5rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid #F0C8C2;
    border-radius: 999px;
    background: #FFF7F6;
    color: #B3382C;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hw-drawer-danger:hover {
    background: #FDECEA;
}

.hw-drawer-danger:active { transform: scale(0.97); }

.hw-drawer-ghost:disabled,
.hw-drawer-danger:disabled {
    opacity: 0.4;
    cursor: default;
}

.hw-choice-edit,
.hw-match-edit {
    display: grid;
    gap: 0.55rem;
}

.hw-match-guide {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
    background: #FFF6EE;
    border: 1px solid #EAD3C2;
}

.hw-match-guide strong {
    color: #3B2C26;
    font-size: 0.92rem;
}

.hw-match-guide p {
    margin: 0;
    color: #8A7468;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

.hw-choice-edit-row,
.hw-match-edit-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
}

.hw-match-edit-row {
    grid-template-columns: 1.5rem minmax(0, 1fr) auto minmax(0, 1fr);
    padding: 0.45rem 0.55rem;
    border: 1px solid #EFE3D7;
    border-radius: 14px;
    background: #FFFCF8;
}

.hw-match-num {
    color: #A38474;
    font-size: 0.8rem;
    font-weight: 800;
    text-align: center;
}

.hw-match-eq {
    color: #A38474;
    font-weight: 800;
}

.hw-choice-edit-row input[type="text"],
.hw-match-edit-row input[type="text"],
.hw-soft-field input[type="text"] {
    width: 100%;
    min-height: 2.85rem;
    padding: 0.7rem 0.95rem;
    border: 1.5px solid #E8D9CC;
    border-radius: 16px;
    background: var(--hw-drawer-peach, #FFF6EE);
    color: #3B2C26;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    box-sizing: border-box;
}

.hw-choice-edit-row input[type="text"]:focus,
.hw-match-edit-row input[type="text"]:focus,
.hw-soft-field input[type="text"]:focus {
    outline: none;
    border-color: #E8B896;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(224, 122, 85, 0.16);
}

.hw-choice-edit-row input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: #E07A55;
}

.hw-drawer-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@keyframes hw-play-pulse {
    0% { opacity: 0.75; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.28); }
}

@keyframes hw-drawer-success {
    0% { box-shadow: -18px 0 48px rgba(53, 37, 33, 0.14); }
    40% { box-shadow: -18px 0 48px rgba(46, 160, 90, 0.28); }
    100% { box-shadow: -18px 0 48px rgba(53, 37, 33, 0.14); }
}

body.hw-drawer-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .hw-drawer-backdrop,
    .hw-drawer-panel,
    .hw-play-orb,
    .hw-drawer-confirm,
    .hw-drawer-ghost,
    .hw-drawer-close,
    .hw-soft-switch input[type="checkbox"],
    .hw-soft-switch input[type="checkbox"]::after,
    .hw-type-toggle,
    .hw-type-switch,
    .hw-type-switch-knob {
        transition: none !important;
    }

    .hw-audio-player.is-playing .hw-play-pulse,
    .hw-drawer-panel.is-confirmed-flash {
        animation: none !important;
    }
}

.hw-chip.is-key {
    background: #E7F6EE;
    color: #1E7A49;
}

.hw-dialog {
    padding: 0;
    border: none;
    background: transparent;
    max-width: min(92vw, 34rem);
}

.hw-dialog::backdrop {
    background: rgba(53, 37, 33, 0.35);
    backdrop-filter: blur(4px);
}

.hw-dialog-card {
    margin: 0;
    padding: 1.25rem;
}

.hw-dialog-card h3 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.hw-dialog-card textarea {
    margin-top: 0.85rem;
    min-height: 12rem;
    resize: vertical;
    line-height: 1.55;
}

.hw-play {
    --hw-play-ink: #302924;
    --hw-play-muted: #7A6F64;
    --hw-play-red: #C93632;
    --hw-play-red-deep: #B02F2B;
    --hw-play-cream: #F6F1E6;
    --hw-play-surface-warm: #FFFCF6;
    --hw-play-border: #E8DFCF;
    --hw-play-selected: #F4DDD7;
    --hw-play-good: #338451;
    --hw-play-good-bg: #E6F3EB;
    --hw-play-miss: #B82F35;
    --hw-play-miss-bg: #F8E8E8;
    --hw-play-gold: #F3C65D;
    --hw-play-coral: #C93632;
    --hw-play-coral-deep: #C93632;
    --hw-play-mint: #338451;
    --hw-play-surface: #F6F1E6;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: clamp(0.85rem, 2.2vw, 1.5rem) clamp(0.85rem, 3vw, 1.75rem) 1.5rem;
    color: var(--hw-play-ink);
    isolation: isolate;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: none;
    border-radius: 0;
    background: var(--hw-play-surface);
    box-shadow: none;
}

@supports (height: 100dvh) {
    .hw-play:not(.hw-done) {
        min-height: max(100%, calc(100dvh - 4.75rem));
    }
}

/*
 * Full-bleed play / results surface — kill dashboard page padding.
 * Keep selectors free of nested :has() so the whole rule isn't dropped.
 */
.gc-workspace:has(.hw-play),
.gc-workspace:has(.hw-done),
.gc-workspace:has(.hw-play-stage:not([hidden])),
.gc-workspace:has(.gc-learn-hub.is-playing),
main.gc-app.platform-hub .gc-workspace:has(.hw-play),
main.gc-app.platform-hub .gc-workspace:has(.hw-done),
main.gc-app.platform-hub .gc-workspace:has(.hw-play-stage:not([hidden])),
main.gc-app.platform-hub .gc-workspace:has(.gc-learn-hub.is-playing),
main.gc-app.platform-hub.is-hw-studio-focus .gc-workspace:has(.hw-play),
main.gc-app.platform-hub.is-hw-studio-focus .gc-workspace:has(.hw-done),
main.gc-app.platform-hub.is-hw-studio-focus .gc-workspace:has(.hw-play-stage:not([hidden])),
main.gc-app.platform-hub.is-hw-studio-focus .gc-workspace:has(.gc-learn-hub.is-playing) {
    padding: 0 !important;
    overflow: hidden;
}

.gc-workspace:has(.hw-play) > #hub-panel,
.gc-workspace:has(.hw-done) > #hub-panel,
.gc-workspace:has(.hw-play-stage:not([hidden])) > #hub-panel,
.gc-workspace:has(.gc-learn-hub.is-playing) > #hub-panel,
#hub-panel:has(.hw-play),
#hub-panel:has(.hw-done),
#hub-panel:has(.gc-learn-hub.is-playing),
#hub-panel-platform:has(.hw-play),
#hub-panel-platform:has(.hw-done),
#hub-panel-platform:has(.gc-learn-hub.is-playing),
.gc-learn-hub:has(.hw-play),
.gc-learn-hub.is-playing,
.gc-learn-play:has(.hw-play),
.gc-learn-play:has(.hw-done),
.hw-play-stage:has(.hw-play),
.hw-play-stage:has(.hw-done) {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.gc-learn-hub.is-playing,
.gc-learn-play:has(.hw-play),
.gc-learn-play:has(.hw-done),
.hw-play-stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: calc(100dvh - 4.75rem);
    height: 100%;
}

/* Stretch the hub panel → stage → done surface so immersive results fill the workspace. */
.gc-workspace:has(.hw-done) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gc-workspace:has(.hw-done) > #hub-panel,
.gc-workspace:has(.hw-done) > #hub-panel-platform,
#hub-panel:has(.hw-done),
#hub-panel-platform:has(.hw-done),
.gc-learn-hub.is-playing:has(.hw-done),
.gc-learn-play:has(.hw-done),
.hw-play-stage:has(> .hw-done) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
    min-height: max(100%, calc(100dvh - 5.5rem));
    height: 100%;
    margin: 0;
    padding: 0;
}

/* Library/studio roots that wrap the play stage also need to stretch. */
#hub-panel:has(.hw-done) > .hw-play-stage,
#hub-panel-platform:has(.hw-done) > .hw-play-stage,
.gc-learn-play:has(.hw-done) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: max(100%, calc(100dvh - 5.5rem));
    height: 100%;
    width: 100%;
}

main.gc-app.platform-hub.is-hw-focus .hw-play,
main.gc-app.platform-hub.is-hw-focus .hw-done,
main.gc-app.platform-hub.is-hw-focus .gc-learn-hub.is-playing,
main.gc-app.platform-hub.is-hw-focus .gc-learn-play:has(.hw-play),
main.gc-app.platform-hub.is-hw-focus .gc-learn-play:has(.hw-done),
main.gc-app.platform-hub.is-hw-focus .hw-play-stage:has(> .hw-done) {
    min-height: 100dvh;
    height: 100%;
}

.hw-play-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.hw-blob {
    position: absolute;
    border-radius: 999px;
    filter: blur(28px);
    opacity: 0.42;
}

.hw-blob-a {
    width: 9rem;
    height: 9rem;
    top: -2.2rem;
    left: -2rem;
    background: #F0D8D2;
}

.hw-blob-b {
    width: 7rem;
    height: 7rem;
    top: 14%;
    right: -2rem;
    background: #EDE4D4;
}

.hw-blob-c {
    width: 8rem;
    height: 8rem;
    bottom: 6%;
    left: 10%;
    background: #E8DCC8;
}

.hw-spark {
    position: absolute;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--hw-play-gold);
    box-shadow: 0 0 0 3px rgba(243, 198, 93, 0.22);
    animation: hw-sparkle 2.8s ease-in-out infinite;
}

.hw-spark-a { top: 11%; left: 44%; }
.hw-spark-b { top: 26%; right: 16%; animation-delay: 0.8s; }

@keyframes hw-sparkle {
    0%, 100% { transform: scale(0.75); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

.hw-play-card {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.9rem;
    width: min(100%, 40rem);
    max-width: 100%;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .hw-play {
        min-height: calc(100dvh - 4.25rem);
        padding: 0.75rem 0.7rem 1.1rem;
    }
    .hw-play-card {
        width: 100%;
        gap: 0.7rem;
    }
}

.hw-top,
.hw-play .hw-top {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
}

.hw-back {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: 2px solid var(--hw-play-border);
    border-radius: 999px;
    background: var(--hw-play-surface-warm);
    color: var(--hw-play-ink);
    box-shadow: 0 1px 0 rgba(48, 41, 36, 0.04);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.hw-back svg {
    width: 1.15rem;
    height: 1.15rem;
}

.hw-back:hover {
    background: #FFF8EE;
    border-color: #DFD4C2;
}

.hw-back:active {
    background: var(--hw-play-selected);
    transform: scale(0.96);
}

.hw-back-spacer {
    width: 3rem;
    height: 3rem;
}

.hw-progress-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}

.hw-count,
.hw-kicker {
    margin: 0;
    justify-self: center;
    text-align: center;
    color: var(--hw-play-muted);
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.hw-count strong {
    color: var(--hw-play-red);
    font-size: 1.1rem;
}

.hw-session-bar {
    position: relative;
    display: block;
    height: 14px;
    margin: 0.15rem 0 0.35rem;
    overflow: hidden;
    border-radius: 999px;
    background: #EDE4D4;
    box-shadow: inset 0 1px 2px rgba(48, 41, 36, 0.06);
}

.hw-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
    border-radius: inherit;
    transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1), left 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-bar-main {
    background: var(--hw-play-red);
    z-index: 1;
}

.hw-bar-review {
    background: linear-gradient(90deg, #E8C56A 0%, #D4A83A 100%);
    z-index: 2;
}

.hw-review-time-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.7rem;
    padding: 0.18rem 0.7rem;
    border-radius: 999px;
    background: #FFF3D6;
    border: 1.5px solid #E8C56A;
    color: #8A6A12;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.hw-review-time-tag.is-compact {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.hw-review-time-ico {
    display: inline-grid;
    place-items: center;
    width: 0.95rem;
    height: 0.95rem;
}

.hw-review-time-ico svg {
    width: 0.9rem;
    height: 0.9rem;
}

.hw-review-head {
    display: grid;
    justify-items: center;
    gap: 0.28rem;
    min-width: 0;
}

.hw-review-remain-inline {
    margin: 0;
    color: var(--hw-play-red);
    font-size: 0.88rem;
    font-weight: 800;
}

/* —— Mistake-review intro: minimal, character-first —— */
.hw-play.hw-review-intro {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 4.75rem);
    padding: clamp(0.85rem, 2vw, 1.35rem) clamp(0.85rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 2rem);
    background: #F6F1E6;
}

main.gc-app.platform-hub.is-hw-focus .hw-play.hw-review-intro,
main.gc-app.platform-hub.is-hw-studio-focus .hw-play.hw-review-intro {
    min-height: 100dvh;
}

.hw-review-intro-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    max-width: 42rem;
    margin: 0 auto;
}

.hw-review-intro-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 clamp(0.55rem, 1.4vh, 0.9rem);
    animation: hw-review-stars-in 0.45s ease both;
}

.hw-review-intro-stars .hw-streak {
    min-height: 2.55rem;
    padding: 0.3rem 0.9rem;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(180, 140, 40, 0.12);
}

.hw-review-intro-stars .hw-streak.is-countup {
    animation: hw-streak-bump 0.55s ease 0.15s both;
}

.hw-review-intro-stars .hw-streak svg {
    width: 1.15rem;
    height: 1.15rem;
}

.hw-review-intro-stars .hw-streak b {
    font-variant-numeric: tabular-nums;
    min-width: 2.2ch;
    text-align: left;
}

.hw-review-intro-stage {
    display: grid;
    place-items: center;
    flex: 1 1 auto;
    min-height: 0;
    padding: clamp(0.75rem, 2.5vh, 1.5rem) 0;
}

.hw-review-intro-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 36rem);
    margin: 0 auto;
    text-align: center;
}

.hw-review-intro-mascot {
    width: clamp(8.5rem, 18vh, 11.5rem);
    height: clamp(9.1rem, 19.2vh, 12.3rem);
    margin: 0 0 clamp(1.1rem, 2.4vh, 1.5rem);
    animation: hw-review-mascot-in 0.55s ease 0.08s both;
}

@keyframes hw-review-stars-in {
    from { opacity: 0; transform: translateY(0.4rem) scale(0.94); }
    to { opacity: 1; transform: none; }
}

.hw-review-intro-mascot .hw-mascot-owl {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

@keyframes hw-review-mascot-in {
    from { opacity: 0; transform: translateY(0.55rem) scale(0.96); }
    to { opacity: 1; transform: none; }
}

.hw-review-intro-title {
    margin: 0 0 clamp(0.7rem, 1.6vh, 1rem);
    color: #302924;
    font: inherit;
    font-size: clamp(1.85rem, 1.5rem + 1.2vw, 2.45rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.hw-review-intro-copy {
    margin: 0 0 clamp(1.1rem, 2.4vh, 1.5rem);
    color: #81766C;
    font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
    font-weight: 600;
    line-height: 1.55;
}

.hw-review-intro-remain {
    margin: 0 0 clamp(1.35rem, 3vh, 1.9rem);
    color: #B58A35;
    font-size: clamp(1rem, 0.92rem + 0.3vw, 1.12rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hw-review-intro-cta {
    box-sizing: border-box;
    width: min(100%, 22rem);
    min-height: 3.4rem;
    margin: 0;
    padding: 0.85rem 1.35rem;
    border: 0;
    border-bottom: 4px solid #A92B28;
    border-radius: 15px;
    background: #C93632;
    color: #fff;
    font: inherit;
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.12rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}

.hw-review-intro-cta:hover {
    background: #B02F2B;
    border-bottom-color: #8F2421;
    filter: brightness(1.02);
}

.hw-review-intro-cta:focus-visible {
    outline: 3px solid rgba(201, 54, 50, 0.35);
    outline-offset: 3px;
}

.hw-review-intro-cta:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    margin-bottom: 2px;
}

@media (max-height: 720px) {
    .hw-review-intro-mascot {
        width: clamp(7rem, 16vh, 9rem);
        height: clamp(7.5rem, 17vh, 9.6rem);
        margin-bottom: 0.9rem;
    }

    .hw-review-intro-title {
        font-size: clamp(1.6rem, 4.2vh, 2rem);
        margin-bottom: 0.55rem;
    }

    .hw-review-intro-copy {
        margin-bottom: 0.9rem;
        font-size: 1rem;
    }

    .hw-review-intro-remain {
        margin-bottom: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hw-review-intro-mascot,
    .hw-review-intro-stars,
    .hw-review-intro-stars .hw-streak.is-countup {
        animation: none;
    }

    .hw-review-intro-cta {
        transition: none;
    }
}

.hw-streak {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1.5px solid #F0DF9E;
    background: #FFF8E0;
    color: #8A6A12;
    font-size: 0.92rem;
    font-weight: 800;
}

.hw-star-gain {
    position: absolute;
    right: 0.15rem;
    top: -0.85rem;
    color: #C45E34;
    font-size: 0.78rem;
    font-weight: 800;
    pointer-events: none;
    animation: hw-star-gain-pop 0.85s ease forwards;
}

@keyframes hw-star-gain-pop {
    0% { opacity: 0; transform: translateY(0.25rem) scale(0.9); }
    25% { opacity: 1; transform: translateY(0) scale(1.05); }
    100% { opacity: 0; transform: translateY(-0.7rem) scale(1); }
}

.hw-streak svg {
    width: 1rem;
    height: 1rem;
    fill: var(--hw-play-gold);
    stroke: #D4A83A;
    stroke-width: 1;
}

.hw-streak.is-bump {
    animation: hw-streak-bump 0.42s ease;
}

@keyframes hw-streak-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.hw-bar:not(.hw-session-bar) {
    height: 12px;
    margin: 0.1rem 0 0.25rem;
    overflow: hidden;
    border-radius: 999px;
    background: #EDE4D4;
    box-shadow: inset 0 1px 2px rgba(48, 41, 36, 0.06);
}

.hw-bar:not(.hw-session-bar) span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--hw-play-red);
    box-shadow: none;
    transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hw-ask-block {
    display: grid;
    gap: 0.55rem;
    justify-items: center;
    text-align: center;
    padding: 0.35rem 0 0.15rem;
    width: 100%;
    min-width: 0;
}

.hw-mascot {
    width: 5.75rem;
    height: 6.15rem;
    animation: hw-mascot-bob 3.2s ease-in-out infinite;
    transform-origin: center bottom;
}

.hw-mascot svg,
.hw-mascot-owl {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.hw-mascot.is-celebrate {
    width: 6.5rem;
    height: 6.9rem;
    animation: hw-mascot-pop 0.55s ease;
}

.hw-mascot.is-cheer {
    animation: hw-mascot-cheer 0.55s ease;
}

.hw-mascot.is-encourage {
    animation: hw-mascot-nudge 0.5s ease;
}

@keyframes hw-mascot-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-0.22rem); }
}

@keyframes hw-mascot-pop {
    0% { transform: scale(0.88); }
    55% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes hw-mascot-cheer {
    0% { transform: translateY(0) rotate(0deg); }
    35% { transform: translateY(-0.45rem) rotate(-4deg); }
    70% { transform: translateY(-0.15rem) rotate(3deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes hw-mascot-nudge {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-0.2rem); }
    50% { transform: translateX(0.18rem); }
    75% { transform: translateX(-0.1rem); }
}

.hw-cheer {
    margin: 0;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: var(--hw-play-selected);
    color: var(--hw-play-red);
    font-size: 0.82rem;
    font-weight: 800;
}

.hw-ask {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.45rem, 1.5vw, 0.75rem);
    width: 100%;
    min-width: 0;
    text-align: left;
}

.hw-ask-text {
    min-width: 0;
    flex: 1;
    max-width: 100%;
}

.hw-prompt {
    margin: 0;
    font-size: clamp(1.05rem, 0.72rem + 2.4vw, 1.85rem);
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.02em;
    white-space: normal;
    overflow: visible;
    overflow-wrap: break-word;
    color: var(--hw-play-ink);
}

.hw-prompt.is-english {
    letter-spacing: -0.01em;
    color: var(--hw-play-ink);
}

.hw-sub {
    margin: 0.35rem 0 0;
    color: var(--hw-play-muted);
    font-size: clamp(0.82rem, 0.65rem + 0.85vw, 1.02rem);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.01em;
    white-space: normal;
    overflow: visible;
    overflow-wrap: break-word;
}

/* Tablet / phone: speaker above text so prompts keep a full-width single line */
@media (max-width: 900px) {
    .hw-ask {
        flex-direction: column;
        align-items: center;
        gap: 0.55rem;
        text-align: center;
    }

    .hw-ask-text {
        flex: none;
        width: 100%;
    }

    .hw-prompt,
    .hw-sub {
        text-align: center;
    }
}

@media (max-width: 420px) {
    .hw-prompt {
        font-size: clamp(0.95rem, 3.8vw, 1.2rem);
    }

    .hw-sub {
        font-size: clamp(0.72rem, 3.1vw, 0.88rem);
    }
}


.hw-play .hw-speaker {
    display: grid;
    place-items: center;
    flex: none;
    width: clamp(3rem, 7vw, 3.75rem);
    height: clamp(3rem, 7vw, 3.75rem);
    min-width: 48px;
    min-height: 48px;
    margin: 0;
    padding: 0;
    border: 2.5px solid #E8B4AE;
    border-radius: 999px;
    background: #F8E6E3;
    color: var(--hw-play-red);
    box-shadow: 0 2px 0 rgba(201, 54, 50, 0.12);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease, filter 0.12s ease;
}

.hw-play .hw-speaker svg {
    width: 48%;
    height: 48%;
    display: block;
}

.hw-play .hw-speaker:hover:not(:disabled) {
    background: #F4DDD7;
    border-color: #D98E87;
}

.hw-play .hw-speaker:active:not(:disabled) {
    transform: scale(0.96);
    filter: brightness(0.98);
}

.hw-speaker.is-speaking {
    animation: hw-speaker-pulse 0.9s ease-in-out infinite;
    border-color: var(--hw-play-red);
    background: var(--hw-play-selected);
}

@keyframes hw-speaker-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.hw-body {
    margin-top: 0.4rem;
}

.hw-choices,
.hw-tiles,
.hw-answer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.hw-sentence {
    display: flex;
    flex-direction: column;
    gap: clamp(1.15rem, 3.5vh, 2.25rem);
}

.hw-answer {
    align-items: flex-end;
    min-height: 0;
}

.hw-choice {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
    min-height: 3.25rem;
    padding: clamp(0.95rem, 2.4vw, 1.15rem) clamp(1rem, 2.4vw, 1.25rem);
    border: 2.5px solid var(--hw-play-border);
    border-radius: 18px;
    background: var(--hw-play-surface-warm);
    color: var(--hw-play-ink);
    font-size: clamp(1.12rem, 0.95rem + 1vw, 1.35rem);
    font-weight: 800;
    text-align: left;
    box-shadow: 0 2px 0 rgba(48, 41, 36, 0.05);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.hw-choice:hover:not(:disabled) {
    border-color: #DCCFBA;
    background: #FFF9F0;
}

.hw-choice:active:not(:disabled) {
    transform: scale(0.985);
    box-shadow: 0 1px 0 rgba(48, 41, 36, 0.04);
    background: #FFF4E8;
}

.hw-choice.is-picked,
.hw-tile.is-picked {
    border-color: var(--hw-play-red);
    background: var(--hw-play-selected);
    color: var(--hw-play-ink);
    box-shadow: 0 2px 0 rgba(201, 54, 50, 0.12);
}

.hw-choice.is-picked::after {
    content: "";
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 2.5px solid var(--hw-play-red);
    background: var(--hw-play-red);
    box-shadow: inset 0 0 0 3px var(--hw-play-surface-warm);
}

.hw-choice.is-right {
    border-color: var(--hw-play-good);
    background: var(--hw-play-good-bg);
    color: var(--hw-play-good);
    animation: hw-choice-pop 0.35s ease;
}

.hw-choice.is-right::after {
    content: "✓";
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 999px;
    background: var(--hw-play-good);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
}

.hw-choice.is-wrong {
    border-color: var(--hw-play-miss);
    background: var(--hw-play-miss-bg);
    color: var(--hw-play-miss);
    animation: hw-shake 320ms ease;
}

.hw-choice.is-wrong::after {
    content: "✕";
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 999px;
    background: var(--hw-play-miss);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
}

/* Keep unselected answers readable after grading — no heavy fade. */
.hw-play.is-good .hw-choice:not(.is-right):not(.is-wrong),
.hw-play.is-miss .hw-choice:not(.is-right):not(.is-wrong) {
    opacity: 1;
    border-color: var(--hw-play-border);
    background: #F4EEE3;
    color: var(--hw-play-muted);
    box-shadow: none;
}

.hw-play.is-good .hw-choice:not(.is-right):not(.is-wrong)::after,
.hw-play.is-miss .hw-choice:not(.is-right):not(.is-wrong)::after {
    content: none;
}

@keyframes hw-choice-pop {
    0% { transform: scale(0.98); }
    55% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.hw-match-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.hw-match-progress {
    margin: 0;
    text-align: center;
    color: var(--hw-play-muted);
    font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.1rem);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.hw-match-progress.is-complete {
    color: var(--hw-play-good);
}

.hw-match {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(0.65rem, 2.2vw, 1.15rem) clamp(0.85rem, 3vw, 1.5rem);
    align-items: stretch;
    min-width: 0;
}

.hw-match.is-busy {
    pointer-events: none;
}

.hw-col {
    display: grid;
    grid-auto-rows: 1fr;
    gap: clamp(0.55rem, 1.6vw, 0.75rem);
    min-width: 0;
}

.hw-pair {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: clamp(3.5rem, 9vw, 4.35rem);
    padding: clamp(0.65rem, 1.8vw, 0.85rem) clamp(0.55rem, 1.6vw, 0.85rem);
    border: 2.5px solid var(--hw-play-border);
    border-radius: 16px;
    background: var(--hw-play-surface-warm);
    color: var(--hw-play-ink);
    font-size: clamp(1.12rem, 0.95rem + 0.95vw, 1.4rem);
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: 0 2px 0 rgba(48, 41, 36, 0.05);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.hw-pair-label {
    min-width: 0;
}

.hw-pair-check {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--hw-play-good);
}

.hw-pair-check svg {
    width: 100%;
    height: 100%;
    display: block;
}

.hw-pair:hover:not(:disabled) {
    background: #FFF9F0;
    border-color: #DCCFBA;
}

.hw-pair:active:not(:disabled):not(.is-done) {
    transform: scale(0.985);
    background: var(--hw-play-selected);
}

.hw-pair.is-picked {
    border-color: var(--hw-play-red);
    background: var(--hw-play-selected);
    color: var(--hw-play-red);
    box-shadow: 0 2px 0 rgba(201, 54, 50, 0.12);
}

.hw-pair.is-flash {
    border-color: var(--hw-play-good);
    background: #CDE9D7;
    color: var(--hw-play-good);
}

.hw-pair.is-done,
.hw-pair.is-done:disabled {
    opacity: 1;
    border-color: #8FCBAA;
    background: var(--hw-play-good-bg);
    color: var(--hw-play-good);
    box-shadow: none;
    transform: none;
    cursor: default;
}

.hw-pair.is-wrong {
    border-color: var(--hw-play-miss);
    background: var(--hw-play-miss-bg);
    color: var(--hw-play-miss);
    animation: hw-pair-flash 420ms ease;
}

.hw-spell {
    display: grid;
    gap: 0.85rem;
    width: 100%;
    justify-items: center;
}

.hw-spell-readout {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.05rem 0.08rem;
    width: min(100%, 34rem);
    min-height: 3rem;
    margin: 0;
    padding: 0.7rem 1rem;
    border: 2.5px dashed #F0C8B4;
    border-radius: 18px;
    background:
        linear-gradient(180deg, #FFFDF9 0%, #FFF4EA 100%);
    color: #3D2F28;
    font-size: clamp(1.2rem, 1rem + 1.6vw, 1.65rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.45;
    text-align: center;
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.hw-spell-readout.is-started {
    border-style: solid;
    border-color: #F2B6A6;
    box-shadow: 0 4px 0 rgba(226, 110, 84, 0.08);
}

.hw-spell-readout.is-complete {
    border-color: #8EC9A8;
    background: linear-gradient(180deg, #F7FCF8 0%, #EAF7F0 100%);
    box-shadow: 0 4px 0 rgba(46, 140, 90, 0.1);
}

.hw-spell-ch {
    color: #302924;
}

.hw-spell-blank {
    color: #D8C8BA;
    font-weight: 800;
}

.hw-spell-punct {
    color: #8A7468;
    padding-inline: 0.02em;
}

.hw-spell-space {
    display: inline-block;
    width: 0.62em;
}

.hw-spell-words {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.75rem 0.95rem;
    width: 100%;
}

.hw-spell-word {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.28rem;
    max-width: 100%;
    padding: 0.48rem 0.55rem;
    border: 2.5px solid #F0DED0;
    border-radius: 20px;
    background:
        linear-gradient(180deg, #FFFCF8 0%, #FFF5EC 100%);
    box-shadow: 0 3px 0 rgba(80, 50, 30, 0.06);
}

.hw-spell-word:nth-child(3n + 2) {
    border-color: #D9E8DE;
    background: linear-gradient(180deg, #FCFFFD 0%, #EFF8F2 100%);
}

.hw-spell-word:nth-child(3n + 3) {
    border-color: #DCE6F2;
    background: linear-gradient(180deg, #F8FBFF 0%, #EEF4FB 100%);
}

.hw-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
}

.hw-letter {
    box-sizing: border-box;
    width: clamp(2rem, 8.5vw, 2.85rem);
    height: clamp(2.55rem, 10.5vw, 3.45rem);
    flex: 0 0 auto;
    border: 2.5px solid var(--hw-play-border);
    border-radius: 14px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: clamp(1.05rem, 2.8vw, 1.45rem);
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    box-shadow: 0 2px 0 rgba(48, 41, 36, 0.05);
    transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.hw-letter:focus {
    border-color: var(--hw-play-red);
    outline: none;
    transform: translateY(-1px);
    background: #FFF9F6;
}

.hw-letter.is-hint {
    background: #FFF6D6;
    border-color: #E8C86A;
    color: #8A6A12;
}

.hw-letter-gap { width: 1.1rem; }

.hw-letter-mark {
    display: inline-grid;
    place-items: center;
    min-width: 0.85rem;
    padding: 0 0.05rem;
    color: #8A7468;
    font-size: clamp(1.15rem, 3vw, 1.55rem);
    font-weight: 800;
    line-height: 1;
    user-select: none;
}

.hw-slot {
    box-sizing: border-box;
    flex: 1 1 3.25rem;
    width: auto;
    min-width: 2.5rem;
    max-width: 8.5rem;
    height: clamp(2.35rem, 5vw, 3rem);
    border-bottom: 3px solid #D4C7B4;
}

.hw-tile {
    padding: clamp(0.55rem, 1.5vw, 0.7rem) clamp(0.75rem, 2vw, 0.95rem);
    border: 2.5px solid var(--hw-play-border);
    border-radius: 14px;
    background: var(--hw-play-surface-warm);
    color: inherit;
    font-size: clamp(1rem, 0.9rem + 0.5vw, 1.15rem);
    font-weight: 800;
    box-shadow: 0 2px 0 rgba(48, 41, 36, 0.05);
}

.hw-submit .hw-feedback {
    order: 3;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0.9rem 1.05rem;
    border-radius: 16px;
    background: var(--hw-play-surface-warm);
    border: 2.5px solid var(--hw-play-border);
    text-align: center;
    animation: hw-feedback-in 0.28s ease;
}

.hw-submit .hw-check {
    order: 1;
}

.hw-submit .hw-next {
    order: 2;
}

.hw-feedback[hidden] { display: none !important; }

.hw-feedback.is-good {
    background: var(--hw-play-good-bg);
    border-color: #A8D4B8;
}

.hw-feedback.is-miss {
    background: var(--hw-play-miss-bg);
    border-color: #E5B4B6;
}

@keyframes hw-feedback-in {
    from { opacity: 0; transform: translateY(-0.2rem) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.hw-submit {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 0.65rem;
}

.hw-check,
.hw-next {
    width: 100%;
    margin-top: 0;
    min-height: 3.4rem;
    padding: 0.95rem 1.1rem;
    border-radius: 999px;
    font-size: 1.12rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(48, 41, 36, 0.08);
    transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease, filter 0.12s ease, transform 0.12s ease;
}

.hw-play .hw-check {
    border: none;
    background: var(--hw-play-red);
    color: #fff;
    box-shadow: 0 3px 0 rgba(176, 47, 43, 0.35);
}

.hw-play .hw-check:hover:not(:disabled) {
    background: var(--hw-play-red-deep);
}

.hw-play .hw-check:active:not(:disabled) {
    transform: translateY(1px);
    filter: brightness(0.98);
}

.hw-play .hw-check:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

.hw-check[hidden],
.hw-next[hidden] {
    display: none !important;
}

.hw-next {
    border: 2.5px solid var(--hw-play-border);
    background: var(--hw-play-surface-warm);
    color: var(--hw-play-ink);
}

.hw-next.is-continue,
.hw-next.is-continue:hover:not(:disabled) {
    border: none;
    background: var(--hw-play-red);
    color: #fff;
    box-shadow: 0 3px 0 rgba(176, 47, 43, 0.35);
}

.hw-next.is-continue:hover:not(:disabled) {
    background: var(--hw-play-red-deep);
}

.hw-next.is-ready,
.hw-next.is-ready:hover:not(:disabled),
.hw-check.is-ready {
    border: none;
    background: var(--hw-play-good);
    color: #fff;
    box-shadow: 0 3px 0 rgba(40, 110, 68, 0.35);
}

.hw-next.is-ready:hover:not(:disabled),
.hw-check.is-ready:hover:not(:disabled) {
    background: #2C7346;
}

.hw-next.is-ready:active:not(:disabled),
.hw-next.is-continue:active:not(:disabled),
.hw-check.is-ready:active:not(:disabled) {
    transform: translateY(1px);
    filter: brightness(0.98);
}

.hw-live {
    min-height: 1.25em;
    margin: 0;
    font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.22rem);
    font-weight: 800;
    line-height: 1.4;
}

.hw-play.is-good {
    box-shadow: inset 0 -6px 0 var(--hw-play-good);
}

.hw-play.is-miss {
    box-shadow: inset 0 -6px 0 var(--hw-play-miss);
}

.hw-play.is-good .hw-live { color: var(--hw-play-good); }
.hw-play.is-miss .hw-live { color: var(--hw-play-miss); }

/* —— Homework results / quest clear ——
 * Layer A: .hw-done          — full-bleed workspace surface
 * Layer B: .hw-done-decor    — absolute inset 0 decoration (glow, owls)
 * Layer C: .hw-done-workspace → .hw-done-main — centered functional content
 */
.hw-play.hw-done,
.hw-done {
    --hw-done-cream: #F6F1E6;
    --hw-done-ink: #302924;
    --hw-done-chrome: 5.5rem;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    align-self: stretch;
    width: 100%;
    height: 100%;
    min-height: max(100%, calc(100dvh - var(--hw-done-chrome)));
    margin: 0;
    padding: 0;
    text-align: center;
    background: var(--hw-done-cream);
    /* Clip decor only at the real workspace edge (after shell padding is removed). */
    overflow: hidden;
    overscroll-behavior: contain;
    container-type: inline-size;
    container-name: hw-done;
}

main.gc-app.platform-hub.is-hw-focus .hw-done {
    --hw-done-chrome: 0rem;
    min-height: 100dvh;
    height: 100%;
}

main.gc-app.platform-hub.is-hw-studio-focus .hw-done,
.hw-play-stage:has(> .hw-done) > .hw-done,
.gc-learn-play:has(.hw-done) > .hw-done {
    min-height: max(100%, calc(100dvh - 5.5rem));
    height: 100%;
}

.hw-play-stage:has(> .hw-done) {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    align-self: stretch;
    min-height: max(100%, calc(100dvh - 5.5rem));
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

main.gc-app.platform-hub.is-hw-studio-focus .hw-play-stage:has(> .hw-done) {
    min-height: max(100%, calc(100dvh - 5.5rem));
    height: 100%;
}

/* Layer B — full-bleed decorative layer (sibling of content, not inside it). */
.hw-done-decor {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Subtle golden wash only — cream stays dominant (~6% peak opacity). */
.hw-done-rays {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 45% at 50% 38%, rgba(243, 198, 93, 0.07) 0%, rgba(243, 198, 93, 0) 70%);
    opacity: 1;
    pointer-events: none;
    z-index: 0;
}

.hw-done-clouds {
    position: absolute;
    left: -4%;
    right: -4%;
    bottom: 0;
    height: min(28%, 12rem);
    background:
        radial-gradient(ellipse 40% 70% at 14% 80%, rgba(255, 248, 236, 0.55) 0%, transparent 72%),
        radial-gradient(ellipse 44% 75% at 82% 85%, rgba(255, 246, 232, 0.45) 0%, transparent 74%);
    opacity: 0.7;
    z-index: 1;
}

.hw-done-fly {
    position: absolute;
    left: clamp(0rem, 1.2vw, 1.25rem);
    top: clamp(18%, 26%, 34%);
    width: clamp(6.5rem, min(15vw, 20vh), 14rem);
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    filter: drop-shadow(0 8px 16px rgba(53, 37, 33, 0.12));
    z-index: 1;
}

/*
 * Peek owl — anchored to the workspace corner.
 * Keep the PNG’s designed crop, but do not push it further off-screen
 * (negative bottom/right was hiding most of the character).
 */
.hw-done-peek {
    position: absolute;
    right: 0;
    bottom: 0;
    width: clamp(17rem, min(38vw, 50vh), 34rem);
    max-width: 54%;
    max-height: min(64%, 32rem);
    height: auto;
    object-fit: contain;
    object-position: right bottom;
    transform-origin: 100% 100%;
    filter: drop-shadow(0 10px 22px rgba(53, 37, 33, 0.14));
    z-index: 1;
}

/* Layer C — centered functional content; never constrains Layer B. */
.hw-done-workspace {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: clamp(0.75rem, 2vmin, 1.25rem) clamp(0.85rem, 2.5vmin, 1.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    pointer-events: none;
}

.hw-done-workspace > * {
    pointer-events: auto;
}

main.gc-app.platform-hub.is-hw-focus .hw-done-workspace {
    min-height: 100%;
}

.hw-done-spark {
    position: absolute;
    z-index: 1;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 0.08rem;
    background: #F3C65D;
    box-shadow: 0 0 0 2px rgba(243, 198, 93, 0.18);
    transform: rotate(45deg);
    opacity: 0.9;
    pointer-events: none;
}

.hw-done-spark-a { top: 18%; left: 18%; width: 0.42rem; height: 0.42rem; }
.hw-done-spark-b { top: 26%; left: 28%; background: #E8893A; width: 0.34rem; height: 0.34rem; }
.hw-done-spark-c { top: 38%; left: 12%; width: 0.48rem; height: 0.48rem; background: #F7E08A; }
.hw-done-spark-d { bottom: 22%; right: 30%; width: 0.4rem; height: 0.4rem; }
.hw-done-spark-e { bottom: 34%; right: 18%; width: 0.5rem; height: 0.5rem; background: #E8893A; }
.hw-done-spark-f { top: 14%; right: 36%; width: 0.36rem; height: 0.36rem; background: #FFE9A8; }

.hw-done-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.4rem, 1.6vmin, 1.1rem);
    width: min(96%, clamp(22rem, 62vmin, 52rem));
    max-width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
    margin: 0 auto;
    padding: clamp(0.25rem, 1.5vmin, 1rem) 0;
    box-sizing: border-box;
}

.hw-done-ribbon-wrap {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, clamp(20rem, 60vmin, 50rem));
    max-width: 100%;
    margin: 0;
    flex: 0 1 auto;
}

.hw-done-ribbon {
    --ribbon: #E53935;
    --ribbon-deep: #B71C1C;
    --ribbon-gold: #F0D060;
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    color: #fff;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.hw-done-ribbon-art {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 5px 0 rgba(48, 41, 36, 0.1));
}

.hw-done-ribbon-tail { fill: var(--ribbon-deep); }
.hw-done-ribbon-face { fill: var(--ribbon); }

.hw-done-ribbon-gold {
    fill: none;
    stroke: var(--ribbon-gold);
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hw-done-ribbon-gold.is-thin {
    stroke-width: 1.8;
    opacity: 0.92;
}

/*
 * Optical center in the arched red band between gold rails.
 * JP glyph ink sits low in the em-box — pin above geometric mid and
 * shift the transform up so visible strokes sit between the gold rails.
 * letter-spacing biases right — nudge left by half the tracking.
 */
.hw-done-ribbon-text {
    position: absolute;
    left: 50%;
    /* Optical mid between the gold rails. */
    top: 46%;
    display: block;
    width: max-content;
    max-width: 74%;
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: clamp(1.25rem, 0.95rem + 2.4cqw + 0.4vh, 2.85rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-indent: 0;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    transform: translate(calc(-50% - 0.03em), -50%);
    pointer-events: none;
}

.hw-done-ribbon-label {
    display: none;
}

.hw-done-encourage {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem 0.55rem;
    max-width: 100%;
    margin: 0;
    padding-inline: 0.35rem;
    color: var(--hw-done-ink);
    font-size: clamp(1rem, 0.85rem + 1cqw + 0.3vh, 1.7rem);
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

.hw-done-encourage-copy { min-width: 0; max-width: 100%; }

.hw-done-laurel {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    color: #D4A83A;
    flex: 0 0 auto;
}

.hw-done-laurel svg {
    width: 1.25rem;
    height: 1.25rem;
}

.hw-done-laurel:last-child {
    transform: scaleX(-1);
}

.hw-done-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.85rem, 2.2cqw, 1.45rem);
    width: 100%;
    margin: 0;
}

.hw-done-stat {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 0;
    min-height: clamp(6.5rem, 18vh, 12rem);
    border-radius: 18px;
    background: #FFFCF6;
    border: 1.5px solid #E8DFCF;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(48, 41, 36, 0.05);
}

.hw-done-stat.is-correct { border-color: #C5D9C4; }
.hw-done-stat.is-stars { border-color: #E8D39A; }

header.hw-done-stat-head,
.hw-done-stat-head {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.4rem;
    width: 100%;
    margin: 0;
    padding: 0.6rem 0.75rem;
    border: 0;
    box-shadow: none;
    background: transparent;
    color: inherit;
    font-size: clamp(0.88rem, 0.8rem + 0.3vw, 1.05rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: center;
    white-space: normal;
}

.hw-done-stat.is-correct .hw-done-stat-head {
    background: #DDE9D6;
    color: #338451;
}

.hw-done-stat.is-stars .hw-done-stat-head {
    background: #F7E7BA;
    color: #8A6A12;
}

.hw-done-stat-ico {
    display: inline-grid;
    place-items: center;
    width: 1.1rem;
    height: 1.1rem;
}

.hw-done-stat-ico svg {
    width: 1.05rem;
    height: 1.05rem;
}

.hw-done-stat.is-stars .hw-done-stat-ico svg {
    fill: #F3C65D;
    stroke: #D4A83A;
    stroke-width: 1;
}

.hw-done-stat-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex: 1 1 auto;
    padding: 0.75rem;
    background: #FFFCF6;
    text-align: center;
}

.hw-done-stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin: 0;
    font-size: clamp(1.7rem, 1.2rem + 2cqw + 0.8vh, 3rem);
    font-weight: 800;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Stars value: keep the digit on the card center; star sits to the left. */
.hw-done-stat.is-stars .hw-done-stat-value {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 0.35rem;
}

.hw-done-stat.is-correct .hw-done-stat-value { color: #338451; }
.hw-done-stat.is-stars .hw-done-stat-value { color: #C7921C; }

.hw-done-stat-star {
    display: inline-grid;
    place-items: center;
    width: 1.55rem;
    height: 1.55rem;
    justify-self: end;
}

/* Invisible twin keeps the number on the true horizontal center. */
.hw-done-stat-star.is-spacer {
    justify-self: start;
    visibility: hidden;
    pointer-events: none;
}

.hw-done-stat-num {
    grid-column: 2;
    justify-self: center;
}

.hw-done-stat-star svg {
    width: 1.45rem;
    height: 1.45rem;
    fill: #F3C65D;
    stroke: #D4A83A;
    stroke-width: 1;
}

.hw-done-stat-foot {
    margin: 0;
    width: 100%;
    color: #81766C;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.hw-done-review {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #338451;
    font-size: clamp(0.95rem, 0.88rem + 0.25vw, 1.05rem);
    font-weight: 800;
    text-align: center;
}

.hw-done-review-ico {
    display: inline-grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: #338451;
    color: #fff;
}

.hw-done-review-ico svg {
    width: 0.8rem;
    height: 0.8rem;
}

.hw-done-review-flare {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 0.08rem;
    background: #F3C65D;
    transform: rotate(45deg);
    opacity: 0.85;
}

.hw-done-error {
    margin: 0 0 0.75rem;
    color: #B82F35;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.hw-done-actions {
    display: grid;
    justify-items: center;
    gap: clamp(0.55rem, 1.6vh, 0.9rem);
    width: 100%;
    margin-top: 0;
    text-align: center;
}

.hw-done-actions .hw-done-cta {
    justify-self: stretch;
}

.hw-done-cta {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: clamp(3.2rem, 7.5vh, 4rem);
    margin: 0;
    padding: clamp(0.7rem, 1.6vh, 0.95rem) 1.25rem;
    border: 0;
    border-radius: 15px;
    border-bottom: 4px solid #A92B28;
    background: #C93632;
    color: #fff;
    font: inherit;
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.hw-done-cta-arrow {
    display: inline-grid;
    place-items: center;
    width: 1.15rem;
    height: 1.15rem;
}

.hw-done-cta-arrow svg {
    width: 1.1rem;
    height: 1.1rem;
}

.hw-done-cta:hover {
    background: #B02F2B;
    border-bottom-color: #8F2421;
}

.hw-done-cta:focus-visible {
    outline: 3px solid rgba(201, 54, 50, 0.35);
    outline-offset: 3px;
}

.hw-done-cta:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
    margin-bottom: 2px;
}

.hw-done-again {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 3.1rem;
    margin: 0;
    padding: 0.65rem 1.1rem;
    border: 1.5px solid #E0D5C4;
    border-radius: 14px;
    background: #FFFCF6;
    color: #302924;
    font: inherit;
    font-size: clamp(0.92rem, 0.88rem + 0.2vw, 1rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hw-done-again:hover {
    background: #FFF8EE;
    border-color: #D8CBB6;
}

.hw-done-again:active {
    transform: translateY(1px);
}

.hw-done-again:focus-visible {
    outline: 3px solid rgba(138, 123, 114, 0.28);
    outline-offset: 3px;
}

.hw-done-again-ico {
    display: inline-grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    color: #81766C;
}

.hw-done-again-ico svg {
    width: 0.95rem;
    height: 0.95rem;
}

/* Entrance animations */
.hw-done.is-celebrate .hw-done-ribbon {
    animation: hw-done-ribbon-in 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

.hw-done.is-celebrate .hw-done-rays {
    animation: hw-done-rays-in 0.7s ease both;
}

.hw-done.is-celebrate .hw-done-fly {
    animation: hw-done-fly-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.hw-done.is-celebrate .hw-done-peek {
    animation: hw-done-peek-in 0.75s cubic-bezier(0.22, 1.15, 0.36, 1) 0.25s both;
}

.hw-done.is-celebrate .hw-done-encourage {
    animation: hw-done-fade-up 0.45s ease 0.12s both;
}

.hw-done.is-celebrate .hw-done-stats {
    animation: hw-done-fade-up 0.45s ease 0.35s both;
}

.hw-done.is-celebrate .hw-done-review {
    animation: hw-done-fade-up 0.45s ease 0.5s both;
}

.hw-done.is-celebrate .hw-done-actions {
    animation: hw-done-fade-up 0.45s ease 0.55s both;
}

.hw-done.is-celebrate .hw-done-spark {
    animation: hw-done-spark 1.6s ease-out both;
}

.hw-done.is-celebrate .hw-done-spark-a { animation-delay: 0.2s; }
.hw-done.is-celebrate .hw-done-spark-b { animation-delay: 0.32s; }
.hw-done.is-celebrate .hw-done-spark-c { animation-delay: 0.44s; }
.hw-done.is-celebrate .hw-done-spark-d { animation-delay: 0.4s; }
.hw-done.is-celebrate .hw-done-spark-e { animation-delay: 0.52s; }
.hw-done.is-celebrate .hw-done-spark-f { animation-delay: 0.28s; }

@keyframes hw-done-ribbon-in {
    0% { opacity: 0; transform: scale(0.86) translateY(0.45rem); }
    65% { opacity: 1; transform: scale(1.04) translateY(-0.08rem); }
    100% { opacity: 1; transform: none; }
}

@keyframes hw-done-fly-in {
    0% { opacity: 0; transform: translate(-2.5rem, 2.8rem) rotate(-8deg) scale(0.88); }
    100% { opacity: 1; transform: none; }
}

@keyframes hw-done-peek-in {
    0% { opacity: 0; transform: translate(2.2rem, 3.2rem) rotate(6deg) scale(0.92); }
    70% { opacity: 1; transform: translate(-0.15rem, -0.2rem) rotate(-1.5deg) scale(1.02); }
    100% { opacity: 1; transform: none; }
}

@keyframes hw-done-rays-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes hw-done-spark {
    0% { opacity: 0; transform: rotate(45deg) scale(0.4); }
    28% { opacity: 1; transform: rotate(45deg) scale(1.2); }
    100% { opacity: 0; transform: rotate(45deg) translateY(-0.9rem) scale(0.65); }
}

@keyframes hw-done-fade-up {
    from { opacity: 0; transform: translateY(0.4rem); }
    to { opacity: 1; transform: none; }
}

@container hw-done (max-width: 520px) {
    .hw-done-fly { display: none; }
    .hw-done-peek { display: none; }
    .hw-done-stats { grid-template-columns: 1fr; }
    .hw-done-ribbon-text {
        font-size: clamp(1.1rem, 5cqw, 1.45rem);
        letter-spacing: 0.04em;
    }
}

@media (max-width: 1100px) {
    .hw-done-fly { width: clamp(6.5rem, 12vw, 10rem); }
    .hw-done-peek { width: clamp(12rem, 24vw, 20rem); }
}

@media (max-width: 900px) {
    .hw-done-fly { width: clamp(5.5rem, 11vw, 8rem); left: 0.15rem; }
    .hw-done-peek { width: clamp(11rem, 26vw, 16rem); }
}

@media (max-width: 760px) {
    .hw-done-fly { display: none; }
    .hw-done-peek { width: clamp(9.5rem, 34vw, 14rem); opacity: 0.95; }
    .hw-done-main { width: min(100%, 34rem); }
}

@media (max-height: 720px) {
    .hw-done-main {
        justify-content: center;
        gap: clamp(0.3rem, 1.2vh, 0.65rem);
        padding-block: 0.25rem;
    }
    .hw-done-stat { min-height: clamp(5.75rem, 16vh, 8rem); }
    .hw-done-fly { top: 18%; width: clamp(5.5rem, 14vh, 9rem); }
    .hw-done-peek { width: clamp(11rem, 34vh, 18rem); max-height: min(44%, 16rem); }
}

@media (max-height: 560px) {
    .hw-done-fly { display: none; }
    .hw-done-peek { opacity: 0.85; width: clamp(9rem, 28vh, 13rem); }
    .hw-done-stat { min-height: 5.5rem; }
    .hw-done-ribbon-text { font-size: clamp(1.15rem, 4.5vw, 1.5rem); }
    .hw-done-encourage { font-size: 1rem; }
    .hw-done-cta { min-height: 3rem; padding-block: 0.65rem; }
    .hw-done-again { min-height: 2.75rem; }
}

@media (max-height: 440px) {
    .hw-done-peek { display: none; }
    .hw-done-clouds { height: 5rem; }
    .hw-done-stats { gap: 0.55rem; }
    .hw-done-stat { min-height: 0; }
    .hw-done-workspace { align-items: flex-start; }
}

@media (max-width: 560px) {
    .hw-done-workspace {
        padding-inline: 0.85rem;
    }

    .hw-done-peek { display: none; }
    .hw-done-clouds { height: 8rem; }

    .hw-done-main {
        width: min(100%, 34rem);
        justify-content: center;
    }

    .hw-done-stats {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .hw-done-ribbon-text {
        font-size: clamp(1.15rem, 5.2vw, 1.5rem);
        letter-spacing: 0.04em;
    }

    .hw-done-encourage {
        font-size: 1.05rem;
        gap: 0.4rem;
    }
}

@media (max-height: 780px) {
    .hw-done-ribbon-wrap { margin-bottom: 0.55rem; width: min(100%, 34rem); }
    .hw-done-encourage { margin-bottom: 0.85rem; font-size: clamp(1.05rem, 2.4vh, 1.25rem); }
    .hw-done-stats { gap: 0.85rem; margin-bottom: 0.65rem; }
    .hw-done-stat { min-height: 7.5rem; }
    .hw-done-stat-value { font-size: clamp(1.5rem, 3.2vh, 1.95rem); }
    .hw-done-review { margin-bottom: 0.75rem; }
    .hw-done-cta { min-height: 3.15rem; padding: 0.7rem 1.1rem; }
    .hw-done-fly { width: clamp(5.5rem, 12vh, 9rem); }
    .hw-done-peek { width: clamp(11rem, 26vh, 18rem); }
}

@media (max-height: 680px) {
    .hw-done-stat { min-height: 6.5rem; }
    .hw-done-stat-head { padding: 0.4rem 0.6rem; font-size: 0.88rem; }
    .hw-done-stat-body { padding: 0.45rem 0.55rem 0.55rem; }
    .hw-done-fly { opacity: 0.9; }
    .hw-done-peek { width: clamp(9rem, 22vh, 14rem); }
}

@media (prefers-reduced-motion: reduce) {
    .hw-done.is-celebrate .hw-done-ribbon,
    .hw-done.is-celebrate .hw-done-rays,
    .hw-done.is-celebrate .hw-done-fly,
    .hw-done.is-celebrate .hw-done-peek,
    .hw-done.is-celebrate .hw-done-encourage,
    .hw-done.is-celebrate .hw-done-stats,
    .hw-done.is-celebrate .hw-done-review,
    .hw-done.is-celebrate .hw-done-actions,
    .hw-done.is-celebrate .hw-done-spark {
        animation: none !important;
    }
}

.hw-play h2 {
    margin: 0.2rem 0 0.55rem;
    font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.35rem);
    color: var(--hw-play-ink, #302924);
}

.hw-score {
    margin: 0.25rem 0 0.45rem;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--hw-play-red, #C93632);
}

.hw-match.is-shake {
    animation: hw-shake 320ms ease;
}

@keyframes hw-shake {
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

@keyframes hw-pair-flash {
    0% { background: #F8C9C3; }
    100% { background: #FDECEA; }
}

@media (prefers-reduced-motion: reduce) {
    .hw-bar span,
    .hw-match.is-shake,
    .hw-pair.is-wrong,
    .hw-pair.is-flash,
    .hw-choice.is-right,
    .hw-choice.is-wrong,
    .hw-mascot,
    .hw-mascot.is-celebrate,
    .hw-mascot.is-cheer,
    .hw-mascot.is-encourage,
    .hw-streak.is-bump,
    .hw-spark,
    .hw-speaker.is-speaking,
    .hw-feedback { animation: none; transition: none; }

    .hw-pair:active:not(:disabled):not(.is-done),
    .hw-choice:active:not(:disabled),
    .hw-back:active,
    .hw-next.is-ready:hover:not(:disabled),
    .hw-next.is-ready:active:not(:disabled),
    .hw-next.is-continue:active:not(:disabled),
    .hw-choice:hover:not(:disabled),
    .hw-check:hover:not(:disabled),
    .hw-check:active:not(:disabled),
    .hw-speaker:hover:not(:disabled),
    .hw-speaker:active:not(:disabled) {
        transform: none;
    }
}

@media (max-width: 420px) {
    .hw-match {
        gap: 0.55rem 0.65rem;
    }

    .hw-pair {
        min-height: 3.25rem;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        font-size: clamp(1rem, 3.8vw, 1.15rem);
        border-radius: 14px;
    }

    .hw-pair-check {
        width: 1rem;
        height: 1rem;
    }
}

@media (min-width: 960px) {
    .hw-layout,
    .hw-wizard .hw-layout {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
        gap: clamp(0.85rem, 1.5vw, 1.25rem);
        align-items: stretch;
    }

    .hw-composer,
    .hw-sidepane {
        position: static;
        max-height: none;
        align-self: stretch;
        min-width: 0;
        max-width: 100%;
    }

    .hw-wizard .hw-composer {
        overflow: auto;
    }

    .hw-wizard .hw-sidepane {
        overflow: hidden;
    }

    .hw-empty {
        flex: 1;
        min-height: min(22rem, 48dvh);
    }

    .hw-drawer-panel {
        width: min(100%, 34rem);
    }
}

@media (min-width: 1400px) {
    .hw-layout,
    .hw-wizard .hw-layout {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr);
    }
}

/* Fit the wizard to the actual main-column width (sidebar-aware). */
@container hub-main (max-width: 980px) {
    .hw-wizard .hw-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .hw-wizard .hw-page-head-actions .hw-head-draft {
        font-size: 0.88rem;
        min-height: 2.3rem;
        padding: 0.35rem 0.7rem;
    }

    .hw-wizard-foot .hw-primary,
    .hw-wizard-foot .hw-quiet {
        min-height: 2.4rem;
        padding-inline: 0.85rem;
    }
}

@container hub-main (max-width: 720px) {
    .hw-wizard .hw-flow-label {
        font-size: 0.68rem;
    }

    .hw-wizard-foot {
        flex-wrap: wrap;
    }

    .hw-wizard-foot-actions {
        width: 100%;
    }

    .hw-wizard-foot-actions > * {
        flex: 1 1 auto;
    }
}

@media (min-width: 720px) and (max-width: 1079px) {
    .hw-drawer-panel {
        width: min(100%, 30rem);
    }
}

@media (max-width: 720px) {
    .hw-drawer-panel {
        width: 100%;
        border-radius: 20px 20px 0 0;
        height: min(94vh, 100%);
        align-self: end;
    }

    .hw-drawer-foot-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .hw-drawer-confirm,
    .hw-drawer-foot-sec,
    .hw-drawer-foot-main {
        width: 100%;
        margin-left: 0;
    }

    .hw-drawer-foot-sec,
    .hw-drawer-foot-main {
        justify-content: stretch;
    }

    .hw-drawer-ghost,
    .hw-drawer-save,
    .hw-drawer-confirm {
        flex: 1 1 auto;
    }

    .hw-drawer-skip {
        flex: 0 0 auto;
    }

    .hw-card-ja,
    .hw-card-en {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

@media (max-width: 900px) {
    .hw-type-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 800px) {
    .hw-fields { grid-template-columns: minmax(0, 1fr); }
    .hw-fields-meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .hw-actions-foot { justify-content: stretch; }
    .hw-actions-foot .hw-primary,
    .hw-actions-foot .hw-quiet { flex: 1 1 100%; }
    #hw-flow-assign .hw-actions-foot > button,
    #hw-flow-confirm .hw-actions-foot > button {
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .hw-section,
    .hw-composer-foot { padding-left: 1rem; padding-right: 1rem; }
    .hw-word-head { display: none; }
    .hw-word { grid-template-columns: 36px minmax(0, 1fr) 44px; }
    .hw-word [data-en] { grid-column: 2; }
    .hw-section-head-row { flex-direction: column; }
    .hw-actions-inline { width: 100%; }
    .hw-actions-inline .hw-quiet { flex: 1; }
}

/* —— Homework hub / library —— */
.hw-hub.hw-switch-shell {
    width: 100%;
    max-width: none;
    padding: 0.25rem 0 2.5rem;
}

.hw-hub-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 0.75rem 0 1.5rem;
}

.hw-hub-card {
    display: grid;
    gap: 0.45rem;
    justify-items: start;
    min-height: 13rem;
    padding: 1.5rem 1.4rem 1.45rem;
    border: 1.5px solid #EADCCF;
    border-radius: 28px;
    background: linear-gradient(160deg, #FFFCF8 0%, #FFF1E6 100%);
    color: #332D2B;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(53, 37, 33, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hw-hub-card.is-report {
    background: linear-gradient(160deg, #F8FCFF 0%, #EAF4FF 100%);
    border-color: #D5E6F7;
}

.hw-hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(53, 37, 33, 0.1);
    border-color: #E0B89E;
}

.hw-hub-card.is-report:hover { border-color: #B9D4EF; }

.hw-hub-card-icon {
    display: grid;
    place-items: center;
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    color: #F27B65;
}

.hw-hub-card.is-report .hw-hub-card-icon {
    color: #5B8FCF;
}

.hw-ico {
    width: 1.55rem;
    height: 1.55rem;
    display: block;
}

.hw-ico-sm {
    width: 0.95rem;
    height: 0.95rem;
}

.hw-hub-card strong {
    font-size: 1.45rem;
    font-weight: 800;
}

.hw-hub-card small {
    color: #817672;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.hw-lib {
    display: grid;
    gap: 1.15rem;
}

.hw-lib-crumb {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #817672;
    font-size: 0.86rem;
    font-weight: 700;
}

.hw-lib-crumb-link {
    border: 0;
    background: none;
    color: #F27B65;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.hw-lib-crumb-link:hover { text-decoration: underline; }

.hw-section-tabs {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 0.95rem;
    padding: 0.22rem;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--hw-sand, var(--lr-line, #E4D9C8));
    border-radius: 999px;
    background: var(--hw-surface, var(--lr-surface, #FFFCF6));
    box-shadow: 0 1px 2px rgba(48, 41, 36, 0.04);
}

.hw-section-tab {
    min-height: 2.2rem;
    padding: 0.35rem 1.15rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--hw-muted, var(--lr-muted, #81766C));
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.hw-section-tab:hover:not(.is-current) {
    color: var(--hw-red, var(--lr-red, #C93632));
    background: rgba(201, 54, 50, 0.06);
}

.hw-section-tab.is-current {
    background: var(--hw-red, var(--lr-red, #C93632));
    color: #fff;
}

.hw-report-shell {
    display: grid;
    gap: 0.35rem;
}

.hw-lib-kicker {
    margin: 0 0 0.25rem;
    color: var(--lr-red, #C93632);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

/* Specificity beats legacy `header:not(.app-header)` red gradient in style.css */
header.hw-lib-hero,
.hw-lib-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0 0 0.35rem;
    border: 0;
    border-radius: 0;
    color: var(--lr-text, #302924);
    background: transparent;
    box-shadow: none;
}

header.hw-lib-hero.hw-lib-hero-compact,
.hw-lib-hero-compact {
    align-items: center;
}

.hw-lib-hero-copy h2 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--lr-text, #302924);
    font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.hw-lib-hero-icon {
    display: none;
}

.hw-lib-hero-icon .hw-ico {
    width: 1.2rem;
    height: 1.2rem;
}

.hw-lib-hero-copy p {
    margin: 0.35rem 0 0;
    max-width: 36rem;
    color: var(--lr-muted, #81766C);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.5;
}

.hw-lib-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.65rem;
    padding: 0.55rem 1.1rem;
    border: 0;
    border-radius: 10px;
    background: var(--lr-red, #C93632);
    color: #fff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hw-lib-create-btn:hover {
    transform: translateY(-1px);
    background: var(--lr-red-deep, #A92B28);
    filter: none;
    box-shadow: none;
}

.hw-lib-create-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.hw-lib-create-plus {
    font-size: 1.15em;
    line-height: 1;
}

.hw-lib-toolbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.hw-lib-search {
    position: relative;
    flex: 1 1 22rem;
    min-width: min(100%, 18rem);
    max-width: 42rem;
}

.hw-lib-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #A8958C;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.hw-lib-search input {
    box-sizing: border-box;
    width: 100%;
    min-height: 3.15rem;
    padding: 0.75rem 2.75rem 0.75rem 2.85rem;
    border: 1.5px solid #ECE5DF;
    border-radius: 16px;
    background: #FFFFFF;
    color: #332D2B;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(53, 37, 33, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hw-lib-search input:focus {
    outline: none;
    border-color: #F2B6A6;
    box-shadow: 0 0 0 4px rgba(242, 123, 101, 0.14);
}

.hw-lib-search-clear {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 999px;
    background: #F3ECE6;
    color: #817672;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.hw-lib-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hw-lib-filter-wrap {
    position: relative;
    flex: none;
}

.hw-lib-filter-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 3.15rem;
    height: 3.15rem;
    padding: 0;
    border: 1.5px solid #ECE5DF;
    border-radius: 16px;
    background: #FFFFFF;
    color: #5C524E;
    box-shadow: 0 8px 20px rgba(53, 37, 33, 0.04);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hw-lib-filter-btn:hover,
.hw-lib-filter-btn.is-open,
.hw-lib-filter-btn.is-active {
    border-color: #F2B6A6;
    color: #C93632;
    background: #FFF8F2;
}

.hw-lib-filter-btn.is-open {
    box-shadow: 0 0 0 4px rgba(242, 123, 101, 0.14);
}

.hw-lib-filter-ico {
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
}

.hw-lib-filter-ico svg {
    width: 1.25rem;
    height: 1.25rem;
}

.hw-lib-filter-badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #C93632;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.05rem;
    text-align: center;
}

.hw-lib-filter-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 40;
    display: grid;
    gap: 0.7rem;
    width: min(18.5rem, calc(100vw - 2rem));
    padding: 0.9rem 0.95rem 0.95rem;
    border: 1px solid #E8DFCF;
    border-radius: 16px;
    background: #FFFCF6;
    box-shadow: 0 14px 32px rgba(48, 41, 36, 0.12);
}

.hw-lib-filter-panel[hidden] {
    display: none !important;
}

.hw-lib-filter-panel-title {
    margin: 0;
    color: #302924;
    font-size: 0.86rem;
    font-weight: 800;
}

.hw-lib-filter-field {
    display: grid;
    gap: 0.3rem;
}

.hw-lib-filter-field > span {
    color: #81766C;
    font-size: 0.75rem;
    font-weight: 700;
}

.hw-lib-filter-field select,
.hw-lib-filter select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 2.55rem;
    padding: 0.45rem 2.35rem 0.45rem 0.85rem;
    border: 1.5px solid #ECE5DF;
    border-radius: 12px;
    background-color: #FFFFFF;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.25 6 7.75l3.5-3.5' stroke='%235C524E' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 0.75rem;
    color: #5C524E;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.hw-lib-filter-reset {
    min-height: 2.35rem;
    border: 1px solid #E8DFCF;
    border-radius: 10px;
    background: #F6F1E6;
    color: #302924;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.hw-lib-filter-reset:hover {
    color: #C93632;
    border-color: #E6B7A4;
    background: #FFF8F2;
}

.hw-lib-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    width: 100%;
    max-width: 100%;
}

.hw-lib-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.15rem;
    padding: 0.35rem 0.85rem;
    border: 1px solid #E4D9C8;
    border-radius: 999px;
    background: #FFFCF6;
    color: #81766C;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hw-lib-tab em {
    font-style: normal;
    font-size: 0.76rem;
    font-weight: 800;
    color: inherit;
    opacity: 0.8;
}

.hw-lib-tab:hover {
    background: #F8EBE6;
    color: #302924;
    border-color: #D5C4B0;
}

.hw-lib-tab.is-current {
    background: #F4DDD7;
    border-color: #E5C4BA;
    color: #A92B28;
    font-weight: 800;
}

.hw-mine-toolbar {
    display: flex;
    margin: 0.15rem 0 0.2rem;
}

.hw-mine-toolbar[hidden] {
    display: none;
}

.hw-lib-draft-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.35rem;
    padding: 0.35rem 0.95rem;
    border: 1px solid #E6D5CC;
    border-radius: 999px;
    background: #fff;
    color: #6d5c56;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-lib-draft-ico {
    display: grid;
    place-items: center;
    width: 1.05rem;
    height: 1.05rem;
    flex: none;
}

.hw-lib-draft-ico svg {
    width: 1.05rem;
    height: 1.05rem;
}

.hw-lib-draft-btn em {
    font-style: normal;
    font-size: 0.78rem;
    opacity: 0.8;
}

.hw-lib-draft-btn.is-current {
    background: #FFF0E9;
    border-color: #F3C2B4;
    color: #E96B56;
}

.hw-select-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin: 0.1rem 0 0.15rem;
}

.hw-select-toolbar[hidden] {
    display: none;
}

.hw-select-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.hw-select-mode[hidden] {
    display: none !important;
}

.hw-select-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.hw-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: #5C524E;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-hub .hw-select-all input[type="checkbox"] {
    cursor: pointer;
}

.hw-select-count {
    color: #817672;
    font-size: 0.86rem;
    font-weight: 700;
}

.hw-select-toggle {
    min-height: 2.35rem;
    padding: 0.35rem 1.05rem;
    border: 1px solid #E6D5CC;
    border-radius: 999px;
    background: #fff;
    color: #5C524E;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hw-select-toggle:hover {
    border-color: #F3C2B4;
    color: #E96B56;
    background: #FFF0E9;
}

.hw-select-toggle.is-on {
    border-color: #F3C2B4;
    background: #FFF0E9;
    color: #E96B56;
}

.hw-select-delete {
    min-height: 2.35rem;
    padding: 0.35rem 1.05rem;
    border: 0;
    border-radius: 999px;
    background: #E64618;
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(230, 70, 24, 0.22);
}

.hw-select-delete:hover:not(:disabled) {
    background: #D53E14;
}

.hw-select-delete:disabled {
    background: #E6D5CC;
    box-shadow: none;
    cursor: default;
}

.hw-card-check {
    position: absolute;
    z-index: 2;
    top: 0.7rem;
    right: 0.75rem;
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    margin: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 4px rgba(51, 45, 43, 0.1);
    cursor: pointer;
}

.hw-hub .hw-card-check input[type="checkbox"] {
    cursor: pointer;
}

.hw-lib-card.is-selected,
.hw-sent-card.is-selected {
    border-color: #F27B65;
    box-shadow: 0 0 0 2px #F27B65;
}

.hw-lib-banner {
    border: 1px solid #F5D5CB;
    border-radius: 18px;
    background: #FFF5F1;
}

.hw-lib-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.05rem;
}

.hw-lib-banner-inner p {
    margin: 0;
    color: #9A4A3A;
    font-size: 0.92rem;
    font-weight: 700;
}

.hw-lib-banner-retry {
    min-height: 2.35rem;
    padding: 0.4rem 0.95rem;
    border: 0;
    border-radius: 999px;
    background: #F27B65;
    color: #fff;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-lib-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: stretch;
}

.hw-lib-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid #E4D9C8;
    border-radius: 14px;
    background: #FFFCF6;
    box-shadow: none;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.hw-lib-card:hover {
    transform: translateY(-2px);
    border-color: #D5C4B0;
    box-shadow: none;
}

.hw-lib-card:focus-visible {
    outline: 3px solid rgba(242, 123, 101, 0.35);
    outline-offset: 2px;
}

.hw-lib-card-actions button,
.hw-lib-card-actions .hw-lib-more {
    cursor: pointer;
}

.hw-lib-card-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 4.5rem;
    padding: 0.65rem;
    background: #E8DFCF;
}

.hw-lib-card.theme-animals .hw-lib-card-art,
.hw-lib-preview-art.theme-animals {
    background: #DDE5D5;
}

.hw-lib-card.theme-food .hw-lib-card-art,
.hw-lib-preview-art.theme-food {
    background: #F0E4D0;
}

.hw-lib-card.theme-school .hw-lib-card-art,
.hw-lib-preview-art.theme-school {
    background: #E2E8E4;
}

.hw-lib-card.theme-transport .hw-lib-card-art,
.hw-lib-preview-art.theme-transport {
    background: #E5E7E8;
}

.hw-lib-card.theme-colors .hw-lib-card-art,
.hw-lib-preview-art.theme-colors {
    background: #F4DDD7;
}

.hw-lib-card.theme-talk .hw-lib-card-art,
.hw-lib-preview-art.theme-talk {
    background: #E8DFCF;
}

.hw-lib-card-art svg,
.hw-lib-preview-art svg,
.hw-lib-empty-art svg {
    width: 2.8rem;
    height: 2.8rem;
}

.hw-lib-card-art-label {
    position: absolute;
    left: 0.9rem;
    top: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #817672;
    font-size: 0.7rem;
    font-weight: 800;
}

.hw-lib-card-body {
    display: grid;
    gap: 0.45rem;
    flex: 1;
    padding: 0.75rem 0.85rem 0.9rem;
    align-content: start;
}

.hw-lib-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.hw-lib-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.hw-lib-badge.is-official {
    background: #C93632;
    color: #fff;
}

.hw-lib-badge.is-mine {
    background: #F4DDD7;
    color: #A92B28;
}

.hw-lib-badge.is-shared {
    background: #DDE5D5;
    color: #3F5A3C;
}

.hw-lib-badge.is-private {
    background: #F3ECE6;
    color: #817672;
}

.hw-lib-badge.is-level-beginner {
    background: #E5F6ED;
    color: #2F7A52;
}

.hw-lib-badge.is-level-intermediate {
    background: #FFF0DC;
    color: #C47A2C;
}

.hw-lib-badge.is-level-advanced {
    background: #EEE8FF;
    color: #6A5ACD;
}

.hw-lib-card h3,
.hw-lib-preview-panel h3 {
    margin: 0;
    color: #302924;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hw-lib-card-desc {
    margin: 0;
    color: #81766C;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 0;
}

.hw-lib-preview-edit {
    display: block;
    margin: 0;
}

.hw-lib-preview-title-input,
.hw-lib-preview-desc-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    font: inherit;
    resize: none;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hw-lib-preview-title-input {
    padding: 0.2rem 0.35rem;
    color: #332D2B;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.35;
}

.hw-lib-preview-desc-input {
    padding: 0.2rem 0.35rem;
    color: #817672;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
    min-height: 2.7em;
}

.hw-lib-preview-title-input:hover,
.hw-lib-preview-desc-input:hover {
    background: #FFF8F2;
    border-color: #EADCCF;
}

.hw-lib-preview-title-input:focus,
.hw-lib-preview-desc-input:focus {
    outline: none;
    background: #fff;
    border-color: #E07A55;
    box-shadow: 0 0 0 3px rgba(224, 122, 85, 0.16);
}

.hw-lib-preview-save {
    margin: 0.35rem 0 0;
    color: #1E7A49;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-lib-preview-save[hidden] { display: none !important; }

.hw-lib-preview-save.is-ok { color: #1E7A49; }
.hw-lib-preview-save.is-bad { color: #B3382C; }

.hw-lib-card-meta {
    margin: 0;
    color: #81766C;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.4;
}

.hw-lib-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    color: #817672;
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-lib-card-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.hw-lib-card-stats em {
    font-style: normal;
}

.hw-lib-card-stats .hw-ico {
    color: #B79A8C;
}

.hw-lib-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.25rem;
}

.hw-lib-use {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    min-height: 2.4rem;
    border: 0;
    border-radius: 10px;
    background: #C93632;
    color: #fff;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hw-lib-card-actions:has(.hw-lib-preview-btn) > .hw-lib-use {
    flex: 1 1 100%;
}

.hw-lib-use:hover {
    transform: translateY(-1px);
    filter: none;
    background: #A92B28;
}

.hw-lib-use.is-muted:disabled,
.hw-lib-use:disabled {
    background: #E8DFCF;
    color: #81766C;
    box-shadow: none;
    cursor: default;
    transform: none;
    opacity: 1;
}

.hw-lib-use.is-muted:disabled:hover {
    background: #E8DFCF;
    transform: none;
}

.hw-teacher-lib-card:not([data-sent-open]) {
    cursor: default;
}

.hw-teacher-lib-card:not([data-sent-open]):hover {
    transform: none;
}

.hw-lib-card-secondary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-shrink: 0;
}

.hw-lib-card-secondary:has(.hw-lib-preview-btn) {
    flex: 1 1 100%;
    width: 100%;
}

.hw-lib-preview-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.8rem;
    border: 1.5px solid #ECE5DF;
    border-radius: 12px;
    background: #FAF8F5;
    color: #5C524E;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
}

.hw-lib-preview-btn:hover {
    background: #FFF0E9;
    border-color: #F2B6A6;
    color: #E96B56;
}

.hw-lib-more {
    position: relative;
}

.hw-lib-more-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1.5px solid #ECE5DF;
    border-radius: 12px;
    background: #fff;
    color: #817672;
    font: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.hw-lib-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.35rem);
    z-index: 5;
    display: grid;
    min-width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid #ECE5DF;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(53, 37, 33, 0.12);
}

.hw-lib-menu button {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #332D2B;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    text-align: left;
    padding: 0.55rem 0.7rem;
    cursor: pointer;
}

.hw-lib-menu button:hover { background: #FFF0E9; }
.hw-lib-menu button.is-danger { color: #B3382C; }

.hw-lib-empty-state {
    grid-column: 1 / -1;
    display: grid;
    justify-items: center;
    gap: 0.55rem;
    padding: 2.5rem 1.25rem;
    border: 1px dashed #E7D7CB;
    border-radius: 24px;
    background: linear-gradient(180deg, #FFFCF9 0%, #FAF8F5 100%);
    text-align: center;
}

.hw-lib-empty-art {
    display: grid;
    place-items: center;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 22px;
    background: #FFF0E9;
    margin-bottom: 0.35rem;
}

.hw-lib-empty-state h3 {
    margin: 0;
    color: #332D2B;
    font-size: 1.15rem;
}

.hw-lib-empty-state p {
    margin: 0;
    color: #817672;
    font-size: 0.94rem;
    font-weight: 600;
}

.hw-lib-status {
    margin: 0.15rem 0 0;
    color: #817672;
    font-size: 0.92rem;
    font-weight: 600;
}

.hw-lib-status.is-ok { color: #1E7A49; }
.hw-lib-status.is-bad { color: #B3382C; }

.hw-lib-summary {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

.hw-lib-summary h4 {
    margin: 0;
    font-size: 0.98rem;
}

.hw-lib-qsum {
    border: 1px solid #ECE5DF;
    border-radius: 16px;
    background: #FFFCF9;
    overflow: hidden;
}

.hw-lib-qsum > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    color: #332D2B;
    font-size: 0.92rem;
    font-weight: 800;
    user-select: none;
}

.hw-lib-qsum > summary::-webkit-details-marker { display: none; }

.hw-lib-qsum > summary::after {
    content: "▸";
    color: #A8958C;
    font-size: 0.85rem;
    transition: transform 0.15s ease;
}

.hw-lib-qsum[open] > summary::after {
    transform: rotate(90deg);
}

.hw-lib-qsum > summary em {
    margin-left: auto;
    margin-right: 0.35rem;
    color: #817672;
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 700;
}

.hw-lib-qsum-types {
    margin: 0;
    padding: 0 1rem 0.55rem;
    color: #817672;
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-lib-qsum-list {
    list-style: none;
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0 0.75rem 0.85rem;
    max-height: 18rem;
    overflow: auto;
}

.hw-lib-qsum-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #F0E8DF;
}

.hw-lib-qsum-type {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: #FFF0E9;
    color: #E96B56;
    font-size: 0.7rem;
    font-weight: 800;
    white-space: nowrap;
}

.hw-lib-qsum-copy {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.hw-lib-qsum-copy strong {
    color: #332D2B;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.hw-lib-qsum-copy small {
    color: #817672;
    font-size: 0.78rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.hw-lib-qsum-empty {
    margin: 0;
    padding: 0 1rem 0.95rem;
    color: #817672;
    font-size: 0.86rem;
    font-weight: 600;
}

.hw-lib-card.is-skeleton {
    pointer-events: none;
}

.hw-lib-card.is-skeleton .hw-lib-card-art {
    background: linear-gradient(90deg, #F3ECE6 25%, #FAF8F5 50%, #F3ECE6 75%);
    background-size: 200% 100%;
    animation: hw-skel 1.2s ease-in-out infinite;
}

.hw-skel-line,
.hw-skel-btn {
    height: 0.85rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #F3ECE6 25%, #FAF8F5 50%, #F3ECE6 75%);
    background-size: 200% 100%;
    animation: hw-skel 1.2s ease-in-out infinite;
}

.hw-skel-btn {
    height: 2.6rem;
    border-radius: 14px;
    margin-top: 0.4rem;
}

@keyframes hw-skel {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.hw-lib-preview[hidden] { display: none !important; }

.hw-lib-preview {
    position: fixed;
    inset: 0;
    /* Above hub top bar (200) and bell panel (220). */
    z-index: 300;
}

.hw-lib-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(51, 45, 43, 0.28);
    backdrop-filter: blur(2px);
}

.hw-lib-preview-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: min(100%, 26rem);
    height: 100%;
    max-height: 100dvh;
    padding: 0;
    background: #FAF8F5;
    box-shadow: -18px 0 40px rgba(53, 37, 33, 0.14);
    overflow: hidden;
}

.hw-lib-preview-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 0.85rem;
    padding: 1.25rem 1.25rem 1rem;
    overflow: auto;
    overscroll-behavior: contain;
}

.hw-lib-preview-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2.2rem;
    height: 2.2rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #817672;
    font: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(53, 37, 33, 0.08);
}

.hw-lib-preview-art {
    display: grid;
    place-items: center;
    min-height: 7rem;
    margin-top: 0.5rem;
    border-radius: 20px;
}

.hw-lib-preview-meta {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.hw-lib-preview-meta > div {
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #ECE5DF;
}

.hw-lib-preview-meta dt {
    color: #817672;
    font-size: 0.78rem;
    font-weight: 800;
}

.hw-lib-preview-meta dd {
    margin: 0;
    color: #332D2B;
    font-size: 0.88rem;
    font-weight: 700;
}

.hw-lib-preview-panel h4 {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin: 0.25rem 0 0;
    color: #332D2B;
    font-size: 0.95rem;
}

.hw-lib-preview-panel h4 em {
    color: #817672;
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 700;
}

.hw-lib-preview-types {
    margin: 0;
    color: #817672;
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-lib-preview-qlist {
    list-style: none;
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0 0 0.35rem;
}

.hw-lib-preview-qlist li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #ECE5DF;
}

.hw-lib-preview-muted,
.hw-lib-preview-loading {
    margin: 0;
    color: #817672;
    font-size: 0.9rem;
    font-weight: 600;
}

.hw-lib-preview-foot {
    flex: 0 0 auto;
    padding: 0.85rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #ECE5DF;
    background: #FAF8F5;
    box-shadow: 0 -8px 20px rgba(53, 37, 33, 0.04);
}

.hw-lib-assign-steps {
    display: flex;
    gap: 0.45rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hw-lib-assign-steps li {
    flex: 1;
    text-align: center;
    padding: 0.55rem 0.4rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #ECE5DF;
    color: #817672;
    font-size: 0.82rem;
    font-weight: 800;
}

.hw-lib-assign-steps li.is-current {
    background: #FFF0E9;
    border-color: #F2B6A6;
    color: #E96B56;
}

.hw-sent-toolbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin: 0.15rem 0 0.35rem;
}

.hw-teacher-toolbar {
    align-items: flex-start;
}

.hw-teacher-status {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: #F3EFEA;
    color: #6F625B;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.hw-teacher-status.is-sent {
    background: #E8F5E9;
    color: #2E7D32;
}

.hw-teacher-card:not([data-sent-open]) {
    cursor: default;
}

.hw-teacher-card:not([data-sent-open]):hover {
    transform: none;
}

.hw-sent-hint {
    margin: 0;
    color: #817672;
    font-size: 0.84rem;
    font-weight: 700;
}

.hw-lib-grid.is-sent {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hw-sent-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1rem 1.05rem 1.05rem;
    border: 1px solid #ECE5DF;
    border-radius: 22px;
    background: linear-gradient(180deg, #fff, #FFFCF9);
    box-shadow: 0 8px 20px rgba(86, 58, 42, 0.06);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.hw-sent-card:hover {
    transform: translateY(-2px);
    border-color: #F2B6A6;
    box-shadow: 0 12px 24px rgba(233, 107, 86, 0.1);
}

.hw-sent-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 2rem;
}

.hw-sent-card-top small {
    margin-left: auto;
    color: #817672;
    font-size: 0.75rem;
    font-weight: 700;
}

.hw-sent-card h3 {
    margin: 0;
    color: #332D2B;
    font-size: 1.12rem;
    font-weight: 850;
    line-height: 1.3;
}

.hw-sent-card-classes {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 0;
    color: #817672;
    font-size: 0.86rem;
    font-weight: 700;
}

.hw-sent-card-classes .hw-ico {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.hw-sent-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    color: #5C524E;
    font-size: 0.82rem;
    font-weight: 750;
}

.hw-sent-card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.hw-sent-card-stats em {
    font-style: normal;
}

.hw-sent-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.hw-sent-card .hw-lib-use {
    align-self: flex-start;
}

.hw-sent-delete {
    min-height: 2.35rem;
    padding: 0.35rem 0.85rem;
    border: 1px solid #F0C8B8;
    border-radius: 999px;
    background: #FFF7F3;
    color: #C45A45;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.hw-sent-delete:hover {
    background: #FFE8DE;
}

.hw-sent-delete:active {
    transform: scale(0.98);
}

.hw-sent-delete.is-solid {
    border-color: #E8A090;
    background: linear-gradient(135deg, #FFF0EA, #FFD9CC);
}

.hw-sent-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.hw-sent-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.hw-sent-summary article {
    display: grid;
    gap: 0.15rem;
    padding: 0.85rem 0.95rem;
    border-radius: 18px;
    border: 1px solid #ECE5DF;
    background: linear-gradient(160deg, #fff, #FFF8F4);
}

.hw-sent-summary strong {
    color: #E96B56;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.hw-sent-summary span {
    color: #817672;
    font-size: 0.78rem;
    font-weight: 750;
}

.hw-sent-panel {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
    padding: 1rem 1.05rem 1.1rem;
    border: 1px solid #ECE5DF;
    border-radius: 22px;
    background: #FFFCFA;
    box-shadow: 0 8px 20px rgba(86, 58, 42, 0.05);
}

.hw-sent-panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 850;
}

.hw-sent-panel-head p {
    margin: 0.25rem 0 0;
    color: #817672;
    font-size: 0.84rem;
    font-weight: 700;
}

.hw-sent-students {
    display: grid;
    gap: 0.55rem;
}

.hw-sent-student {
    border: 1px solid #ECE5DF;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.hw-sent-student summary {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) auto auto auto minmax(4.5rem, 0.75fr) auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    list-style: none;
}

.hw-sent-student summary::-webkit-details-marker { display: none; }

.hw-sent-student-name {
    font-weight: 850;
    color: #332D2B;
}

.hw-sent-student-status {
    display: inline-flex;
    align-items: center;
    min-height: 1.4rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: #F4EEE8;
    color: #817672;
    font-size: 0.72rem;
    font-weight: 850;
}

.hw-sent-student.tone-completed .hw-sent-student-status {
    background: #E3F5EA;
    color: #2F9A5B;
}

.hw-sent-student.tone-in_progress .hw-sent-student-status {
    background: #FFF0E9;
    color: #E96B56;
}

.hw-sent-student-score,
.hw-sent-student-pct,
.hw-sent-student-stars {
    color: #5C524E;
    font-size: 0.82rem;
    font-weight: 800;
}

.hw-sent-student-stars {
    color: #C7921C;
    white-space: nowrap;
}

.hw-sent-student-bar {
    display: block;
    height: 0.45rem;
    border-radius: 999px;
    background: #F1E8E1;
    overflow: hidden;
}

.hw-sent-student-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #F2A78A, #E96B56);
}

.hw-sent-student-body {
    padding: 0 0.85rem 0.85rem;
    border-top: 1px solid #F3EBE4;
}

.hw-sent-student-meta {
    margin: 0.65rem 0 0.5rem;
    color: #817672;
    font-size: 0.8rem;
    font-weight: 700;
}

.hw-sent-attempt-list {
    list-style: none;
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.hw-sent-attempt-list li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: start;
    padding: 0.55rem 0.65rem;
    border-radius: 12px;
    background: #FFF9F5;
}

.hw-sent-attempt-list li.is-ok { background: #F3FAF5; }
.hw-sent-attempt-list li.is-ng { background: #FFF1EC; }
.hw-sent-attempt-list li.is-pending { background: #F7F4F1; }

.hw-sent-attempt-mark {
    width: 1.35rem;
    text-align: center;
    font-weight: 900;
    color: #817672;
}

.hw-sent-attempt-list li.is-ok .hw-sent-attempt-mark { color: #2F9A5B; }
.hw-sent-attempt-list li.is-ng .hw-sent-attempt-mark { color: #E96B56; }

.hw-sent-attempt-main {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.hw-sent-attempt-main strong {
    font-size: 0.82rem;
    font-weight: 850;
}

.hw-sent-attempt-main small {
    color: #817672;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.4;
}

.hw-sent-attempt-side {
    color: #817672;
    font-size: 0.74rem;
    font-weight: 750;
    white-space: nowrap;
}

.hw-sent-q-table {
    display: grid;
    gap: 0.35rem;
}

.hw-sent-q-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) repeat(4, minmax(3.2rem, 0.55fr));
    gap: 0.55rem;
    align-items: center;
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #F0E8E1;
}

.hw-sent-q-row.is-head {
    background: #FFF5F0;
    border-color: transparent;
    color: #817672;
    font-size: 0.74rem;
    font-weight: 850;
}

.hw-sent-q-prompt {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.hw-sent-q-prompt strong {
    font-size: 0.84rem;
    font-weight: 850;
}

.hw-sent-q-prompt small {
    color: #817672;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.4;
}

.hw-sent-q-warn {
    color: #C88768;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 800;
}

.hw-sent-empty {
    margin: 0;
    color: #817672;
    font-size: 0.9rem;
    font-weight: 700;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 1600px) {
    .hw-lib-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1280px) {
    .hw-lib-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .hw-lib-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hw-sent-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .hw-hub-cards {
        grid-template-columns: 1fr;
    }

    .hw-lib-grid,
    .hw-lib-grid.is-sent {
        grid-template-columns: 1fr;
    }

    .hw-sent-student summary {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas:
            "name status status"
            "bar bar bar"
            "score stars pct";
    }

    .hw-sent-student-name { grid-area: name; }
    .hw-sent-student-status { grid-area: status; }
    .hw-sent-student-bar { grid-area: bar; }
    .hw-sent-student-score { grid-area: score; }
    .hw-sent-student-stars { grid-area: stars; }
    .hw-sent-student-pct { grid-area: pct; }

    .hw-sent-q-row,
    .hw-sent-q-row.is-head {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .hw-sent-q-row > :nth-child(4),
    .hw-sent-q-row > :nth-child(5) {
        display: none;
    }

    .hw-lib-create-btn {
        width: 100%;
    }

    .hw-lib-hero {
        padding: 1rem;
    }

    .hw-lib-search {
        max-width: none;
    }

    .hw-lib-filters {
        width: 100%;
    }

    .hw-lib-filter {
        flex: 1 1 auto;
    }

    .hw-lib-filter select {
        width: 100%;
    }
}

dialog.hw-translate-dialog {
    width: min(34rem, calc(100vw - 1.5rem));
}

.hw-translate-card {
    max-height: min(86vh, 44rem);
}

.hw-translate-lead,
.hw-translate-tip,
.hw-translate-note {
    margin: 0.35rem 0 0;
    color: #8A7468;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.5;
}

.hw-translate-tip {
    margin-top: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    background: #FFF5EA;
    color: #C45E34;
    border: 1px solid #F0D2BC;
}

.hw-translate-note {
    color: #B4533A;
}

.hw-translate-list {
    display: grid;
    gap: 0.65rem;
    max-height: min(52vh, 24rem);
    overflow: auto;
    padding-right: 0.15rem;
}

.hw-translate-row {
    display: grid;
    gap: 0.28rem;
}

.hw-translate-en {
    color: #3B2C26;
    font-size: 0.98rem;
    font-weight: 800;
}

dialog.hw-translate-dialog input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 2.6rem;
    margin: 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid #E8D9CC;
    border-radius: 12px;
    background: #fff;
    color: #3B2C26;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
}

dialog.hw-translate-dialog .gc-confirm-ok:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
