:root {
    color-scheme: light;
    --app-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    --font-scale: 1;
    --h1-size: clamp(26px, 3.2vw, 44px);
    --h2-size: clamp(24px, 3vw, 36px);
    --module-title-size: 18px;
    --result-size: clamp(28px, 4vw, 42px);
    --glass: rgba(255, 255, 255, 0.50);
    --glass-soft: rgba(255, 255, 255, 0.42);
    --glass-strong: rgba(255, 255, 255, 0.56);
    --text: rgba(24, 34, 50, 0.84);
    --muted: rgba(24, 34, 50, 0.56);
    --line: rgba(255, 255, 255, 0.50);
    --line-dark: rgba(24, 34, 50, 0.10);
    --blue: rgba(138, 194, 255, 0.50);
    --blue-text: rgba(33, 92, 154, 0.78);
    --pink: rgba(255, 158, 185, 0.50);
    --green: rgba(151, 218, 177, 0.50);
    --danger: rgba(198, 67, 83, 0.70);
}

body[data-theme="dark"] {
    --glass: rgba(24, 28, 36, 0.50);
    --glass-soft: rgba(24, 28, 36, 0.42);
    --glass-strong: rgba(48, 56, 70, 0.56);
    --text: rgba(246, 249, 253, 0.88);
    --muted: rgba(246, 249, 253, 0.58);
    --line: rgba(255, 255, 255, 0.18);
    --line-dark: rgba(255, 255, 255, 0.14);
    --blue-text: rgba(172, 210, 255, 0.88);
    background: rgb(18, 22, 30);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: rgb(246, 249, 253);
    color: var(--text);
    font-family: var(--app-font);
    font-size: calc(16px * var(--font-scale));
    letter-spacing: 0;
    overflow-x: hidden;
    isolation: isolate;
}

body[data-font="zh-kaiti"] {
    --app-font: "KaiTi", "STKaiti", "Microsoft YaHei UI", serif;
}

body[data-font="en-elegant"] {
    --app-font: "Segoe UI Variable Display", "Aptos Display", "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

body[data-font="ja-pingfang"] {
    --app-font: "PingFang SC", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", sans-serif;
}

body[data-font-size="small"] {
    --font-scale: 0.92;
    --h1-size: clamp(24px, 2.9vw, 40px);
    --h2-size: clamp(22px, 2.6vw, 32px);
    --module-title-size: 16px;
    --result-size: clamp(24px, 3.4vw, 36px);
}

body[data-font-size="large"] {
    --font-scale: 1.08;
    --h1-size: clamp(28px, 3.6vw, 48px);
    --h2-size: clamp(27px, 3.4vw, 42px);
    --module-title-size: 20px;
    --result-size: clamp(32px, 4.6vw, 48px);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.50), rgba(255, 255, 255, 0.28)),
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.50), transparent 24%);
}

body[data-theme="dark"]::before {
    background:
        linear-gradient(180deg, rgba(9, 12, 18, 0.30), rgba(9, 12, 18, 0.54)),
        radial-gradient(circle at 12% 8%, rgba(138, 194, 255, 0.18), transparent 24%);
}

.sekai-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-position: center;
    background-size: cover;
    opacity: 0;
    transform: scale(1.025);
    filter: saturate(0.82) brightness(1.12);
    transition: opacity 1100ms ease;
}

.sekai-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.42);
}

body[data-theme="dark"] .sekai-bg::after {
    background: rgba(8, 10, 14, 0.46);
}

.sekai-bg-one {
    background-image: var(--sekai-bg-one);
    opacity: 1;
}

.sekai-bg-two {
    background-image: var(--sekai-bg-two);
}

body.is-bg-two .sekai-bg-one {
    opacity: 0;
}

body.is-bg-two .sekai-bg-two {
    opacity: 1;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.stage-glow {
    display: none;
}

.site-shell {
    position: relative;
    z-index: 2;
    width: min(1240px, calc(100% - 36px));
    margin: 0 auto;
    padding: 22px 0 30px;
}

.is-hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.auth-copy,
.auth-card,
.app-header,
.daily-card,
.announcement-card,
.site-card,
.module-card,
.module-shell,
.profile-shell,
.history-shell,
.messages-shell,
.console-shell,
.avatar-crop-dialog,
.module-help-popover,
.result-card,
.scratchpad {
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.12);
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
    box-shadow: none;
}

.auth-view {
    min-height: calc(100vh - 64px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.7fr);
    gap: 24px;
    align-items: center;
}

.auth-copy {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 26px;
    padding: clamp(22px, 4vw, 42px);
}

.auth-logo {
    width: 68px;
    height: 68px;
    margin-bottom: 18px;
}

.auth-subtitle {
    margin: 14px 0 0;
    color: var(--blue-text);
    font-size: 16px;
    font-weight: 760;
    line-height: 1.6;
}

.kicker {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    font-weight: 820;
    line-height: 1.08;
    letter-spacing: 0;
}

h1 {
    font-size: var(--h1-size);
}

h1 span,
h2 span {
    color: var(--blue-text);
    text-shadow: none;
}

h2 {
    font-size: var(--h2-size);
}

.auth-copy p:last-child,
.hero-copy p,
.module-heading p,
.note {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.62;
}

.auth-card {
    position: relative;
    z-index: 60;
    border-radius: 24px;
    padding: 18px;
    overflow: visible;
}

.language-switcher,
.user-switcher {
    position: relative;
    display: inline-grid;
    place-items: center;
    margin-bottom: 12px;
    z-index: 20;
}

.auth-card .language-switcher {
    display: flex;
    justify-content: flex-end;
    margin-left: auto;
}

.language-trigger,
.user-trigger {
    width: 42px;
    height: 42px;
    min-width: 42px;
    flex: 0 0 42px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0;
    background: var(--glass);
    color: rgba(46, 47, 48, 0.78);
    backdrop-filter: blur(24px) saturate(1.12);
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

.user-trigger.has-avatar {
    overflow: hidden;
}

.language-trigger .icon,
.user-trigger .icon {
    width: 23px;
    height: 23px;
    display: block;
}

.language-trigger:hover,
.language-trigger:focus-visible,
.language-switcher.is-open .language-trigger,
.user-trigger:hover,
.user-trigger:focus-visible,
.user-switcher.is-open .user-trigger {
    background: rgba(255, 255, 255, 0.56);
    outline: none;
}

body[data-theme="dark"] .language-trigger,
body[data-theme="dark"] .user-trigger {
    color: rgba(246, 249, 253, 0.78);
}

.language-menu,
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: var(--user-menu-shift, 0px);
    z-index: 999;
    width: 168px;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.50);
    backdrop-filter: blur(24px) saturate(1.12);
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

body[data-theme="dark"] .language-menu,
body[data-theme="dark"] .user-menu {
    background: rgba(24, 28, 36, 0.50);
}

.user-menu {
    width: 270px;
    gap: 7px;
}

.language-menu[hidden],
.user-menu[hidden],
.site-card[hidden] {
    display: none;
}

.language-option,
.user-menu-item {
    width: 100%;
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.36);
    color: var(--muted);
    font-size: 13px;
    font-weight: 820;
    text-align: left;
    padding: 0 12px;
}

.user-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
    text-decoration: none;
}

.user-menu-profile {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line-dark);
    padding: 7px 8px 12px;
}

.user-menu-profile strong,
.user-menu-profile span,
.user-menu-profile small {
    display: block;
}

.user-menu-profile strong {
    color: var(--text);
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-profile span,
.user-menu-profile small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.user-avatar-thumb,
.user-menu-avatar,
.profile-avatar-preview img,
.user-menu-avatar.fallback,
.profile-avatar-preview span {
    border-radius: 999px;
}

.user-avatar-thumb {
    width: 34px;
    height: 34px;
    min-width: 34px;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: cover;
    object-position: center;
}

.user-menu-avatar,
.user-menu-avatar.fallback {
    width: 44px;
    height: 44px;
    aspect-ratio: 1 / 1;
}

.user-menu-avatar {
    display: block;
    object-fit: cover;
    object-position: center;
}

.user-menu-avatar.fallback,
.profile-avatar-preview span {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: rgba(138, 194, 255, 0.24);
    color: var(--blue-text);
    font-weight: 900;
}

.menu-branch {
    position: relative;
}

.menu-branch::before {
    content: "";
    position: absolute;
    top: 0;
    left: 100%;
    width: 8px;
    height: 100%;
    display: none;
}

.menu-branch:hover::before,
.menu-branch.is-open::before {
    display: block;
}

.user-menu-item.has-submenu::after {
    content: ">";
    color: var(--muted);
    font-weight: 900;
}

.user-submenu {
    position: absolute;
    top: 0;
    left: calc(100% + 8px);
    z-index: 1000;
    min-width: 190px;
    display: none;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.50);
    backdrop-filter: blur(24px) saturate(1.12);
    -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

body[data-theme="dark"] .user-submenu {
    background: rgba(24, 28, 36, 0.50);
}

.menu-branch:focus-within .user-submenu,
.menu-branch.is-open .user-submenu {
    display: grid;
}

.user-submenu button {
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.36);
    color: var(--text);
    text-align: left;
    padding: 0 10px;
}

.user-submenu button.is-active {
    border-color: rgba(138, 194, 255, 0.50);
    background: rgba(138, 194, 255, 0.28);
    color: var(--blue-text);
}

.language-option.is-active {
    border-color: rgba(138, 194, 255, 0.50);
    background: rgba(138, 194, 255, 0.28);
    color: var(--blue-text);
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
    background: rgba(138, 194, 255, 0.20);
    outline: none;
}

.user-menu-item.danger {
    color: rgba(220, 40, 60, 0.86);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    background: var(--glass-soft);
}

.auth-tab {
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.auth-tab.is-active {
    background: var(--glass-strong);
    color: var(--text);
}

.auth-form,
.calc-form {
    display: grid;
    gap: 14px;
}

.auth-form {
    margin-top: 16px;
}

label,
.field {
    display: grid;
    gap: 8px;
}

label span,
.field label,
.field span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 760;
}

input,
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.50);
    color: var(--text);
    outline: none;
    padding: 0 14px;
}

input:focus,
select:focus {
    border-color: rgba(138, 194, 255, 0.50);
    background: rgba(255, 255, 255, 0.56);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select {
    background: rgba(24, 28, 36, 0.50);
}

body[data-theme="dark"] input:focus,
body[data-theme="dark"] select:focus {
    background: rgba(48, 56, 70, 0.56);
}

input::placeholder {
    color: rgba(24, 34, 50, 0.36);
}

body[data-theme="dark"] input::placeholder {
    color: rgba(246, 249, 253, 0.32);
}

.auth-message {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.auth-message.is-error,
.result-card strong.is-error {
    color: var(--danger);
}

.primary-button,
.secondary-button,
.back-button {
    min-height: 46px;
    border-radius: 16px;
    padding: 0 18px;
    font-weight: 820;
}

.primary-button {
    border: 1px solid rgba(138, 194, 255, 0.50);
    background: var(--blue);
    color: var(--blue-text);
}

.secondary-button,
.back-button {
    border: 1px solid var(--line-dark);
    background: var(--glass);
    color: var(--text);
}

.compact {
    min-height: 36px;
    border-radius: 999px;
    padding: 0 12px;
}

.app-header {
    position: relative;
    z-index: 50;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 24px;
    padding: 12px 16px;
    overflow: visible;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-block > div {
    min-width: 0;
}

.brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.36);
    padding: 6px;
    border: 1px solid var(--line);
}

.brand-orbit {
    width: 46px;
    height: 46px;
    position: relative;
    flex: 0 0 auto;
    border-radius: 15px;
    background: var(--glass);
    border: 1px solid var(--line);
}

.brand-orbit span {
    position: absolute;
    border-radius: 999px;
}

.brand-orbit span:nth-child(1) {
    width: 13px;
    height: 13px;
    left: 10px;
    top: 10px;
    background: var(--blue);
}

.brand-orbit span:nth-child(2) {
    width: 14px;
    height: 14px;
    right: 9px;
    top: 14px;
    background: var(--pink);
}

.brand-orbit span:nth-child(3) {
    width: 15px;
    height: 15px;
    left: 17px;
    bottom: 8px;
    background: var(--green);
}

.user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}

.user-actions .language-switcher {
    margin-bottom: 0;
}

.user-actions .user-switcher {
    margin-bottom: 0;
}

.daily-card {
    margin-top: 16px;
    border-radius: 22px;
    padding: 16px;
}

.dashboard-view {
    min-height: calc(100vh - 126px);
    display: grid;
    align-content: start;
}

.announcement-card {
    position: relative;
    min-height: 112px;
    display: grid;
    gap: 8px;
    margin-top: 14px;
    border-radius: 22px;
    padding: 16px 18px 18px;
    overflow: hidden;
}

.announcement-card::before {
    content: "";
    position: absolute;
    inset: -70% auto -70% -24%;
    width: 24%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
    transform: rotate(12deg);
    animation: cardSweep 5.4s ease-in-out infinite;
    pointer-events: none;
}

.announcement-kicker {
    position: relative;
    z-index: 1;
    color: var(--blue-text);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}

.announcement-card h2 {
    position: relative;
    z-index: 1;
    font-size: clamp(19px, 2.2vw, 27px);
    line-height: 1.14;
}

.announcement-card p {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.62;
}

.announcement-dots {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 7px;
    margin-top: 2px;
}

.announcement-dots button {
    width: 8px;
    height: 8px;
    min-height: 8px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    background: rgba(33, 92, 154, 0.20);
}

.announcement-dots button.is-active {
    width: 22px;
    background: rgba(33, 92, 154, 0.58);
}

.site-card {
    width: 100%;
    min-height: 108px;
    display: grid;
    gap: 6px;
    margin-top: 16px;
    border-radius: 22px;
    padding: 18px;
    text-align: left;
    color: var(--text);
}

.site-card span {
    color: var(--blue-text);
    font-size: 12px;
    font-weight: 860;
    letter-spacing: .08em;
}

.site-card strong {
    font-size: 24px;
    line-height: 1.15;
}

.site-card small {
    color: var(--muted);
    font-size: 13px;
}

.site-card:hover,
.site-card:focus-visible {
    transform: translateY(-3px);
    outline: none;
}

.daily-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.daily-head span {
    color: var(--blue-text);
    font-size: 13px;
    font-weight: 860;
}

.daily-card p {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 17px;
    font-weight: 820;
    line-height: 1.35;
}

.daily-card pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.42);
    color: rgba(24, 34, 50, 0.78);
    font-size: 13px;
    line-height: 1.5;
}

.daily-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 10px;
}

.question-choice {
    min-height: 52px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.42);
    color: var(--text);
    text-align: left;
    padding: 9px 11px;
}

.question-choice span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
}

.question-choice strong {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.question-choice:disabled,
.question-choice.is-locked {
    cursor: default;
    opacity: .72;
}

.question-choice:disabled:hover {
    transform: none;
}

.question-choice.is-correct {
    border-color: rgba(151, 218, 177, 0.72);
    background: rgba(151, 218, 177, 0.34);
}

.question-choice.is-wrong {
    border-color: rgba(255, 158, 185, 0.78);
    background: rgba(255, 158, 185, 0.32);
}

.daily-feedback {
    min-height: 20px;
    margin-top: 8px;
    color: var(--blue-text);
    font-size: 13px;
    font-weight: 820;
}

.daily-feedback strong,
.daily-feedback span {
    display: block;
}

.daily-feedback span {
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.5;
}

.daily-feedback.is-complete {
    color: rgba(33, 92, 154, 0.72);
}

.module-gallery {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-top: clamp(28px, 6.5vh, 76px);
}

.module-card {
    min-height: 194px;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 0;
    text-align: left;
    color: var(--text);
    animation: cardDrift 6.4s ease-in-out infinite;
    animation-delay: calc(var(--module-index, 0) * -820ms);
    transition: transform 160ms ease, background 160ms ease;
}

.module-card:hover,
.module-card:focus-visible {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.50);
    outline: none;
}

.module-card::before {
    content: "";
    position: absolute;
    inset: -40% auto -40% -55%;
    z-index: 1;
    width: 42%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.56), transparent);
    transform: rotate(12deg);
    animation: cardSweep 5.8s ease-in-out infinite;
    animation-delay: calc(var(--module-index, 0) * -700ms);
}

.module-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.50));
}

.module-card-image,
.module-card-image img {
    display: block;
    width: 100%;
    height: 100%;
}

.module-card-image {
    position: absolute;
    inset: 0;
}

.module-card-image img {
    object-fit: cover;
    filter: saturate(0.76) brightness(1.12);
    transform: scale(1.02);
    transition: transform 180ms ease, filter 180ms ease;
}

.module-card:hover .module-card-image img,
.module-card:focus-visible .module-card-image img {
    filter: saturate(0.88) brightness(1.16);
    transform: scale(1.06);
}

.module-card:hover::before,
.module-card:focus-visible::before {
    animation-duration: 2.8s;
}

.module-card-copy {
    position: absolute;
    inset: auto 14px 14px 14px;
    z-index: 2;
}

.module-card strong {
    display: block;
    font-size: var(--module-title-size);
    margin-bottom: 5px;
}

.module-card small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.module-view {
    margin-top: 20px;
}

.profile-view,
.history-view,
.messages-view,
.console-view {
    margin-top: 20px;
}

.back-button {
    margin-bottom: 14px;
}

.module-shell {
    min-height: 540px;
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1fr);
    gap: 0;
    border-radius: 24px;
    overflow: hidden;
}

.profile-shell,
.history-shell,
.messages-shell,
.console-shell {
    width: min(980px, 100%);
    margin: 0 auto;
    border-radius: 24px;
    padding: clamp(18px, 3vw, 28px);
}

.profile-panel,
.history-panel,
.messages-panel {
    max-width: 100%;
}

.profile-subtitle {
    margin: 6px 0 0;
    color: var(--blue-text);
    font-size: 14px;
}

.profile-form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.profile-avatar-block {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 18px 0 22px;
    border-bottom: 1px solid var(--line-dark);
}

.profile-avatar-preview,
.profile-avatar-preview img,
.profile-avatar-preview span {
    width: 92px;
    height: 92px;
}

.profile-avatar-preview {
    position: relative;
}

.profile-avatar-preview img {
    object-fit: cover;
}

.profile-avatar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.avatar-hint {
    margin: 0;
    color: var(--blue-text);
    font-size: 13px;
    text-align: center;
}

.avatar-crop-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(246, 249, 253, 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

body[data-theme="dark"] .avatar-crop-modal {
    background: rgba(9, 12, 18, 0.42);
}

.avatar-crop-dialog {
    width: min(430px, 100%);
    display: grid;
    gap: 14px;
    border-radius: 22px;
    padding: 18px;
}

.avatar-crop-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.avatar-crop-head strong,
.avatar-crop-head span {
    display: block;
}

.avatar-crop-head strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 900;
}

.avatar-crop-head span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

#avatarCropCanvas {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    border-radius: 20px;
    border: 1px solid var(--line-dark);
    background:
        linear-gradient(90deg, rgba(33, 92, 154, 0.08) 1px, transparent 1px),
        linear-gradient(180deg, rgba(33, 92, 154, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.36);
    background-size: 22px 22px;
    touch-action: none;
}

.avatar-crop-zoom {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 820;
}

.avatar-crop-zoom input {
    width: 100%;
}

.avatar-crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-account-row {
    display: grid;
    gap: 8px;
}

.profile-account-row span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 760;
}

.profile-account-row strong {
    justify-self: start;
    border-radius: 999px;
    background: rgba(138, 194, 255, 0.24);
    color: var(--blue-text);
    padding: 6px 12px;
    font-size: 13px;
}

.history-list {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.messages-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.message-item {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.36);
    padding: 14px;
}

.message-item strong {
    color: var(--text);
}

.message-item span {
    color: var(--muted);
    font-size: 13px;
}

.history-section {
    display: grid;
    gap: 10px;
}

.history-section h3 {
    margin: 0;
    color: var(--blue-text);
    font-size: 15px;
    font-weight: 860;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.36);
    padding: 12px;
}

body[data-theme="dark"] .history-item,
body[data-theme="dark"] .message-item,
body[data-theme="dark"] .question-choice,
body[data-theme="dark"] .console-input-row,
body[data-theme="dark"] .daily-card pre {
    background: rgba(24, 28, 36, 0.42);
}

.history-item strong,
.history-item span {
    display: block;
}

.history-item time,
.empty-state {
    color: var(--muted);
    font-size: 12px;
}

.history-item span {
    color: var(--blue-text);
    font-weight: 860;
    overflow-wrap: anywhere;
    text-align: right;
}

.module-visual {
    min-height: 540px;
    position: relative;
    overflow: hidden;
}

.module-visual::before {
    content: "";
    position: absolute;
    inset: -35% auto -35% -45%;
    z-index: 2;
    width: 34%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
    transform: rotate(11deg);
    animation: cardSweep 4.4s ease-in-out infinite;
}

.module-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(255, 255, 255, 0.50);
}

.module-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.03);
    animation: moduleImageDrift 7.2s ease-in-out infinite;
}

.module-workbench {
    padding: clamp(18px, 3vw, 28px);
    background: rgba(255, 255, 255, 0.50);
}

.module-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.module-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.module-help-button {
    width: 38px;
    min-width: 38px;
    padding: 0;
    border-radius: 999px;
    font-weight: 920;
}

.module-help-popover {
    position: relative;
    z-index: 4;
    margin: -6px 0 14px auto;
    max-width: 380px;
    border-radius: 18px;
    padding: 14px 16px;
}

.module-help-popover strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 6px;
}

.module-help-popover p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.two-col,
.three-col {
    display: grid;
    gap: 12px;
}

.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 5px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: var(--glass-soft);
}

.segmented label {
    min-height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 780;
}

.segmented input {
    display: none;
}

.segmented label:has(input:checked) {
    background: var(--glass-strong);
    color: var(--text);
}

.advanced-toggle {
    justify-self: start;
}

.advanced-panel {
    display: grid;
    gap: 10px;
}

.advanced-panel[hidden] {
    display: none;
}

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

.calculator-assist {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line-dark);
    border-radius: 20px;
    padding: 12px;
    background: var(--glass-soft);
}

.calculator-assist[hidden] {
    display: none;
}

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

.assist-key {
    min-height: 42px;
    border: 1px solid var(--line-dark);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.42);
    color: var(--text);
    font-size: 14px;
    font-weight: 850;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.assist-key:hover,
.assist-key:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(90, 194, 238, 0.36);
    background: rgba(138, 194, 255, 0.24);
    outline: none;
}

.assist-key[data-wide="true"] {
    grid-column: span 2;
}

body[data-theme="dark"] .assist-key {
    background: rgba(24, 28, 36, 0.44);
}

.result-card {
    margin-top: 18px;
    border-radius: 20px;
    padding: 18px;
}

.module-advanced-button {
    flex: 0 0 auto;
}

.result-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 780;
    margin-bottom: 8px;
}

.result-card strong {
    display: block;
    min-height: 36px;
    font-size: var(--result-size);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.result-card p {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.graph-panel {
    min-height: 280px;
    border: 1px solid var(--line-dark);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.24)),
        rgba(255, 255, 255, 0.32);
    overflow: hidden;
}

.scratchpad {
    display: grid;
    gap: 10px;
    border-radius: 18px;
    padding: 12px;
}

.scratchpad-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.scratchpad-head span {
    color: var(--blue-text);
    font-size: 13px;
    font-weight: 860;
}

.scratchpad canvas {
    display: block;
    width: 100%;
    height: 180px;
    border: 1px dashed rgba(33, 92, 154, 0.24);
    border-radius: 14px;
    background:
        linear-gradient(90deg, rgba(33, 92, 154, 0.08) 1px, transparent 1px),
        linear-gradient(180deg, rgba(33, 92, 154, 0.08) 1px, transparent 1px),
        rgba(255, 255, 255, 0.36);
    background-size: 22px 22px;
    touch-action: none;
}

.graph-panel canvas {
    display: block;
    width: 100%;
    height: 280px;
}

.console-shell {
    min-height: 560px;
    display: grid;
    grid-template-rows: auto minmax(360px, 1fr) auto;
    gap: 12px;
}

.console-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.console-toolbar span {
    color: var(--blue-text);
    font-size: 15px;
    font-weight: 860;
}

.console-output {
    margin: 0;
    min-height: 360px;
    overflow: auto;
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    background: rgba(12, 16, 23, 0.72);
    color: rgba(226, 244, 255, 0.92);
    padding: 22px clamp(18px, 6vw, 78px);
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.console-output-text {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    text-align: left;
    white-space: pre-wrap;
}

.console-input-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.42);
    padding: 8px 12px;
}

.console-input-row span {
    color: var(--blue-text);
    font-weight: 900;
}

.console-input-row input {
    min-height: 36px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

@keyframes cardDrift {
    0%,
    100% {
        translate: 0 0;
    }

    50% {
        translate: 0 -5px;
    }
}

@keyframes cardSweep {
    0%,
    42% {
        translate: 0 0;
        opacity: 0;
    }

    58% {
        opacity: .7;
    }

    100% {
        translate: 360% 0;
        opacity: 0;
    }
}

@keyframes moduleImageDrift {
    0%,
    100% {
        transform: scale(1.03) translate3d(0, 0, 0);
        filter: saturate(0.82) brightness(1.12);
    }

    50% {
        transform: scale(1.08) translate3d(-1.6%, -1.4%, 0);
        filter: saturate(0.94) brightness(1.18);
    }
}

@media (max-width: 1050px) {
    .module-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .module-shell {
        grid-template-columns: 1fr;
    }

    .module-visual {
        min-height: 320px;
    }
}

@media (max-width: 860px) {
    .auth-view {
        grid-template-columns: 1fr;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .site-shell {
        width: min(100% - 20px, 1180px);
        padding: 12px 0 24px;
    }

    h1 {
        font-size: min(var(--h1-size), 44px);
    }

    h2 {
        font-size: min(var(--h2-size), 36px);
    }

    .module-gallery {
        grid-template-columns: 1fr;
    }

    .daily-options {
        grid-template-columns: 1fr;
    }

    .user-submenu {
        position: static;
        min-width: 100%;
        margin-top: 6px;
    }

    .two-col,
    .three-col {
        grid-template-columns: 1fr;
    }
}
