/* Shared and embedded language hub */
.language-setup-panel {
    background:
        linear-gradient(rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.92);
    background-size: 24px 24px;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(83, 78, 70, 0.08);
    min-height: 520px;
    padding: 44px 22px;
    text-align: left;
}

.language-setup-logo {
    color: #33352f;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 42px;
    text-align: center;
}

.language-keyword-row,
.language-select-row {
    align-items: center;
    color: #33352f;
    display: grid;
    gap: 14px;
    grid-template-columns: 100px 1fr;
    font-family: Georgia, serif;
    font-size: 22px;
    margin-bottom: 18px;
}

.language-keyword-row input,
.language-select-row select {
    background: rgba(255, 253, 247, 0.78);
    border: 2px solid #33352f;
    border-radius: 3px;
    color: #33352f;
    font: inherit;
    font-size: 18px;
    min-width: 0;
    padding: 8px 10px;
}

.keyword-input-wrapper {
    align-items: center;
    display: flex;
    gap: 8px;
}

.keyword-input-wrapper input {
    flex: 1;
}

.keyword-add-btn {
    align-items: center;
    background: #7f9a82;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    flex: 0 0 36px;
    font-size: 24px;
    font-weight: 700;
    height: 36px;
    justify-content: center;
    line-height: 1;
    width: 36px;
}

.keyword-add-btn:hover {
    background: #6d8673;
}

.language-suggested-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 22px;
}

.language-suggested-keywords button {
    background: transparent;
    border: 2px solid #b8cab2;
    border-radius: 999px;
    color: #4d7555;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 14px;
}

.language-suggested-keywords button:hover {
    background: #edf6ee;
}

.language-start-btn {
    background: #7f9a82;
    border: none;
    border-radius: 999px;
    color: white;
    cursor: pointer;
    display: block;
    font-size: 16px;
    font-weight: 800;
    margin: 42px auto 0;
    padding: 13px 38px;
}

.language-study-panel[hidden],
.language-setup-panel[hidden] {
    display: none;
}

.language-setup-back {
    margin-bottom: 14px;
}

.language-theme-menu {
    background:
        linear-gradient(rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.92);
    background-size: 24px 24px;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(83, 78, 70, 0.08);
    min-height: 500px;
    padding: 28px 22px;
    text-align: left;
}

body.language-study-wide {
    max-width: none;
    overflow-x: hidden;
    padding-left: clamp(18px, 4vw, 54px);
    padding-right: clamp(18px, 4vw, 54px);
}

body.language-study-wide #language-hub-panel {
    margin: 0 auto;
    max-width: 1560px;
    width: 100%;
}

body.language-study-wide .hub-panel-header {
    margin-left: auto;
    margin-right: auto;
    max-width: 1280px;
}

body.language-study-wide .hub-panel-header h2 {
    font-size: clamp(34px, 4vw, 54px);
}

body.language-study-wide .language-study-panel {
    margin: 0 auto;
    max-width: 1480px;
    width: 100%;
}

body.language-study-wide .language-setup-back {
    display: block;
    margin: 0 auto 18px;
    width: fit-content;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    display: grid;
    gap: 22px;
    grid-template-areas:
        "title title"
        "words conversation"
        "words practice";
    grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    margin: 0 auto;
    max-height: calc(100vh - 230px);
    max-width: 1320px;
    min-height: min(760px, calc(100vh - 230px));
    overflow: hidden;
    padding: 30px;
}

body.language-study-wide .language-theme-menu h3 {
    grid-area: title;
    margin-bottom: 0;
}

body.language-study-wide .generated-section {
    margin-top: 0;
    min-width: 0;
}

body.language-study-wide .generated-section:first-of-type {
    grid-area: words;
    overflow: hidden;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    grid-area: conversation;
    min-height: 0;
    overflow: hidden;
}

body.language-study-wide .quick-test-card {
    grid-area: practice;
    margin: 0;
    min-width: 0;
}

body.language-study-wide .floating-test-entry {
    grid-area: practice;
    justify-self: end;
    margin: 0;
    min-width: 0;
}

body.language-study-wide .generated-section-title {
    grid-template-columns: 1fr auto;
    margin-bottom: 16px;
}

body.language-study-wide .generated-section-title span:first-child {
    display: none;
}

body.language-study-wide .generated-section-title h4 {
    font-size: clamp(28px, 3vw, 42px);
}

body.language-study-wide .theme-menu-note {
    border-radius: 999px;
    padding: 7px 12px;
}

body.language-study-wide .generated-word-list {
    max-height: calc(100vh - 390px);
    overflow-y: auto;
    padding-right: 10px;
}

body.language-study-wide .generated-word-card {
    grid-template-columns: 44px 1fr;
    padding: 8px 0 16px;
}

body.language-study-wide .generated-word-main strong {
    font-size: clamp(26px, 2.4vw, 42px);
}

body.language-study-wide .generated-word-main span {
    font-size: 18px;
}

body.language-study-wide .generated-word-main small {
    font-size: 17px;
}

body.language-study-wide .generated-conversation {
    max-height: calc(100vh - 460px);
    overflow-y: auto;
    padding-right: 8px;
}

body.language-study-wide .conversation-bubble {
    max-width: 88%;
}

body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    align-self: end;
}

body.language-study-wide .quick-test-card {
    max-width: none;
    justify-self: start;
    width: calc(50% - 8px);
}

body.language-study-wide .floating-test-entry {
    bottom: auto;
    left: auto;
    max-width: none;
    position: static;
    transform: none;
    width: calc(50% - 8px);
    z-index: auto;
}

.language-theme-menu[hidden],
.language-test-panel[hidden] {
    display: none;
}

.language-theme-menu h3 {
    color: #33352f;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 600;
    margin: 0 0 22px;
}

.theme-menu-item {
    align-items: center;
    background: transparent;
    border: none;
    color: #33352f;
    cursor: pointer;
    display: grid;
    font: inherit;
    font-family: Georgia, serif;
    font-size: 25px;
    grid-template-columns: 38px 1fr auto;
    margin: 16px 0;
    padding: 8px 0;
    text-align: left;
    width: 100%;
}

.theme-menu-item:hover {
    color: var(--primary);
}

.theme-menu-number {
    font-weight: 700;
}

.theme-menu-disabled {
    cursor: default;
    color: #33352f;
}

.theme-menu-note {
    border: 2px solid #b94f45;
    border-radius: 50%;
    color: #b94f45;
    font-family: 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 6px;
}

.theme-menu-description {
    border-top: 3px solid #33352f;
    color: #33352f;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    margin-top: 34px;
    padding-top: 16px;
}

.language-test-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    padding: 22px;
    text-align: left;
}

.language-test-panel h3 {
    color: #33352f;
    font-size: 32px;
    margin: 0 0 12px;
}

.test-placeholder-card {
    border: 2px dashed #d7d0c5;
    border-radius: 8px;
    color: #777d74;
    font-weight: 800;
    margin-top: 18px;
    padding: 32px;
    text-align: center;
}

.language-keyword-row,
.language-select-row {
    align-items: center;
    color: #33352f;
    display: grid;
    gap: 14px;
    grid-template-columns: 100px 1fr;
    font-family: Georgia, serif;
    font-size: 22px;
    margin-bottom: 18px;
}

.language-keyword-row input,
.language-select-row select {
    background: rgba(255, 253, 247, 0.78);
    border: 2px solid #33352f;
    border-radius: 3px;
    color: #33352f;
    font: inherit;
    font-size: 18px;
    min-width: 0;
    padding: 8px 10px;
}

.language-suggested-keywords {
    margin-bottom: 22px;
}

.language-suggested-keywords button.is-selected {
    background: #7f9a82;
    border-color: #7f9a82;
    color: #fff;
}

.language-word-count-row {
    margin-bottom: 18px;
}

.generated-study-card {
    padding-bottom: 120px;
}

.language-theme-menu.is-review-check-mode {
    margin: 0 auto;
    max-width: 680px;
    min-height: auto;
    padding: 30px 24px 34px;
}

.language-theme-menu.is-review-check-mode h3 {
    color: #33352f;
    font-size: 34px;
    margin-bottom: 18px;
    text-align: center;
}

.language-theme-menu.is-review-check-mode .generated-section,
.language-theme-menu.is-review-check-mode .floating-test-entry {
    display: none;
}

.language-theme-menu.is-review-check-mode .quick-test-card {
    border: 2px solid rgba(127, 154, 130, 0.22);
    box-shadow: 0 18px 42px rgba(83, 78, 70, 0.16);
    margin: 0 auto;
    max-width: 560px;
    padding: 30px 24px 28px;
}

.language-theme-menu.is-review-check-mode .quick-test-card h4 {
    color: #7f9a82;
    font-size: 15px;
    letter-spacing: 0.08em;
    text-align: center;
}

.word-check-review-deck {
    background:
        linear-gradient(rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.94);
    background-size: 24px 24px;
    border: 2px solid #d7d0c5;
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(83, 78, 70, 0.12);
    margin: 0 auto;
    max-width: 680px;
    padding: 24px;
    text-align: center;
}

.word-check-review-deck[hidden] {
    display: none;
}

.word-check-review-head {
    align-items: center;
    display: grid;
    gap: 16px;
    grid-template-columns: auto 1fr;
    margin-bottom: 18px;
    text-align: left;
}

.word-check-review-head p {
    color: #7f9a82;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.16em;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.word-check-review-head h3 {
    color: #33352f;
    font-family: Georgia, serif;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
}

.word-check-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 18px;
}

.word-check-counts span {
    background: rgba(255, 253, 247, 0.86);
    border: 1px solid #e7e1d8;
    border-radius: 999px;
    color: #777d74;
    font-size: 12px;
    font-weight: 900;
    padding: 7px 12px;
}

.word-check-counts strong {
    color: #33352f;
}

.word-check-counts .is-perfect strong {
    color: var(--perfect-color);
}

.word-check-counts .is-review strong {
    color: #c99a10;
}

.word-check-counts .is-wrong strong {
    color: var(--wrong-color);
}

.word-check-mode {
    align-items: center;
    color: #777d74;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    gap: 9px;
    margin-bottom: 18px;
}

.word-check-mode input {
    accent-color: #7f9a82;
}

.word-check-flashcard {
    cursor: pointer;
    height: 300px;
    margin: 0 auto;
    max-width: 460px;
    perspective: 1100px;
    width: 100%;
}

.word-check-card-inner {
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 100%;
}

.word-check-flashcard.is-flipped .word-check-card-inner {
    transform: rotateY(180deg);
}

.word-check-card-face {
    align-items: center;
    backface-visibility: hidden;
    background: #fffdf7;
    border: 2px solid #33352f;
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(83, 78, 70, 0.14);
    color: #33352f;
    display: flex;
    flex-direction: column;
    inset: 0;
    justify-content: center;
    padding: 28px;
    position: absolute;
}

.word-check-card-back {
    background: #eef8ef;
    transform: rotateY(180deg);
}

.word-large {
    font-family: Georgia, serif;
    font-size: clamp(34px, 7vw, 58px);
    font-weight: 700;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.word-sub {
    color: #4d7555;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.example {
    color: #73786f;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.6;
    margin-top: 18px;
}

.word-check-actions {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, 1fr);
    margin: 22px auto 0;
    max-width: 460px;
}

.word-check-action {
    border: 0;
    border-radius: 999px;
    color: white;
    cursor: pointer;
    font-size: 15px;
    font-weight: 900;
    min-height: 52px;
    padding: 0 14px;
}

.word-check-action.is-wrong {
    background: var(--wrong-color);
}

.word-check-action.is-review {
    background: var(--review-color);
    color: #6f5600;
    font-size: 24px;
}

.word-check-action.is-perfect {
    background: var(--perfect-color);
}

.language-theme-menu[hidden],
.language-test-overlay[hidden] {
    display: none;
}

.generated-section {
    margin-top: 28px;
}

.generated-section-title {
    align-items: center;
    color: #33352f;
    display: grid;
    font-family: Georgia, serif;
    gap: 12px;
    grid-template-columns: auto 1fr auto;
    margin-bottom: 14px;
}

.generated-section-title span:first-child {
    font-size: 28px;
    font-weight: 800;
}

.generated-section-title h4 {
    color: #7f9a82;
    font-size: 27px;
    font-weight: 600;
    margin: 0;
}

.generated-word-list {
    display: grid;
    gap: 12px;
}

.generated-word-card {
    display: grid;
    gap: 12px;
    grid-template-columns: 34px 1fr;
    padding: 2px 0 12px;
    position: relative;
}

.generated-word-card:not(:last-child)::after {
    background: rgba(215, 208, 197, 0.8);
    bottom: 0;
    content: "";
    height: 1px;
    left: 46px;
    position: absolute;
    right: 0;
}

.generated-word-card .word-index {
    color: #4d7555;
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
    padding-top: 2px;
    text-align: center;
}

.generated-word-main {
    min-width: 0;
}

.generated-word-main strong {
    color: #2f332d;
    display: block;
    font-size: 22px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.generated-word-main span {
    color: #536858;
    display: block;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;
    margin-top: 2px;
}

.generated-word-main small {
    color: #73786f;
    display: block;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 6px;
}

.generated-conversation {
    display: grid;
    gap: 24px;
    padding-top: 4px;
}

.conversation-scene {
    display: grid;
    gap: 14px;
}

.conversation-scene h5 {
    color: #4d7555;
    font-family: Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.conversation-line {
    align-items: start;
    display: flex;
    gap: 12px;
}

.conversation-line.is-user {
    justify-content: flex-end;
}

.conversation-avatar {
    align-items: center;
    background: #eaf4e9;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 44px;
    height: 44px;
    justify-content: center;
    overflow: visible;
    position: relative;
    width: 44px;
}

.conversation-avatar.user-avatar {
    background: #a7bea3;
}

.conversation-avatar.user-avatar::after {
    background: #a7bea3;
    border: 2px solid #fff;
    border-radius: 50%;
    bottom: -5px;
    content: "";
    height: 18px;
    position: absolute;
    right: -4px;
    width: 18px;
}

.conversation-avatar.user-avatar::before {
    border: 2px solid #fff;
    border-radius: 999px;
    bottom: 0;
    content: "";
    height: 8px;
    position: absolute;
    right: 3px;
    width: 5px;
    z-index: 2;
}

.conversation-avatar .squirrel-illo {
    transform: scale(0.46);
}

.conversation-bubble {
    background: #eef8ef;
    border-radius: 8px 22px 22px 22px;
    box-shadow: 0 3px 8px rgba(74, 70, 63, 0.08);
    color: #33352f;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.6;
    margin: 0;
    max-width: 78%;
    padding: 14px 16px;
    text-align: left;
}

.conversation-bubble p {
    margin: 0;
}

.conversation-bubble small {
    color: #687166;
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    margin-top: 6px;
}

.conversation-line.is-user .conversation-bubble {
    background: #fff;
    border: 1px solid #e7e1d8;
    border-radius: 22px 8px 22px 22px;
}

.conversation-highlight {
    background: linear-gradient(transparent 56%, rgba(127, 154, 130, 0.35) 56%);
    color: #2f5f38;
    font-weight: 900;
    padding: 0 2px;
}

.conversation-score {
    color: #67906b;
    font-size: 13px;
    font-weight: 800;
    margin: -12px 56px 0 auto;
    text-align: right;
}

.quick-test-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e8e1d8;
    border-radius: 28px;
    box-shadow: 0 10px 28px rgba(83, 78, 70, 0.12);
    margin-top: 34px;
    padding: 26px 18px 24px;
    text-align: center;
    transition: opacity 180ms ease, transform 180ms ease;
}

.quick-test-card.is-switching {
    opacity: 0;
    transform: translateY(10px);
}

.quick-test-card h4 {
    color: #8d918b;
    font-size: 14px;
    margin: 0 0 22px;
    text-align: left;
}

.quick-test-prompt {
    color: #33352f;
    display: grid;
    gap: 10px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.6;
    margin: 0 0 16px;
}

.quick-test-translation {
    color: #697267;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.quick-test-question {
    display: block;
}

.quick-test-blank {
    border-bottom: 3px solid #9bb99b;
    display: inline-block;
    height: 1.2em;
    min-width: 84px;
    vertical-align: -0.15em;
}

.quick-test-answer {
    background: #fff;
    border: 1px solid #dcd5ca;
    border-radius: 8px;
    color: #33352f;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
    min-height: 48px;
    padding: 10px 14px;
    width: 100%;
}

.quick-test-answer:focus {
    border-color: #9bb99b;
    box-shadow: 0 0 0 3px rgba(155, 185, 155, 0.2);
    outline: none;
}

.quick-test-button {
    align-items: center;
    background: #d2a06f;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(151, 98, 48, 0.18);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
    min-height: 56px;
    padding: 12px 22px;
    width: 100%;
}

.quick-test-button:disabled {
    background: #b7c8b3;
    cursor: default;
}

.quick-test-reward {
    color: #9b9f99;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    margin: 16px 0 0;
}

.language-acorn,
.test-entry-acorn {
    height: 18px;
    position: relative;
    width: 14px;
}

.floating-test-entry {
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 239, 0.98));
    border: 1px solid rgba(215, 208, 197, 0.95);
    border-radius: 24px;
    bottom: 24px;
    box-shadow: 0 18px 42px rgba(83, 78, 70, 0.2);
    color: #33352f;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: 42px 1fr auto;
    left: 50%;
    max-width: min(360px, calc(100% - 32px));
    min-height: 86px;
    padding: 14px 16px;
    position: fixed;
    text-align: left;
    transform: translateX(-50%);
    width: 100%;
    z-index: 10;
}

.floating-test-entry::before {
    background: #7f9a82;
    border-radius: 999px;
    content: "";
    height: 4px;
    left: 18px;
    position: absolute;
    right: 18px;
    top: -2px;
}

.test-entry-icon {
    align-items: center;
    background: #edf6ee;
    border: 2px solid #c6d9c6;
    border-radius: 50%;
    color: #4d7555;
    display: inline-flex;
    font-size: 22px;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    line-height: 1;
    width: 42px;
}

.test-entry-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.floating-test-entry strong {
    color: #30342f;
    display: block;
    font-size: 18px;
    line-height: 1.2;
}

.floating-test-entry small {
    color: #73806f;
    display: block;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.test-entry-reward {
    align-items: center;
    background: #d2a06f;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 14px;
    font-weight: 900;
    gap: 5px;
    justify-content: center;
    padding: 8px 10px;
    white-space: nowrap;
}

.language-test-overlay {
    align-items: center;
    background: rgba(48, 50, 45, 0.28);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 30;
}

.language-test-window {
    background: #fbfaf7;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(48, 50, 45, 0.28);
    height: min(620px, calc(100vh - 72px));
    max-width: 390px;
    overflow: hidden;
    position: relative;
    width: min(100%, 390px);
}

.language-test-window iframe {
    border: 0;
    height: 100%;
    width: 100%;
}

.test-close-btn {
    align-items: center;
    background: #fff;
    border: 2px solid #d7d0c5;
    border-radius: 999px;
    color: #33352f;
    cursor: pointer;
    display: inline-flex;
    font-size: 22px;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 10px;
    top: 10px;
    width: 34px;
    z-index: 2;
}

@media (max-width: 420px) {
    .language-keyword-row,
    .language-select-row {
        grid-template-columns: 1fr;
    }

    .generated-section-title {
        align-items: start;
        grid-template-columns: auto 1fr;
    }

    .theme-menu-note {
        grid-column: 2;
        justify-self: start;
    }

    .conversation-bubble {
        max-width: 74%;
    }
}

/* Strict split-screen study desk */
body.language-study-wide {
    background: #FDFBF7;
    height: 100vh;
    max-width: none;
    overflow: hidden;
    padding: 24px;
}

body.language-study-wide .home-topbar,
body.language-study-wide .bottom-nav,
body.language-study-wide .hub-panel-header,
body.language-study-wide .language-setup-back,
body.language-study-wide .language-theme-menu > h3,
body.language-study-wide .generated-section-title span:first-child {
    display: none;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    height: 100%;
    width: 100%;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    background: #FDFBF7;
    border: 0;
    box-shadow: none;
    display: flex;
    gap: 24px;
    height: 100%;
    margin: 0;
    max-width: none;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100%;
}

body.language-study-wide .generated-section:first-of-type {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 245, 244, 0.96);
    border-radius: 24px;
    box-shadow: 0 12px 28px rgba(83, 78, 70, 0.08);
    display: flex;
    flex: 0 0 calc(50% - 12px);
    flex-direction: column;
    height: 100%;
    margin: 0;
    min-width: 0;
    overflow-y: auto;
    padding: 24px;
}

body.language-study-wide .generated-section:nth-of-type(2),
body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 245, 244, 0.96);
    border-radius: 24px;
    box-shadow: 0 12px 28px rgba(83, 78, 70, 0.08);
}

body.language-study-wide .generated-section:nth-of-type(2) {
    flex: 0 0 calc((50% - 12px) * 0.666);
    height: calc(66.666% - 8px);
    margin: 0 0 0 auto;
    min-width: 0;
    overflow-y: auto;
    padding: 24px;
    position: absolute;
    right: 0;
    top: 0;
    width: calc(50% - 12px);
}

body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    bottom: 0;
    height: calc(33.333% - 16px);
    margin: 0;
    max-width: none;
    min-height: 0;
    padding: 16px;
    position: absolute;
    transform: none;
    width: calc((50% - 36px) / 2);
    z-index: auto;
}

body.language-study-wide .floating-test-entry {
    align-items: center;
    color: #33352f;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    left: calc(50% + 12px);
    text-align: center;
}

body.language-study-wide .quick-test-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    left: calc(75% + 6px);
    text-align: center;
}

body.language-study-wide .floating-test-entry::before {
    display: none;
}

body.language-study-wide .generated-section-title {
    display: block;
    margin: 0 0 18px;
}

body.language-study-wide .generated-section-title h4 {
    color: #7f9a82;
    font-size: 22px;
    font-weight: 900;
    margin: 0;
}

body.language-study-wide .generated-word-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 18px;
    overflow: visible;
}

.word-nav-feature {
    border-bottom: 1px solid rgba(214, 211, 209, 0.7);
    display: grid;
    gap: 8px;
    padding-bottom: 20px;
}

.word-nav-feature > span {
    color: #a8a29e;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.word-nav-feature h5 {
    color: #2f332d;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(48px, 6vw, 72px);
    line-height: 0.95;
    margin: 0;
    overflow-wrap: anywhere;
}

.word-nav-feature p {
    color: #4d7555;
    font-size: 24px;
    font-weight: 900;
    margin: 0;
}

.word-nav-feature small {
    color: #6f776b;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.55;
}

.word-nav-list {
    display: grid;
    gap: 10px;
    overflow-y: auto;
    padding-right: 8px;
}

body.language-study-wide .generated-word-card {
    align-items: center;
    background: rgba(255, 253, 247, 0.72);
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    display: grid;
    gap: 12px;
    grid-template-columns: 34px 1fr;
    padding: 12px;
    text-align: left;
}

body.language-study-wide .generated-word-card.is-selected {
    background: rgba(232, 240, 235, 0.88);
    border-color: rgba(130, 168, 154, 0.32);
}

body.language-study-wide .generated-word-card::after {
    display: none;
}

body.language-study-wide .generated-word-card .word-index {
    color: #4d7555;
    font-size: 18px;
}

body.language-study-wide .generated-word-main strong {
    font-size: 22px;
}

body.language-study-wide .generated-word-main span {
    font-size: 13px;
}

body.language-study-wide .generated-conversation {
    display: grid;
    gap: 16px;
    max-height: none;
    overflow: visible;
}

body.language-study-wide .conversation-line {
    gap: 8px;
}

body.language-study-wide .conversation-avatar {
    flex-basis: 34px;
    height: 34px;
    width: 34px;
}

body.language-study-wide .conversation-bubble {
    background: rgba(255, 255, 255, 0.68);
    border-radius: 20px;
    font-size: 15px;
    max-width: 82%;
    padding: 13px 15px;
}

body.language-study-wide .conversation-line.is-user .conversation-bubble {
    background: rgba(255, 245, 223, 0.86);
}

body.language-study-wide .conversation-highlight {
    color: #d4a373;
}

body.language-study-wide .theme-menu-note {
    border-radius: 999px;
    padding: 7px 12px;
}

body.language-study-wide .test-entry-icon {
    align-items: center;
    animation: micBreathMini 2.2s ease-in-out infinite;
    background: #fffdf7;
    border-color: rgba(130, 168, 154, 0.32);
    display: flex;
    flex: 0 0 56px;
    height: 56px;
    justify-content: center;
    width: 56px;
}

body.language-study-wide .test-entry-copy {
    justify-items: center;
}

body.language-study-wide .test-entry-reward {
    display: none;
}

body.language-study-wide .quick-test-card h4 {
    color: #7f9a82;
    font-size: 16px;
    margin: 0 0 12px;
    text-align: center;
}

body.language-study-wide .quick-test-prompt {
    font-size: 15px;
    margin-bottom: 10px;
}

body.language-study-wide .quick-test-answer {
    background: transparent;
    border: 0;
    border-bottom: 2px dashed #d4a373;
    border-radius: 0;
    box-shadow: none;
    min-height: 40px;
    text-align: center;
}

body.language-study-wide .quick-test-answer:focus {
    border-bottom-style: solid;
    box-shadow: none;
}

body.language-study-wide .quick-test-button {
    min-height: 42px;
}

body.language-study-wide .quick-test-reward {
    display: none;
}

@keyframes micBreathMini {
    50% {
        box-shadow: 0 0 0 12px rgba(130, 168, 154, 0);
        transform: translateY(-2px);
    }
}

@media (max-width: 900px) {
    body.language-study-wide {
        height: auto;
        overflow: auto;
    }

    body.language-study-wide .language-theme-menu.generated-study-card {
        display: grid;
        height: auto;
    }

    body.language-study-wide .generated-section:first-of-type,
    body.language-study-wide .generated-section:nth-of-type(2),
body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    height: auto;
    left: auto;
    position: static;
    width: 100%;
}
}

/* Final no-overlap override: this must stay at EOF so absolute test cards cannot win. */
body.language-study-wide .language-theme-menu.generated-study-card {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 65fr 35fr;
    height: 100%;
    min-height: 720px;
    min-width: 976px;
    overflow: visible;
    position: relative;
}

body.language-study-wide .generated-section:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    height: auto;
    left: auto;
    min-height: 0;
    position: static;
    top: auto;
    width: auto;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    height: auto;
    left: auto;
    min-height: 0;
    overflow: hidden;
    position: static;
    top: auto;
    width: auto;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    bottom: auto;
    grid-column: 2;
    grid-row: 2;
    height: auto;
    left: auto;
    min-height: 0;
    position: static;
    right: auto;
    top: auto;
    width: calc(50% - 12px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
}

body.language-study-wide .generated-conversation {
    align-content: start;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px 24px;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    width: 100%;
}

body.language-study-wide .conversation-line {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.language-study-wide .conversation-line.is-user {
    justify-content: flex-end;
}

body.language-study-wide .conversation-bubble {
    flex: 0 1 auto;
    max-width: min(82%, 520px);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.language-study-wide .conversation-bubble p,
body.language-study-wide .conversation-bubble small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Hard fix for the left card: one natural scroll flow down to the card bottom. */
body.language-study-wide .generated-section:first-of-type {
    display: block;
    overflow-y: auto;
    padding: 20px 24px 32px;
}

body.language-study-wide .generated-word-list {
    display: block;
    height: auto;
    max-height: none;
    min-height: 100%;
    overflow: visible;
}

body.language-study-wide .word-nav-feature {
    margin-bottom: 18px;
}

body.language-study-wide .word-nav-list {
    display: grid;
    gap: 10px;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 0 8px 24px 0;
}

body.language-study-wide .generated-word-card {
    min-height: 76px;
}

/* Left word list containment: keep every word reachable down to the bottom. */
body.language-study-wide .generated-section:first-of-type {
    display: flex;
    flex-direction: column;
    padding: 20px 24px 0;
}

body.language-study-wide .generated-section:first-of-type .generated-section-title,
body.language-study-wide .word-nav-feature {
    flex: 0 0 auto;
}

body.language-study-wide .generated-word-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

body.language-study-wide .word-nav-list {
    display: grid;
    flex: 1 1 auto;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 28px 0;
    scroll-padding-bottom: 28px;
}

body.language-study-wide .generated-word-card:last-child {
    margin-bottom: 4px;
}

/* Fullscreen fill override: use the entire viewport without letting cards overlap. */
body.language-study-wide {
    box-sizing: border-box;
    height: 100vh;
    margin: 0;
    max-width: none;
    min-height: 768px;
    min-width: 1024px;
    overflow: auto;
    padding: 0;
    width: 100%;
}

body.language-study-wide *,
body.language-study-wide *::before,
body.language-study-wide *::after {
    box-sizing: border-box;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    height: 100%;
    margin: 0;
    max-width: none;
    min-height: 768px;
    padding: 0;
    width: 100%;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    background: #FDFBF7;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 65fr) minmax(0, 35fr);
    height: 100vh;
    margin: 0;
    max-height: none;
    max-width: none;
    min-height: 768px;
    min-width: 1024px;
    overflow: hidden;
    padding: 18px;
    position: relative;
    width: 100vw;
}

body.language-study-wide .generated-section:first-of-type,
body.language-study-wide .generated-section:nth-of-type(2),
body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    margin: 0;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: static;
}

body.language-study-wide .generated-section:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 100%;
    width: 100%;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    padding: 0;
    width: 100%;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    align-self: stretch;
    bottom: auto;
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    left: auto;
    right: auto;
    top: auto;
    width: calc(50% - 9px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
}

body.language-study-wide .generated-word-list,
body.language-study-wide .word-nav-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

body.language-study-wide .generated-section:nth-of-type(2) .generated-section-title {
    flex: 0 0 auto;
    margin: 0;
    padding: 18px 22px 10px;
}

body.language-study-wide .generated-conversation {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 22px 22px;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    width: 100%;
}

body.language-study-wide .conversation-line {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.language-study-wide .conversation-avatar {
    flex: 0 0 34px;
}

body.language-study-wide .conversation-bubble {
    flex: 0 1 auto;
    max-width: min(82%, 560px);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 900px) {
    body.language-study-wide .language-theme-menu.generated-study-card {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        min-width: 0;
    }

    body.language-study-wide .generated-section:first-of-type,
    body.language-study-wide .generated-section:nth-of-type(2),
    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
    }
}

/* Final layout lock: keep the four study boxes in separate grid-owned cells. */
body.language-study-wide .language-theme-menu.generated-study-card {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 65fr 35fr;
    height: 100%;
    min-height: 720px;
    min-width: 976px;
    overflow: visible;
    position: relative;
}

body.language-study-wide .generated-section:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    height: auto;
    left: auto;
    min-height: 0;
    position: static;
    top: auto;
    width: auto;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    height: auto;
    left: auto;
    min-height: 0;
    overflow: hidden;
    position: static;
    top: auto;
    width: auto;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    bottom: auto;
    grid-column: 2;
    grid-row: 2;
    height: auto;
    left: auto;
    min-height: 0;
    position: static;
    right: auto;
    top: auto;
    width: calc(50% - 12px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
}

body.language-study-wide .generated-conversation {
    align-content: start;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px 24px;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    width: 100%;
}

body.language-study-wide .conversation-line {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.language-study-wide .conversation-line.is-user {
    justify-content: flex-end;
}

body.language-study-wide .conversation-bubble {
    flex: 0 1 auto;
    max-width: min(82%, 520px);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.language-study-wide .conversation-bubble p,
body.language-study-wide .conversation-bubble small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 900px) {
    body.language-study-wide .language-theme-menu.generated-study-card {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        min-width: 0;
    }

    body.language-study-wide .generated-section:first-of-type,
    body.language-study-wide .generated-section:nth-of-type(2),
    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
    }
}

/* Non-overlap hard layout: four boxes are owned by CSS grid, not absolute math */
body.language-study-wide .language-theme-menu.generated-study-card {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 65fr 35fr;
    height: 100%;
    min-height: 720px;
    min-width: 976px;
    overflow: visible;
}

body.language-study-wide .generated-section:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    height: auto;
    min-height: 0;
    position: static;
    width: auto;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
    height: auto;
    min-height: 0;
    position: static;
    width: auto;
}

body.language-study-wide .floating-test-entry {
    grid-column: 2;
    grid-row: 2;
    height: auto;
    left: auto;
    min-height: 0;
    position: static;
    width: auto;
}

body.language-study-wide .quick-test-card {
    grid-column: 2;
    grid-row: 2;
    height: auto;
    justify-self: end;
    left: auto;
    min-height: 0;
    position: static;
    width: calc(50% - 12px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
    width: calc(50% - 12px);
}

body.language-study-wide .generated-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.language-study-wide .generated-conversation {
    align-content: start;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

body.language-study-wide .conversation-line {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.language-study-wide .conversation-line.is-user {
    justify-content: flex-end;
}

body.language-study-wide .conversation-bubble {
    flex: 0 1 auto;
    max-width: min(82%, 520px);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.language-study-wide .conversation-bubble p,
body.language-study-wide .conversation-bubble small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 900px) {
    body.language-study-wide .language-theme-menu.generated-study-card {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: none;
        min-width: 0;
    }

    body.language-study-wide .generated-section:first-of-type,
    body.language-study-wide .generated-section:nth-of-type(2),
    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
    }
}

/* Emergency containment pass: strict split-screen proportions */
body.language-study-wide {
    background: #FDFBF7;
    height: 100vh;
    max-width: none;
    min-height: 768px;
    min-width: 1024px;
    overflow: auto;
    padding: 24px;
    width: 100%;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    height: 100%;
    min-height: 720px;
    width: 100%;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    background: #FDFBF7;
    border: 0;
    box-shadow: none;
    display: flex;
    gap: 24px;
    height: 100%;
    min-height: 720px;
    min-width: 976px;
    overflow: visible;
    padding: 0;
    position: relative;
    width: 100%;
}

body.language-study-wide .generated-section:first-of-type {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(245, 245, 244, 0.96);
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(83, 78, 70, 0.06);
    display: flex;
    flex: 0 0 calc(50% - 12px);
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 24px;
}

body.language-study-wide .generated-section:first-of-type .generated-section-title {
    flex: 0 0 auto;
}

body.language-study-wide .generated-word-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
}

body.language-study-wide .word-nav-feature {
    flex: 0 0 auto;
}

body.language-study-wide .word-nav-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(245, 245, 244, 0.96);
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(83, 78, 70, 0.06);
    display: flex;
    flex-direction: column;
    height: 65%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: calc(50% - 12px);
}

body.language-study-wide .generated-section:nth-of-type(2) .generated-section-title {
    flex: 0 0 auto;
    padding: 20px 24px 12px;
}

body.language-study-wide .generated-section:nth-of-type(2)::after {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(245, 245, 244, 0.96);
    color: #a8a29e;
    content: "Simulated conversation";
    flex: 0 0 54px;
    font-size: 12px;
    font-weight: 800;
    line-height: 54px;
    padding: 0 24px;
}

body.language-study-wide .generated-conversation {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px 24px;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

body.language-study-wide .conversation-bubble {
    max-width: min(88%, 520px);
    overflow-wrap: anywhere;
}

body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(245, 245, 244, 0.96);
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(83, 78, 70, 0.06);
    bottom: 0;
    display: flex;
    flex-direction: column;
    height: calc(35% - 24px);
    justify-content: center;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    position: absolute;
    text-align: center;
    transform: none;
    width: calc((50% - 36px) / 2);
}

body.language-study-wide .floating-test-entry {
    left: calc(50% + 12px);
}

body.language-study-wide .quick-test-card {
    left: calc(75% + 6px);
}

body.language-study-wide .test-entry-copy strong,
body.language-study-wide .quick-test-card h4 {
    color: #78716c;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 8px;
}

body.language-study-wide .test-entry-copy small,
body.language-study-wide .quick-test-reward,
body.language-study-wide .quick-test-translation {
    font-size: 11px;
    line-height: 1.35;
}

body.language-study-wide .quick-test-prompt {
    font-size: 13px;
    line-height: 1.35;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

body.language-study-wide .quick-test-answer {
    min-height: 34px;
    padding: 6px 8px;
}

body.language-study-wide .quick-test-button {
    font-size: 13px;
    min-height: 36px;
    padding: 8px 12px;
}

body.language-study-wide .test-entry-icon {
    flex: 0 0 46px;
    height: 46px;
    width: 46px;
}

body.language-study-wide .test-entry-reward {
    display: none;
}

body.language-study-wide .floating-test-entry::before {
    display: none;
}

@media (max-width: 900px) {
    body.language-study-wide {
        height: auto;
        overflow: auto;
    }

    body.language-study-wide .language-theme-menu.generated-study-card {
        display: grid;
        height: auto;
        overflow: visible;
    }

    body.language-study-wide .generated-section:first-of-type,
    body.language-study-wide .generated-section:nth-of-type(2),
    body.language-study-wide .quick-test-card,
    body.language-study-wide .floating-test-entry {
        height: auto;
        left: auto;
        position: static;
        width: 100%;
    }
}

/* EOF fullscreen lock: force the study desk to fill the viewport in four non-overlapping boxes. */
body.language-study-wide {
    box-sizing: border-box;
    height: 100vh;
    margin: 0;
    max-width: none;
    min-height: 768px;
    min-width: 1024px;
    overflow: auto;
    padding: 0;
    width: 100%;
}

body.language-study-wide *,
body.language-study-wide *::before,
body.language-study-wide *::after {
    box-sizing: border-box;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    height: 100%;
    margin: 0;
    max-width: none;
    min-height: 768px;
    padding: 0;
    width: 100%;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    background: #FDFBF7;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 65fr) minmax(0, 35fr);
    height: 100vh;
    margin: 0;
    max-height: none;
    max-width: none;
    min-height: 768px;
    min-width: 1024px;
    overflow: hidden;
    padding: 18px;
    position: relative;
    width: 100vw;
}

body.language-study-wide .generated-section:first-of-type {
    display: grid;
    grid-column: 1;
    grid-row: 1 / 3;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    left: auto;
    max-height: none;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    padding: 20px 24px 0;
    position: static;
    top: auto;
    width: 100%;
}

body.language-study-wide .generated-section:first-of-type .generated-section-title {
    align-self: start;
    margin: 0 0 18px;
}

body.language-study-wide .generated-word-list {
    display: grid;
    gap: 14px;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

body.language-study-wide .word-nav-feature {
    align-self: start;
    flex: none;
}

body.language-study-wide .word-nav-list {
    display: grid;
    gap: 10px;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 42px 0;
    scroll-padding-bottom: 42px;
}

body.language-study-wide .generated-word-card:last-child {
    margin-bottom: 4px;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    left: auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    position: static;
    top: auto;
    width: 100%;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    align-self: stretch;
    bottom: auto;
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    left: auto;
    min-height: 0;
    min-width: 0;
    position: static;
    right: auto;
    top: auto;
    width: calc(50% - 9px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
}

body.language-study-wide .generated-conversation {
    align-content: start;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px 24px;
}

body.language-study-wide .conversation-scene {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    width: 100%;
}

body.language-study-wide .conversation-line {
    align-items: flex-start;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.language-study-wide .conversation-line.is-user {
    justify-content: flex-end;
}

body.language-study-wide .conversation-bubble {
    flex: 0 1 auto;
    max-width: min(82%, 520px);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.language-study-wide .conversation-bubble p,
body.language-study-wide .conversation-bubble small {
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* Standalone language hub */
.language-setup-panel {
    background:
        linear-gradient(rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.92);
    background-size: 24px 24px;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(83, 78, 70, 0.08);
    min-height: 520px;
    padding: 44px 22px;
    text-align: left;
}

.language-setup-logo {
    color: #33352f;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 42px;
    text-align: center;
}

.language-keyword-row,
.language-select-row,
.language-count-row {
    align-items: center;
    color: #33352f;
    display: grid;
    gap: 14px;
    grid-template-columns: 100px 1fr;
    font-family: Georgia, serif;
    font-size: 22px;
    margin-bottom: 18px;
}

.language-keyword-row input,
.language-select-row select,
.language-count-row select {
    background: rgba(255, 253, 247, 0.78);
    border: 2px solid #33352f;
    border-radius: 3px;
    color: #33352f;
    font: inherit;
    font-size: 18px;
    min-width: 0;
    padding: 8px 10px;
}

.language-suggested-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 22px;
}

.language-suggested-keywords button {
    background: transparent;
    border: 2px solid #b8cab2;
    border-radius: 999px;
    color: #4d7555;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 14px;
}

.language-suggested-keywords button:hover {
    background: #edf6ee;
}

.language-suggested-keywords button.is-selected {
    background: #7f9a82;
    border-color: #7f9a82;
    color: #fff;
}

.language-count-row {
    margin-bottom: 50px;
}

.language-start-btn {
    background: #7f9a82;
    border: none;
    border-radius: 999px;
    color: white;
    cursor: pointer;
    display: block;
    font-size: 16px;
    font-weight: 800;
    margin: 42px auto 0;
    padding: 13px 38px;
}

.language-study-panel[hidden],
.language-setup-panel[hidden] {
    display: none;
}

.language-setup-back {
    margin-bottom: 14px;
}

.language-theme-menu {
    background:
        linear-gradient(rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 154, 130, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.92);
    background-size: 24px 24px;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(83, 78, 70, 0.08);
    min-height: 500px;
    padding: 28px 22px;
    text-align: left;
}

.language-theme-menu[hidden],
.language-test-overlay[hidden] {
    display: none;
}

.language-theme-menu h3 {
    color: #33352f;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 600;
    margin: 0 0 22px;
}

.theme-menu-item {
    align-items: center;
    background: transparent;
    border: none;
    color: #33352f;
    cursor: pointer;
    display: grid;
    font: inherit;
    font-family: Georgia, serif;
    font-size: 25px;
    grid-template-columns: 38px 1fr auto;
    margin: 16px 0;
    padding: 8px 0;
    text-align: left;
    width: 100%;
}

.theme-menu-item:hover {
    color: var(--primary);
}

.theme-menu-number {
    font-weight: 700;
}

.theme-menu-disabled {
    cursor: default;
    color: #33352f;
}

.theme-menu-note {
    border: 2px solid #b94f45;
    border-radius: 50%;
    color: #b94f45;
    font-family: 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 6px;
}

.theme-menu-description {
    border-top: 3px solid #33352f;
    color: #33352f;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    margin-top: 34px;
    padding-top: 16px;
}

.generated-study-card {
    padding-bottom: 96px;
}

.generated-section {
    margin-top: 28px;
}

.generated-section-title {
    align-items: center;
    color: #33352f;
    display: grid;
    font-family: Georgia, serif;
    gap: 12px;
    grid-template-columns: auto 1fr auto;
    margin-bottom: 14px;
}

.generated-section-title span:first-child {
    font-size: 28px;
    font-weight: 800;
}

.generated-section-title h4 {
    color: #7f9a82;
    font-size: 27px;
    font-weight: 600;
    margin: 0;
}

.generated-word-list {
    display: grid;
    gap: 12px;
}

.generated-word-card {
    display: grid;
    gap: 12px;
    grid-template-columns: 34px 1fr;
    padding: 2px 0 12px;
    position: relative;
}

.generated-word-card:not(:last-child)::after {
    background: rgba(215, 208, 197, 0.8);
    bottom: 0;
    content: "";
    height: 1px;
    left: 46px;
    position: absolute;
    right: 0;
}

.generated-word-card .word-index {
    align-items: center;
    color: #4d7555;
    display: inline-flex;
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 900;
    justify-content: center;
    line-height: 1.1;
    padding-top: 2px;
}

.generated-word-main {
    min-width: 0;
}

.generated-word-main strong {
    color: #2f332d;
    display: block;
    font-size: 22px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.generated-word-main span {
    color: #617063;
    display: block;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    margin-top: 2px;
}

.generated-word-main small {
    color: #73786f;
    display: block;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
}

.generated-conversation {
    display: grid;
    gap: 18px;
    padding: 4px 0 0;
}

.vocab-pack-builder {
    margin: 0 auto;
    max-width: 1120px;
    width: min(100%, 1120px);
}

.vocab-pack-head {
    margin-bottom: 24px;
    text-align: center;
}

.vocab-pack-head p,
.vocab-pack-meta {
    color: #6f7f70;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin: 0;
    text-transform: uppercase;
}

.vocab-pack-head h2 {
    color: #33352f;
    font-family: Georgia, serif;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.08;
    margin: 8px 0 0;
}

.vocab-smart-field,
.vocab-builder-group {
    color: #33352f;
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.vocab-smart-field > span,
.vocab-builder-group > span {
    color: #6f7f70;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.vocab-smart-field {
    position: relative;
}

.vocab-autocomplete-list {
    background: #fffdf7;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(83, 78, 70, 0.12);
    display: grid;
    left: 0;
    max-height: 240px;
    overflow-y: auto;
    position: absolute;
    right: 44px;
    top: calc(100% - 2px);
    z-index: 20;
}

.vocab-autocomplete-list[hidden] {
    display: none;
}

.vocab-autocomplete-list button {
    background: transparent;
    border: 0;
    color: #33352f;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 12px;
    text-align: left;
}

.vocab-autocomplete-list button:hover {
    background: #edf6ee;
}

.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

.keyword-chip {
    align-items: center;
    background: rgba(237, 246, 238, 0.86);
    border: 1px solid #b8cab2;
    border-radius: 999px;
    color: #4d7555;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
}

.keyword-chip button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    padding: 0;
}

.vocab-builder-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
}

.vocab-pack-builder .language-keyword-row,
.vocab-pack-builder .language-select-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
    margin: 0;
}

.vocab-pack-builder .language-select-row span {
    color: #6f7f70;
    font-family: var(--kanau-font-body);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.vocab-pack-builder .language-select-row select,
.vocab-pack-builder .language-keyword-row input,
.vocab-pack-builder .keyword-input-wrapper input {
    background: #fffdf7;
    border: 2px solid #b8cab2;
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
    font-family: var(--kanau-font-body);
    font-size: 14px;
    font-weight: 800;
    min-height: 42px;
}

.vocab-pack-builder .keyword-input-wrapper input:focus,
.vocab-pack-builder .language-select-row select:focus {
    border-color: #7f9a82;
    outline: 2px solid rgba(127, 154, 130, 0.18);
    outline-offset: 1px;
}

.vocab-pack-builder .language-suggested-keywords {
    justify-content: flex-start;
    margin: 0;
}

.vocab-pack-builder .language-suggested-keywords button {
    background: rgba(255, 253, 247, 0.92);
    border-color: #d7d0c5;
    color: #4d7555;
}

.vocab-pack-builder .language-suggested-keywords button.is-selected {
    background: #edf6ee;
    border-color: #7f9a82;
    color: #335f3d;
}

.vocab-segmented-control {
    background: rgba(255, 253, 247, 0.82);
    border: 1px solid #d7d0c5;
    border-radius: 999px;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(3, 1fr);
    padding: 4px;
}

.vocab-segmented-control button {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: #4d7555;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    min-height: 32px;
}

.vocab-segmented-control button.is-selected,
.vocab-segmented-control button:hover {
    background: #7f9a82;
    color: #fff;
}

.vocab-pack-meta {
    margin-top: -8px;
}

.generated-word-main em {
    color: #7f9a82;
    display: inline-block;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
    margin-top: 4px;
    text-transform: uppercase;
}

.generated-word-main b,
.vocab-learning-status {
    color: #8b8177;
    display: inline-block;
    font-size: 11px;
    font-weight: 900;
    margin-top: 4px;
    text-transform: uppercase;
}

.vocab-learning-status {
    background: rgba(237, 246, 238, 0.84);
    border: 1px solid #b8cab2;
    border-radius: 999px;
    color: #4d7555;
    padding: 4px 9px;
}

.vocab-word-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.vocab-word-actions button {
    background: rgba(255, 253, 247, 0.92);
    border: 1px solid #b8cab2;
    border-radius: 999px;
    color: #4d7555;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    min-height: 32px;
    padding: 0 12px;
}

.vocab-word-actions button:hover {
    background: #edf6ee;
}

@media (max-width: 640px) {
    .vocab-builder-grid {
        grid-template-columns: 1fr;
    }

    .vocab-autocomplete-list {
        right: 0;
    }
}

@media (min-width: 641px) and (max-width: 980px) {
    .vocab-builder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.conversation-line {
    align-items: start;
    display: flex;
    gap: 12px;
}

.conversation-line.is-user {
    justify-content: flex-end;
}

.conversation-avatar {
    align-items: center;
    background: #eaf4e9;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 44px;
    height: 44px;
    justify-content: center;
    overflow: visible;
    position: relative;
    width: 44px;
}

.conversation-avatar.user-avatar {
    background: #a7bea3;
}

.conversation-avatar.user-avatar::after {
    background: #a7bea3;
    border: 2px solid #fff;
    border-radius: 50%;
    bottom: -5px;
    color: #fff;
    content: "";
    height: 18px;
    position: absolute;
    right: -4px;
    width: 18px;
}

.conversation-avatar.user-avatar::before {
    border: 2px solid #fff;
    border-radius: 999px;
    bottom: 0;
    content: "";
    height: 8px;
    position: absolute;
    right: 3px;
    width: 5px;
    z-index: 2;
}

.conversation-avatar .squirrel-illo {
    transform: scale(0.46);
}

.conversation-bubble {
    background: #eef8ef;
    border-radius: 8px 22px 22px 22px;
    box-shadow: 0 3px 8px rgba(74, 70, 63, 0.08);
    color: #33352f;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.6;
    margin: 0;
    max-width: 78%;
    padding: 14px 16px;
    text-align: left;
}

.conversation-line.is-user .conversation-bubble {
    background: #fff;
    border: 1px solid #e7e1d8;
    border-radius: 22px 8px 22px 22px;
}

.conversation-highlight {
    background: linear-gradient(transparent 56%, rgba(127, 154, 130, 0.35) 56%);
    color: #2f5f38;
    font-weight: 900;
    padding: 0 2px;
}

.conversation-score {
    color: #67906b;
    font-size: 13px;
    font-weight: 800;
    margin: -12px 56px 0 auto;
    text-align: right;
}

.quick-test-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e8e1d8;
    border-radius: 28px;
    box-shadow: 0 10px 28px rgba(83, 78, 70, 0.12);
    margin-top: 34px;
    padding: 26px 18px 24px;
    text-align: center;
}

.quick-test-card h4 {
    color: #8d918b;
    font-size: 14px;
    margin: 0 0 22px;
    text-align: left;
}

.quick-test-prompt {
    color: #33352f;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.6;
    margin: 0 0 24px;
}

.quick-test-blank {
    border-bottom: 3px solid #9bb99b;
    color: transparent;
    display: inline-block;
    min-width: 84px;
}

.quick-test-button {
    align-items: center;
    background: #d2a06f;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(151, 98, 48, 0.18);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 900;
    gap: 8px;
    justify-content: center;
    min-height: 56px;
    padding: 12px 22px;
    width: 100%;
}

.quick-test-button:disabled {
    background: #b7c8b3;
    cursor: default;
}

.quick-test-reward {
    color: #9b9f99;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    margin: 16px 0 0;
}

.language-acorn {
    height: 19px;
    position: relative;
    width: 15px;
}

.floating-test-entry {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 239, 0.98)),
        #fff;
    border: 1px solid rgba(215, 208, 197, 0.95);
    border-radius: 24px;
    bottom: 24px;
    box-shadow: 0 18px 42px rgba(83, 78, 70, 0.2);
    color: #33352f;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: 42px 1fr auto;
    left: 50%;
    max-width: min(360px, calc(100% - 32px));
    min-height: 86px;
    padding: 14px 16px;
    position: fixed;
    text-align: left;
    transform: translateX(-50%);
    width: 100%;
    z-index: 10;
}

.floating-test-entry::before {
    background: #7f9a82;
    border-radius: 999px;
    content: "";
    height: 4px;
    left: 18px;
    position: absolute;
    right: 18px;
    top: -2px;
}

.floating-test-entry:hover {
    box-shadow: 0 22px 48px rgba(83, 78, 70, 0.24);
    transform: translateX(-50%) translateY(-2px);
}

.test-entry-icon {
    align-items: center;
    background: #edf6ee;
    border: 2px solid #c6d9c6;
    border-radius: 50%;
    color: #4d7555;
    display: inline-flex;
    font-size: 24px;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    line-height: 1;
    width: 42px;
}

.test-entry-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.floating-test-entry strong {
    color: #30342f;
    display: block;
    font-size: 18px;
    line-height: 1.2;
}

.floating-test-entry small {
    color: #73806f;
    display: block;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.test-entry-reward {
    align-items: center;
    background: #d2a06f;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 14px;
    font-weight: 900;
    gap: 5px;
    justify-content: center;
    padding: 8px 10px;
    white-space: nowrap;
}

.test-entry-acorn {
    height: 16px;
    position: relative;
    width: 13px;
}

.language-test-overlay {
    align-items: center;
    background: rgba(48, 50, 45, 0.28);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 30;
}

.language-test-window {
    background: #fbfaf7;
    border: 2px solid #d7d0c5;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(48, 50, 45, 0.28);
    height: min(620px, calc(100vh - 72px));
    max-width: 390px;
    overflow: hidden;
    position: relative;
    width: min(100%, 390px);
}

.language-test-window iframe {
    border: 0;
    height: 100%;
    width: 100%;
}

.test-close-btn {
    align-items: center;
    background: #fff;
    border: 2px solid #d7d0c5;
    border-radius: 999px;
    color: #33352f;
    cursor: pointer;
    display: inline-flex;
    font-size: 22px;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 10px;
    top: 10px;
    width: 34px;
    z-index: 2;
}

@media (max-width: 420px) {
    .language-keyword-row,
    .language-select-row,
    .language-count-row {
        grid-template-columns: 1fr;
    }

    .generated-section-title {
        align-items: start;
        grid-template-columns: auto 1fr;
    }

    .theme-menu-note {
        grid-column: 2;
        justify-self: start;
    }

    .conversation-bubble {
        max-width: 74%;
    }
}

/* Final generated Language Hub responsive layout override.
   Above half-screen width, keep the original study-desk layout.
   Below half-screen width, stack word list and simulated conversation;
   pronunciation and quick test stay side-by-side in the same row. */
body.language-study-wide {
    min-width: 0;
    overflow-x: hidden;
    width: 100%;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    min-width: 0;
    width: 100%;
}

body.language-study-wide .bottom-nav,
body.language-study-wide .language-bottom-nav {
    display: flex !important;
    z-index: 1900;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 65fr) minmax(0, 35fr);
    height: 100vh;
    max-height: none;
    max-width: none;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    width: 100vw;
}

body.language-study-wide .language-theme-menu.generated-study-card > h3 {
    display: none;
}

body.language-study-wide .generated-section:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    align-self: stretch;
    bottom: auto;
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    left: auto;
    max-width: none;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    position: static;
    right: auto;
    top: auto;
    transform: none;
    width: calc(50% - 9px);
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
    margin-top: 0;
}

body.language-study-wide .floating-test-entry:hover {
    transform: translateY(-2px);
}

body.language-study-wide .generated-word-list,
body.language-study-wide .word-nav-list,
body.language-study-wide .generated-conversation {
    max-height: none;
    min-width: 0;
    overflow-x: hidden;
}

body.language-study-wide .word-nav-list,
body.language-study-wide .generated-conversation {
    overflow-y: visible;
    padding-right: 0;
}

body.language-study-wide .generated-word-card,
body.language-study-wide .conversation-line,
body.language-study-wide .conversation-bubble,
body.language-study-wide .quick-test-card,
body.language-study-wide .floating-test-entry {
    max-width: 100%;
    min-width: 0;
}

body.language-study-wide .conversation-bubble,
body.language-study-wide .generated-word-example,
body.language-study-wide .generated-word-text,
body.language-study-wide .quick-test-prompt,
body.language-study-wide .test-entry-copy {
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    body.language-study-wide {
        height: auto;
        min-height: 100vh;
        padding-top: calc(var(--kanau-topbar-height, 64px) + 24px);
    }

    body.language-study-wide #page-materials,
    body.language-study-wide #language-hub-panel,
    body.language-study-wide .language-study-panel {
        height: auto;
        min-height: 0;
    }

    body.language-study-wide #language-hub-panel {
        padding: clamp(28px, 5vw, 56px) clamp(14px, 4vw, 28px) 148px;
    }

    body.language-study-wide .language-theme-menu.generated-study-card {
        gap: clamp(14px, 3vw, 22px);
        grid-template-areas:
            "words words"
            "conversation conversation"
            "pronunciation test";
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        height: auto;
        max-width: 100%;
        overflow: visible;
        padding: clamp(22px, 4vw, 34px);
        width: 100%;
    }

    body.language-study-wide .generated-section {
        padding: clamp(20px, 4vw, 36px);
    }

    body.language-study-wide .generated-section:first-of-type {
        grid-area: words;
        grid-column: 1 / -1;
        grid-row: auto;
        height: auto;
        overflow: visible;
    }

    body.language-study-wide .generated-section:nth-of-type(2) {
        grid-area: conversation;
        grid-column: 1 / -1;
        grid-row: auto;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    body.language-study-wide .floating-test-entry {
        grid-area: pronunciation;
        grid-column: 1 !important;
        grid-row: 3 !important;
        justify-self: stretch !important;
        margin: 0 !important;
        width: 100% !important;
    }

    body.language-study-wide .quick-test-card {
        grid-area: test;
        grid-column: 2 !important;
        grid-row: 3 !important;
        justify-self: stretch !important;
        margin: 0 !important;
        width: 100% !important;
    }

    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        align-self: stretch !important;
        height: auto !important;
        min-height: clamp(220px, 28vh, 340px);
        overflow-y: visible;
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
    }

    body.language-study-wide .generated-word-feature h5 {
        font-size: clamp(44px, 9vw, 68px);
        line-height: 1;
    }

    body.language-study-wide .conversation-bubble {
        max-width: min(76%, 520px);
    }
}

@media (max-width: 760px) {
    body.language-study-wide.kanau-has-global-topbar {
        --kanau-topbar-height: 64px;
        --kanau-topbar-offset: 10px;
    }

    body.language-study-wide .kanau-global-topbar {
        align-items: center;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 10px;
        height: var(--kanau-topbar-height);
        justify-content: space-between;
        left: 10px;
        padding: 0 14px;
        right: 10px;
    }

    body.language-study-wide .kanau-brand-lockup {
        flex: 1 1 auto;
        min-width: 0;
    }

    body.language-study-wide .kanau-brand-lockup small {
        display: none;
    }

    body.language-study-wide .kanau-brand-lockup::after {
        display: none;
    }

    body.language-study-wide .kanau-brand-mark {
        font-size: 19px;
        min-width: 0;
    }

    body.language-study-wide .kanau-topbar-language {
        flex: 0 0 auto;
    }

    body.language-study-wide .kanau-topbar-actions {
        flex: 0 0 auto;
        justify-content: flex-end;
        overflow: visible;
        padding-bottom: 0;
        width: auto;
    }

    body.language-study-wide .kanau-login-pill {
        max-width: min(42vw, 240px);
        overflow: hidden;
        padding: 0 14px;
        text-overflow: ellipsis;
    }
}

@media (max-width: 640px) {
    body.language-study-wide .language-theme-menu.generated-study-card {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        padding: 18px;
    }

    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        min-height: 190px;
        padding: 18px 14px;
    }

    body.language-study-wide .floating-test-entry {
        gap: 8px;
        grid-template-columns: 1fr;
        text-align: center;
    }

    body.language-study-wide .test-entry-icon,
    body.language-study-wide .test-entry-reward {
        display: none;
    }

    body.language-study-wide .quick-test-button {
        min-height: 48px;
        padding: 10px 14px;
    }
}

/* Final non-overlap pass: study content uses grid-owned cells and scrolls inside cells. */
body.language-study-wide {
    min-width: 0;
    overflow: auto;
}

body.language-study-wide #page-materials,
body.language-study-wide #language-hub-panel,
body.language-study-wide .language-study-panel {
    min-width: 0;
}

body.language-study-wide .language-theme-menu.generated-study-card {
    display: grid;
    gap: 18px;
    grid-template-areas:
        "words conversation"
        "words practice";
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
    grid-template-rows: minmax(360px, 1fr) minmax(220px, 0.54fr);
    height: auto;
    min-height: 100vh;
    min-width: 0;
    overflow: visible;
    padding: 18px;
    width: 100%;
}

body.language-study-wide .generated-section:first-of-type {
    grid-area: words;
}

body.language-study-wide .generated-section:nth-of-type(2) {
    grid-area: conversation;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    grid-area: practice;
}

body.language-study-wide .generated-section:first-of-type,
body.language-study-wide .generated-section:nth-of-type(2),
body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    height: auto;
    left: auto;
    max-width: none;
    min-height: 0;
    min-width: 0;
    position: static;
    right: auto;
    top: auto;
}

body.language-study-wide .generated-section:first-of-type,
body.language-study-wide .generated-section:nth-of-type(2) {
    overflow: hidden;
    width: 100%;
}

body.language-study-wide .floating-test-entry {
    justify-self: start;
}

body.language-study-wide .quick-test-card {
    justify-self: end;
}

body.language-study-wide .floating-test-entry,
body.language-study-wide .quick-test-card {
    align-self: stretch;
    width: calc(50% - 9px);
}

body.language-study-wide .generated-word-main,
body.language-study-wide .test-entry-copy,
body.language-study-wide .quick-test-prompt,
body.language-study-wide .conversation-bubble {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body.language-study-wide .generated-section-title {
    min-width: 0;
}

body.language-study-wide .generated-section-title h4 {
    overflow-wrap: anywhere;
}

body.language-study-wide .generated-conversation,
body.language-study-wide .word-nav-list {
    min-height: 0;
    overscroll-behavior: contain;
}

@media (max-width: 900px) {
    body.language-study-wide {
        height: auto;
        min-height: 100vh;
    }

    body.language-study-wide #page-materials,
    body.language-study-wide #language-hub-panel,
    body.language-study-wide .language-study-panel {
        height: auto;
        min-height: 100vh;
    }

    body.language-study-wide .language-theme-menu.generated-study-card {
        grid-template-areas:
            "words"
            "conversation"
            "practice";
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
    }

    body.language-study-wide .floating-test-entry,
    body.language-study-wide .quick-test-card {
        width: 100%;
    }

    body.language-study-wide .floating-test-entry {
        margin-bottom: 18px;
    }
}

@media (max-width: 640px) {
    .language-keyword-row,
    .language-select-row,
    .language-count-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .keyword-input-wrapper {
        min-width: 0;
    }

    .keyword-input-wrapper input {
        min-width: 0;
    }

    .theme-menu-item {
        gap: 10px;
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .theme-menu-note {
        grid-column: 2;
        justify-self: start;
    }
}

.language-new-pack-btn {
    margin-left: 10px;
}

.vocab-pack-learning-layout {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
}

.vocab-word-queue {
    background: rgba(255, 253, 247, 0.72);
    border: 1px solid #d7d0c5;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    min-height: 0;
    padding: 14px;
}

.vocab-queue-head {
    align-items: center;
    border-bottom: 1px solid rgba(215, 208, 197, 0.75);
    color: #6f7f70;
    display: flex;
    font-size: 12px;
    font-weight: 900;
    justify-content: space-between;
    padding-bottom: 10px;
    text-transform: uppercase;
}

.vocab-queue-head strong {
    color: #33352f;
}

body.language-study-wide .vocab-pack-learning-layout .word-nav-list,
.vocab-pack-learning-layout .word-nav-list {
    display: grid;
    gap: 8px;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
}

body.language-study-wide .vocab-pack-learning-layout .generated-word-card,
.vocab-pack-learning-layout .generated-word-card {
    border: 1px solid transparent;
    border-radius: 8px;
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 54px;
    padding: 10px;
}

body.language-study-wide .vocab-pack-learning-layout .generated-word-card.is-selected,
.vocab-pack-learning-layout .generated-word-card.is-selected {
    background: #edf6ee;
    border-color: #7f9a82;
}

.vocab-pack-learning-layout .generated-word-main strong {
    font-size: 16px;
}

.vocab-pack-learning-layout .generated-word-main span {
    color: #6f776b;
    display: block;
    font-size: 12px;
    line-height: 1.35;
}

.vocab-active-study-card {
    background: rgba(255, 253, 247, 0.82);
    border: 1px solid #d7d0c5;
    border-radius: 8px;
    min-height: 0;
    padding: 22px;
}

.vocab-study-card-head {
    align-items: center;
    color: #6f7f70;
    display: flex;
    font-size: 13px;
    font-weight: 900;
    justify-content: space-between;
    text-transform: uppercase;
}

.vocab-study-card-head span {
    color: #33352f;
}

.vocab-card-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vocab-card-meta .vocab-learning-status {
    margin-top: 0;
}

.vocab-save-error {
    color: #9f4f4f;
    font-size: 12px;
    font-weight: 800;
    margin: 2px 0 0;
}

.vocab-word-actions button:disabled,
.vocab-card-nav button:disabled {
    cursor: default;
    opacity: 0.55;
}

.vocab-card-nav {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 10px;
}

.vocab-card-nav button {
    background: transparent;
    border: 1px solid #d7d0c5;
    border-radius: 999px;
    color: #4d7555;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    min-height: 32px;
    padding: 0 14px;
}

.vocab-card-nav .vocab-next-btn {
    background: #7f9a82;
    border-color: #7f9a82;
    color: #fff;
}

.vocab-card-nav .vocab-prev-btn {
    background: rgba(255, 253, 247, 0.88);
}

body.language-study-wide .generated-word-list {
    overflow: visible;
}

@media (max-width: 900px) {
    .language-new-pack-btn {
        margin: 0 0 14px;
    }

    .vocab-pack-learning-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .vocab-word-queue {
        display: grid;
    }

    .vocab-active-study-card {
        min-height: 0;
    }
}

/* Chinese Demo：既存カードの階層を保った発音表記と独立テスト入口。 */
.vocab-pinyin { color: #536752; font-size: 0.9rem; line-height: 1.6; margin: 5px 0 12px; }
.vocab-word-actions .vocab-save-star { font-size: 26px; line-height: 1; min-width: 48px; }
.chinese-pronunciation-entry { display: block; padding: 12px 16px; border: 1px solid #b8cab2; border-radius: 12px; color: #33543b; text-decoration: none; margin-bottom: 14px; }
.chinese-pronunciation-entry small { display: block; margin-top: 4px; }

.vocab-active-study-card { scroll-margin-top: 110px; }
.vocab-active-study-card .vocab-pinyin { font-size: 1rem; font-weight: 500; }
