:root {
    --page-bg: #eef2f7;
    --card: #ffffff;
    --text: #172033;
    --text-soft: #667085;
    --text-muted: #98a2b3;
    --line: #e4e9f0;
    --navy: #14243d;
    --navy-deep: #0b1527;
    --blue: #356da8;
    --blue-soft: #eef5fc;
    --gold: #ddb96d;
    --gold-soft: #fff7e4;
    --green: #23875b;
    --red: #c94843;
    --red-soft: #fff2f1;
    --radius: 8px;
    --shadow: 0 10px 28px rgba(20, 36, 61, .07);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0, rgba(64, 108, 158, .08), transparent 340px),
        var(--page-bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    border: 0;
}

[hidden] {
    display: none !important;
}

.account-page {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 10px 10px calc(96px + env(safe-area-inset-bottom, 0px));
}

.profile-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 16px;
    border: 1px solid rgba(182, 206, 235, .25);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 92% 0, rgba(75, 139, 193, .32), transparent 35%),
        radial-gradient(circle at 10% 100%, rgba(72, 95, 137, .34), transparent 42%),
        linear-gradient(138deg, #152844 0%, #0d1a2e 62%, #111827 100%);
    color: #f8fbff;
    box-shadow: 0 16px 34px rgba(15, 28, 49, .20), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.profile-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 5px;
    border: 1px solid rgba(211, 226, 247, .08);
    border-radius: 5px;
    pointer-events: none;
}

.hero-orbit {
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(176, 210, 243, .08);
    border-radius: 50%;
    pointer-events: none;
}

.hero-orbit-one {
    width: 190px;
    height: 190px;
    top: -116px;
    right: -35px;
}

.hero-orbit-two {
    width: 110px;
    height: 110px;
    top: -73px;
    right: 5px;
}

.hero-topline,
.profile-main,
.profile-name-row,
.section-heading,
.section-action,
.setting-row,
.logout-button,
.privacy-note,
.sheet-header,
.password-control,
.confirm-actions {
    display: flex;
    align-items: center;
}

.hero-topline {
    justify-content: space-between;
    gap: 12px;
}

.hero-eyebrow,
.section-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--gold);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .16em;
}

.hero-topline h1,
.section-heading h2,
.sheet-header h2,
.confirm-dialog h2 {
    margin: 0;
}

.hero-topline h1 {
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: .03em;
}

.refresh-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(197, 219, 245, .22);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .08);
    color: #dbeafe;
    cursor: pointer;
    transition: transform .18s ease, background-color .16s ease;
}

.refresh-button svg,
.section-action svg,
.setting-icon svg,
.setting-arrow,
.logout-button svg,
.privacy-note svg,
.sheet-close svg,
.password-toggle svg,
.confirm-icon svg,
.summary-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.refresh-button svg {
    width: 18px;
    height: 18px;
}

.refresh-button:hover {
    background: rgba(255, 255, 255, .14);
}

.refresh-button:active {
    transform: scale(.96);
}

.refresh-button.is-loading svg {
    animation: spin .75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.profile-main {
    gap: 13px;
    margin-top: 17px;
}

.avatar-control {
    position: relative;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
}

.avatar-shell {
    position: relative;
    width: 58px;
    height: 58px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 2px solid rgba(235, 211, 155, .65);
    border-radius: 50%;
    background: linear-gradient(145deg, #f2d99b, #ad7d2f);
    color: #38280d;
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .36);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.avatar-shell:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 21px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.avatar-shell:active {
    transform: scale(.97);
}

.avatar-shell.is-uploading {
    cursor: wait;
    opacity: .72;
}

.avatar-shell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-edit-badge {
    position: absolute;
    right: -3px;
    bottom: -2px;
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border: 2px solid #172a45;
    border-radius: 50%;
    background: linear-gradient(145deg, #f2d99b, #c18c35);
    color: #3b2b0f;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}

.avatar-edit-badge svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.avatar-shell.is-uploading .avatar-edit-badge svg {
    animation: spin .7s linear infinite;
}

.avatar-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.profile-copy {
    min-width: 0;
    flex: 1;
}

.avatar-help {
    margin-top: 3px;
    color: rgba(230, 237, 247, .56);
    font-size: 9px;
    line-height: 1.4;
}

.profile-name-row {
    min-width: 0;
    gap: 8px;
}

.profile-name-row strong {
    min-width: 0;
    overflow: hidden;
    font-size: 18px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vip-badge {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid rgba(235, 207, 145, .35);
    border-radius: 999px;
    background: rgba(204, 160, 73, .14);
    color: #f0d493;
    font-size: 9px;
    font-weight: 800;
}

.vip-badge.is-standard {
    border-color: rgba(181, 203, 229, .22);
    background: rgba(194, 214, 237, .08);
    color: #c8d7e8;
}

.profile-status {
    margin-top: 5px;
    color: #b8c7da;
    font-size: 11px;
}

.profile-status i {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 5px;
    border-radius: 50%;
    background: #62d6a2;
    box-shadow: 0 0 0 3px rgba(98, 214, 162, .12);
}

.profile-updated {
    margin-top: 4px;
    color: rgba(203, 216, 233, .60);
    font-size: 10px;
}

.account-facts {
    margin: 15px 0 0;
    padding-top: 13px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border-top: 1px solid rgba(204, 220, 240, .12);
}

.account-facts > div {
    min-width: 0;
    padding: 0 10px;
    border-left: 1px solid rgba(204, 220, 240, .10);
}

.account-facts > div:first-child {
    padding-left: 0;
    border-left: 0;
}

.account-facts > div:last-child {
    padding-right: 0;
}

.account-facts dt,
.account-facts dd {
    margin: 0;
}

.account-facts dt {
    color: rgba(198, 213, 231, .68);
    font-size: 10px;
}

.account-facts dd {
    margin-top: 4px;
    overflow: hidden;
    color: #f5f8fc;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-card {
    margin-top: 10px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.section-heading {
    justify-content: space-between;
    gap: 12px;
}

.section-heading h2 {
    font-size: 16px;
    line-height: 1.25;
}

.section-heading.compact {
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line);
}

.section-action {
    min-height: 32px;
    gap: 3px;
    padding: 0 8px;
    border: 1px solid #dce7f3;
    border-radius: var(--radius);
    background: #f7fafe;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
}

.section-action svg {
    width: 14px;
    height: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 13px;
}

.stat-item {
    min-width: 0;
    min-height: 74px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #e8edf3;
    border-radius: var(--radius);
    background: #f8fafc;
}

.stat-item.stat-emphasis {
    border-color: #d8e5f3;
    background: linear-gradient(145deg, #edf5fd, #f8fbfe);
}

.stat-item span {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-item strong {
    color: #253b59;
    font-size: 19px;
    line-height: 1;
}

.stat-emphasis strong {
    color: var(--blue);
}

.plan-summary {
    min-height: 38px;
    margin-top: 9px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius);
    background: #f4f7fa;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.45;
}

.summary-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #e6eef7;
    color: #4c719b;
}

.summary-icon svg {
    width: 15px;
    height: 15px;
}

.inline-retry {
    min-height: 34px;
    margin-top: 8px;
    padding: 0 12px;
    border: 1px solid #d6e2ee;
    border-radius: var(--radius);
    background: #f7fafc;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.settings-card {
    padding-bottom: 4px;
}

.settings-list {
    margin-top: 1px;
}

.setting-row {
    width: 100%;
    min-height: 68px;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.setting-row:last-child {
    border-bottom: 0;
}

.setting-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
}

.setting-icon.secure {
    background: #eef5fc;
    color: #356da8;
}

.setting-icon.plans {
    background: #f2f0fb;
    color: #6556a6;
}

.setting-icon.help {
    background: #edf7f5;
    color: #24776f;
}

.setting-icon.contact {
    background: #fff4e8;
    color: #b76516;
}

.setting-icon svg {
    width: 20px;
    height: 20px;
}

.setting-copy {
    min-width: 0;
    flex: 1;
}

.setting-copy strong,
.setting-copy small {
    display: block;
}

.setting-copy strong {
    font-size: 13px;
    line-height: 1.3;
}

.setting-copy small {
    margin-top: 4px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.setting-arrow {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: #a7b0bd;
}

.logout-button {
    width: 100%;
    min-height: 46px;
    margin-top: 10px;
    justify-content: center;
    gap: 7px;
    border: 1px solid #efcecc;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .82);
    color: var(--red);
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(58, 31, 31, .04);
}

.logout-button svg {
    width: 18px;
    height: 18px;
}

.logout-button:active,
.setting-row:active,
.section-action:active,
.primary-button:active,
.dialog-button:active {
    transform: scale(.988);
}

.privacy-note {
    justify-content: center;
    gap: 5px;
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 9px;
}

.privacy-note svg {
    width: 13px;
    height: 13px;
}

.sheet-layer,
.confirm-layer {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.sheet-mask,
.confirm-mask {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 27, .54);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.bottom-sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border: 1px solid #e5e9ef;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    background: #fff;
    box-shadow: 0 -18px 48px rgba(13, 26, 46, .20);
    animation: sheetUp .2s ease-out;
}

.avatar-crop-layer {
    z-index: 1250;
}

.avatar-crop-sheet {
    max-width: 520px;
    max-height: min(92vh, 760px);
    overflow-y: auto;
}

.avatar-crop-body {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 14px 0 4px;
}

.avatar-crop-intro {
    width: 100%;
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.55;
    text-align: center;
}

.avatar-crop-stage {
    position: relative;
    width: min(76vw, 320px, 43vh);
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid rgba(221, 185, 109, .8);
    border-radius: 10px;
    background: #0d1829;
    box-shadow: 0 10px 26px rgba(13, 24, 41, .18);
    touch-action: none;
    user-select: none;
}

.avatar-crop-stage::before,
.avatar-crop-stage::after {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.avatar-crop-stage::before {
    top: 33.333%;
    right: 0;
    left: 0;
    height: 33.333%;
    border-top: 1px solid rgba(255, 255, 255, .24);
    border-bottom: 1px solid rgba(255, 255, 255, .24);
}

.avatar-crop-stage::after {
    top: 0;
    bottom: 0;
    left: 33.333%;
    width: 33.333%;
    border-right: 1px solid rgba(255, 255, 255, .24);
    border-left: 1px solid rgba(255, 255, 255, .24);
}

.avatar-crop-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.avatar-crop-stage canvas:active {
    cursor: grabbing;
}

.avatar-zoom-row {
    width: min(100%, 360px);
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 10px;
}

.avatar-zoom-row input {
    width: 100%;
    accent-color: var(--blue);
}

.avatar-zoom-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #d9e0e9;
    border-radius: var(--radius);
    background: #f6f8fb;
    color: var(--navy);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.avatar-crop-meta {
    width: min(100%, 360px);
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 9px;
}

.avatar-reselect-button {
    padding: 6px 10px;
    background: transparent;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.avatar-crop-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.dialog-button.primary {
    background: linear-gradient(135deg, #244f7c, #356da8);
    color: #fff;
    box-shadow: 0 7px 16px rgba(53, 109, 168, .18);
}

.avatar-crop-actions button:disabled,
.avatar-crop-body button:disabled,
.avatar-crop-body input:disabled,
.avatar-crop-sheet .sheet-close:disabled {
    cursor: wait;
    opacity: .58;
}

@keyframes sheetUp {
    from { transform: translateY(28px); opacity: .5; }
    to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
    width: 38px;
    height: 4px;
    margin: 0 auto 11px;
    border-radius: 999px;
    background: #d8dee7;
}

.sheet-header {
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.sheet-header span {
    color: var(--blue);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
}

.sheet-header h2 {
    margin-top: 4px;
    font-size: 18px;
}

.sheet-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: #f2f4f7;
    color: #667085;
    cursor: pointer;
}

.sheet-close svg {
    width: 18px;
    height: 18px;
}

#passwordForm {
    padding-top: 13px;
}

.form-field {
    display: block;
    margin-top: 12px;
}

.form-field:first-child {
    margin-top: 0;
}

.form-field > span:first-child {
    display: block;
    margin-bottom: 6px;
    color: #344054;
    font-size: 11px;
    font-weight: 700;
}

.password-control {
    height: 44px;
    border: 1px solid #d5dce5;
    border-radius: var(--radius);
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.password-control:focus-within {
    border-color: #5b88b9;
    box-shadow: 0 0 0 3px rgba(53, 109, 168, .10);
}

.password-control input {
    min-width: 0;
    height: 100%;
    flex: 1;
    padding: 0 4px 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 13px;
}

.password-control input::placeholder {
    color: #a6afbc;
}

.password-toggle {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: transparent;
    color: #8993a1;
    cursor: pointer;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
}

.form-message {
    min-height: 18px;
    margin-top: 8px;
    color: var(--red);
    font-size: 11px;
    line-height: 1.45;
}

.form-message.success {
    color: var(--green);
}

.primary-button {
    width: 100%;
    min-height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #244f7c, #356da8);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(53, 109, 168, .20);
}

.primary-button:disabled {
    cursor: wait;
    opacity: .65;
}

.form-help {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.5;
    text-align: center;
}

.confirm-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(calc(100% - 32px), 350px);
    padding: 20px;
    transform: translate(-50%, -50%);
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    background: #fff;
    text-align: center;
    box-shadow: 0 20px 58px rgba(11, 23, 41, .24);
    animation: dialogIn .16s ease-out;
}

@keyframes dialogIn {
    from { transform: translate(-50%, -48%) scale(.98); opacity: .5; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.confirm-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--red-soft);
    color: var(--red);
}

.confirm-icon svg {
    width: 22px;
    height: 22px;
}

.confirm-dialog h2 {
    font-size: 17px;
}

.confirm-dialog p {
    margin: 8px 0 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.6;
}

.confirm-actions {
    gap: 8px;
    margin-top: 18px;
}

.dialog-button {
    min-height: 40px;
    flex: 1;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.dialog-button.secondary {
    border: 1px solid #dfe4eb;
    background: #f7f8fa;
    color: #475467;
}

.dialog-button.danger {
    background: var(--red);
    color: #fff;
}

.toast {
    position: fixed;
    z-index: 1500;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 40px);
    padding: 9px 13px;
    transform: translate(-50%, 12px);
    border-radius: var(--radius);
    background: rgba(17, 24, 39, .94);
    color: #fff;
    font-size: 11px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .20);
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid #5a8abe;
    outline-offset: 2px;
}

@media (min-width: 641px) {
    .account-page {
        padding-top: 18px;
    }

    .profile-hero {
        padding: 20px;
    }

    .content-card {
        padding: 18px;
    }
}

@media (max-width: 390px) {
    .account-page {
        padding-right: 8px;
        padding-left: 8px;
    }

    .profile-hero {
        padding: 14px;
    }

    .account-facts > div {
        padding-right: 7px;
        padding-left: 7px;
    }

    .account-facts dd {
        font-size: 11px;
    }

    .content-card {
        padding: 13px;
    }

    .stat-item {
        min-height: 70px;
    }

    .stat-item strong {
        font-size: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
