:root {
    --ink: #f8efe1;
    --muted: #b9ab94;
    --dim: #756b5b;
    --line: rgba(236, 197, 119, 0.32);
    --line-hot: rgba(255, 219, 129, 0.72);
    --panel: rgba(7, 12, 14, 0.82);
    --panel-strong: rgba(8, 10, 12, 0.94);
    --gold: #d69a3a;
    --gold-bright: #ffd678;
    --jade: #5ddfcf;
    --ruby: #b64236;
    --blue: #6ca6ff;
    --shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

* {
    box-sizing: border-box;
}

html,
body {
    -ms-touch-action: auto;
    width: 100%;
    min-height: 100%;
    padding: 0;
    border: 0;
    margin: 0;
    color: var(--ink);
    font-family: "Segoe UI", Inter, Arial, sans-serif;
}

body {
    min-height: 100vh;
    overflow: hidden;
    background-color: #05080a;
    background-image:
        linear-gradient(90deg, rgba(2, 5, 8, 0.92) 0%, rgba(2, 5, 8, 0.58) 42%, rgba(2, 5, 8, 0.85) 100%),
        radial-gradient(circle at 52% 42%, rgba(93, 223, 207, 0.18), transparent 34%),
        url("resource/res/loading/back.jpg");
    background-position: center;
    background-size: cover;
}

body::before,
body::after {
    position: fixed;
    inset: 0;
    pointer-events: none;
    content: "";
}

body::before {
    z-index: 1;
    background:
        linear-gradient(transparent 0 94%, rgba(255, 214, 120, 0.08) 95%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 15% 85%, rgba(255, 255, 255, 0.025));
    background-size: 100% 7px, 100% 100%;
    mix-blend-mode: screen;
    opacity: 0.36;
}

body::after {
    z-index: 2;
    background:
        radial-gradient(circle at center, transparent 0 42%, rgba(0, 0, 0, 0.5) 82%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon,
.field-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.portal-shell {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px;
}

.portal-shell.is-hidden {
    display: none;
}

.portal-effects {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.portal-effects span {
    position: absolute;
    width: 3px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(180deg, transparent, rgba(255, 214, 120, 0.8), transparent);
    filter: blur(0.3px);
    opacity: 0.54;
    animation: lantern-rise 8s linear infinite;
}

.portal-effects span:nth-child(1) { left: 8%; bottom: -8%; animation-delay: 0s; }
.portal-effects span:nth-child(2) { left: 23%; bottom: -18%; animation-delay: 1.7s; animation-duration: 10s; }
.portal-effects span:nth-child(3) { left: 48%; bottom: -12%; animation-delay: 0.8s; animation-duration: 9s; }
.portal-effects span:nth-child(4) { left: 63%; bottom: -22%; animation-delay: 2.6s; animation-duration: 11s; }
.portal-effects span:nth-child(5) { left: 79%; bottom: -10%; animation-delay: 1.2s; animation-duration: 8.4s; }
.portal-effects span:nth-child(6) { left: 91%; bottom: -25%; animation-delay: 3.2s; animation-duration: 12s; }

.auth-view,
.dashboard-view {
    position: relative;
    z-index: 2;
    width: min(1240px, 100%);
    min-width: 0;
}

.auth-view {
    display: grid;
    grid-template-columns: minmax(460px, 1fr) 460px;
    align-items: center;
    gap: 34px;
}

.brand-stage {
    position: relative;
    min-height: 680px;
}

.brand-copy {
    position: absolute;
    left: 0;
    bottom: 56px;
    z-index: 3;
    max-width: 500px;
    padding-left: 12px;
}

.brand-seal {
    display: inline-grid;
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    place-items: center;
    border: 1px solid var(--line-hot);
    background: rgba(4, 9, 10, 0.72);
    color: var(--jade);
    font-weight: 900;
    box-shadow: 0 0 38px rgba(93, 223, 207, 0.22), inset 0 0 22px rgba(93, 223, 207, 0.08);
    animation: seal-pulse 3.6s ease-in-out infinite;
}

.brand-copy h1,
.dash-header h1 {
    margin: 0;
    color: var(--gold-bright);
    font-size: 70px;
    line-height: 0.92;
    letter-spacing: 0;
    text-shadow: 0 7px 34px rgba(0, 0, 0, 0.62);
}

.brand-subtitle {
    max-width: 460px;
    margin: 18px 0 0;
    color: #e7dcc6;
    font-size: 18px;
    line-height: 1.55;
}

.brand-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.brand-badges span {
    border: 1px solid rgba(93, 223, 207, 0.34);
    background: rgba(4, 12, 14, 0.7);
    color: var(--jade);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.hero-role {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    filter: drop-shadow(0 26px 42px rgba(0, 0, 0, 0.66));
    transform-origin: center bottom;
}

.hero-role-female {
    right: 42px;
    bottom: -34px;
    width: min(45vw, 520px);
    animation: role-float 5.8s ease-in-out infinite;
}

.hero-role-male {
    right: 320px;
    bottom: 18px;
    width: min(32vw, 380px);
    opacity: 0.62;
    transform: scaleX(-1);
    animation: role-float-soft 6.6s ease-in-out infinite;
}

.auth-panel,
.server-panel,
.play-panel,
.dash-header,
.role-picker-panel {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(12, 17, 18, 0.92), rgba(7, 10, 11, 0.92));
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.auth-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 30px;
}

.auth-panel::before,
.role-picker-panel::before {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.04);
    content: "";
}

.panel-glow {
    position: absolute;
    inset: -2px;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 0 26%, rgba(255, 214, 120, 0.22) 36%, transparent 46%),
        radial-gradient(circle at 82% 0, rgba(93, 223, 207, 0.22), transparent 30%);
    opacity: 0.6;
    animation: panel-sheen 7s ease-in-out infinite;
}

.tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 52px;
    margin-bottom: 24px;
    border: 1px solid rgba(214, 154, 58, 0.32);
    background: rgba(255, 255, 255, 0.03);
}

.tab,
.primary-action,
.secondary-action,
.icon-button,
.server-card,
.role-option,
.career-card {
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.tab.is-active {
    background: linear-gradient(180deg, rgba(214, 154, 58, 0.25), rgba(214, 154, 58, 0.1));
    color: var(--gold-bright);
    box-shadow: inset 0 -2px 0 var(--gold-bright);
}

.character-register {
    margin: 18px 0 14px;
    border-top: 1px solid rgba(214, 154, 58, 0.18);
    padding-top: 18px;
}

.career-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.career-card {
    position: relative;
    display: grid;
    min-height: 172px;
    overflow: hidden;
    align-items: end;
    border: 1px solid rgba(214, 154, 58, 0.28);
    background: rgba(255, 255, 255, 0.045);
    color: var(--muted);
    padding: 0;
}

.career-card::after {
    position: absolute;
    inset: auto 0 0;
    height: 58%;
    background: linear-gradient(180deg, transparent, rgba(1, 5, 7, 0.9));
    content: "";
}

.career-card img {
    position: absolute;
    inset: auto 50% -32px auto;
    width: 150px;
    transform: translateX(50%);
    pointer-events: none;
    filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.58));
}

.career-card[data-career="1"] img {
    width: 134px;
    bottom: -44px;
}

.career-card span {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(2, 7, 8, 0.5);
    color: inherit;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

.career-card.is-selected {
    border-color: var(--line-hot);
    background: linear-gradient(180deg, rgba(214, 154, 58, 0.16), rgba(93, 223, 207, 0.06));
    color: var(--gold-bright);
    box-shadow: inset 0 0 0 1px rgba(255, 214, 120, 0.18), 0 16px 38px rgba(0, 0, 0, 0.22);
}

.field {
    position: relative;
    display: block;
    margin-bottom: 16px;
}

.field span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.field-icon {
    position: absolute;
    left: 14px;
    bottom: 15px;
    color: var(--dim);
    pointer-events: none;
}

input {
    width: 100%;
    height: 52px;
    border: 1px solid rgba(214, 154, 58, 0.3);
    border-radius: 0;
    outline: none;
    background: rgba(1, 6, 7, 0.76);
    color: var(--ink);
    padding: 0 14px 0 46px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

input:focus {
    border-color: var(--line-hot);
    box-shadow: 0 0 0 3px rgba(214, 154, 58, 0.16), inset 0 0 24px rgba(255, 214, 120, 0.04);
}

input:focus + .field-icon,
.field:focus-within .field-icon {
    color: var(--gold-bright);
}

.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    border: 1px solid rgba(255, 214, 120, 0.45);
    background: linear-gradient(180deg, #ffd87a, #d18a2d 55%, #a85f22);
    color: #110c07;
    font-weight: 950;
    text-transform: uppercase;
}

.primary-action {
    width: 100%;
}

.secondary-action {
    width: auto;
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold-bright);
}

.primary-action:hover,
.secondary-action:hover,
.server-card:hover,
.role-option:hover,
.career-card:hover,
.icon-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-hot);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.primary-action:disabled {
    cursor: not-allowed;
    filter: grayscale(0.55);
    opacity: 0.7;
}

.form-message {
    min-height: 24px;
    margin: 4px 0 16px;
    color: #ffb59b;
    font-size: 14px;
}

.form-message.is-ok {
    color: var(--jade);
}

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

.dashboard-view {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dash-header {
    display: flex;
    min-height: 118px;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
}

.dash-header h1 {
    font-size: 38px;
}

.dash-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--jade);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.icon-button {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(214, 154, 58, 0.34);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
}

.dash-layout {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(360px, 1fr);
    gap: 18px;
    min-height: 520px;
}

.server-panel,
.play-panel {
    padding: 22px;
}

.server-panel {
    overflow: hidden;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.panel-title h2,
.play-panel h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    font-size: 22px;
    letter-spacing: 0;
}

#server-count {
    display: grid;
    min-width: 34px;
    height: 28px;
    place-items: center;
    border: 1px solid rgba(93, 223, 207, 0.34);
    color: var(--jade);
    font-weight: 900;
}

.server-list {
    display: grid;
    max-height: 438px;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.server-card,
.role-option {
    display: grid;
    min-height: 66px;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(214, 154, 58, 0.18);
    background: rgba(255, 255, 255, 0.045);
    color: var(--ink);
    padding: 13px;
    text-align: left;
}

.server-card {
    grid-template-columns: 12px 1fr auto;
}

.server-card.is-selected,
.role-option.is-selected {
    border-color: var(--line-hot);
    background: linear-gradient(90deg, rgba(214, 154, 58, 0.18), rgba(93, 223, 207, 0.06));
}

.server-card strong,
.role-option strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-card small,
.role-option small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.state-pill,
.status-dot {
    display: inline-block;
    border-radius: 999px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #a9b0ae;
    box-shadow: 0 0 16px currentColor;
}

.state-pill {
    min-width: 50px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.state-hot {
    background: rgba(182, 66, 54, 0.24);
    color: #ffb0a8;
}

.state-new {
    background: rgba(93, 223, 207, 0.16);
    color: var(--jade);
}

.play-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: linear-gradient(180deg, rgba(12, 14, 16, 0.95), rgba(20, 12, 10, 0.92));
}

.server-summary {
    display: grid;
    grid-template-columns: 14px 1fr;
    align-items: center;
    gap: 12px;
}

.server-summary p {
    margin: 8px 0 0;
    color: var(--muted);
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.account-stats div {
    min-height: 92px;
    border: 1px solid rgba(214, 154, 58, 0.18);
    background: rgba(255, 255, 255, 0.045);
    padding: 14px;
}

.account-stats dt {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.account-stats dd {
    overflow-wrap: anywhere;
    margin: 10px 0 0;
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
}

.play-action {
    margin-top: auto;
}

.role-picker {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(10px);
}

.role-picker-panel {
    position: relative;
    width: min(520px, 100%);
    padding: 26px;
}

.role-picker-panel h2 {
    margin: 8px 0 18px;
    color: var(--gold-bright);
    font-size: 30px;
}

.role-picker-list {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.role-option {
    grid-template-columns: 1fr auto;
}

#egret-player {
    display: none;
    width: 100%;
    height: 100%;
    margin: auto;
    background: #05080a;
}

body.game-booting {
    overflow: hidden;
}

body.game-ready::before,
body.game-ready::after {
    display: none;
}

body.game-ready {
    background: #05080a;
}

@keyframes lantern-rise {
    0% { transform: translate3d(0, 0, 0) scaleY(0.4); opacity: 0; }
    12% { opacity: 0.54; }
    100% { transform: translate3d(40px, -112vh, 0) scaleY(1); opacity: 0; }
}

@keyframes role-float {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-14px) rotate(1deg); }
}

@keyframes role-float-soft {
    0%, 100% { transform: translateY(0) scaleX(-1) rotate(1deg); }
    50% { transform: translateY(-10px) scaleX(-1) rotate(-1deg); }
}

@keyframes seal-pulse {
    0%, 100% { box-shadow: 0 0 28px rgba(93, 223, 207, 0.2), inset 0 0 20px rgba(93, 223, 207, 0.08); }
    50% { box-shadow: 0 0 46px rgba(255, 214, 120, 0.26), inset 0 0 26px rgba(255, 214, 120, 0.1); }
}

@keyframes panel-sheen {
    0%, 100% { transform: translateX(-18%); opacity: 0.36; }
    50% { transform: translateX(18%); opacity: 0.72; }
}

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

@media (max-width: 1060px) {
    body {
        overflow: auto;
        overflow-x: hidden;
    }

    .portal-shell {
        position: absolute;
        display: block;
        width: 100%;
        max-width: 100vw;
        min-height: 100vh;
        padding: 22px;
        overflow-x: hidden;
    }

    .auth-view,
    .dash-layout {
        grid-template-columns: 1fr;
    }

    .auth-view {
        max-width: 620px;
        margin: 0 auto;
        gap: 20px;
    }

    .brand-stage {
        min-height: 360px;
    }

    .brand-copy {
        bottom: 20px;
    }

    .hero-role-female {
        right: -20px;
        width: 320px;
    }

    .hero-role-male {
        right: 180px;
        width: 240px;
    }

    .brand-copy h1 {
        font-size: 48px;
    }

    .brand-subtitle {
        font-size: 15px;
    }

    .dash-layout {
        min-height: 0;
    }

    .server-list {
        max-height: 320px;
    }

    .account-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    html,
    body {
        overflow-x: hidden;
    }

    .portal-shell {
        width: 100vw;
        max-width: 100vw;
        padding: 16px;
    }

    .auth-view,
    .dashboard-view {
        display: block;
        width: 100%;
        max-width: min(342px, calc(100vw - 32px));
        min-width: 0;
        margin: 0;
    }

    .auth-panel,
    .server-panel,
    .play-panel,
    .dash-header {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 20px;
    }

    .auth-panel {
        width: 100%;
    }

    .brand-stage {
        min-height: 300px;
    }

    .brand-seal {
        width: 58px;
        height: 58px;
        margin-bottom: 12px;
    }

    .brand-copy h1 {
        font-size: 42px;
    }

    .hero-role-female {
        width: 260px;
        right: -76px;
    }

    .hero-role-male {
        width: 210px;
        right: 92px;
        opacity: 0.48;
    }

    .brand-badges {
        display: none;
    }

    .tabs {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
        min-height: 48px;
    }

    .tab {
        min-width: 0;
        gap: 6px;
        overflow: hidden;
        padding: 0 6px;
        font-size: 12px;
        white-space: nowrap;
    }

    .tab .icon {
        flex: 0 0 auto;
        width: 16px;
        height: 16px;
    }

    .career-tabs {
        grid-template-columns: 1fr;
    }

    .career-card {
        min-height: 138px;
    }

    .career-card img {
        width: 122px;
        right: 22px;
        bottom: -36px;
        transform: none;
    }

    .career-card[data-career="1"] img {
        width: 110px;
        bottom: -44px;
    }

    .career-card span {
        text-align: left;
    }

    .dash-header {
        min-height: 96px;
    }

    .dash-header h1 {
        font-size: 30px;
    }
}
