/* —— 個人資料 · 置中舞台 + 戰鬥風背景 —— */
.profile-view {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 8px 12px 48px;
    overflow: hidden;
}

.profile-arena {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.profile-arena-base {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(127, 0, 255, 0.22), transparent 55%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(255, 80, 0, 0.12), transparent 50%),
        radial-gradient(ellipse 50% 35% at 85% 70%, rgba(0, 180, 255, 0.1), transparent 45%),
        linear-gradient(180deg, #06040f 0%, #0c0818 40%, #080610 100%);
}

.profile-arena-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: profileGlowDrift 12s ease-in-out infinite;
}

.profile-arena-glow-a {
    width: 320px;
    height: 320px;
    left: 10%;
    top: 15%;
    background: rgba(127, 0, 255, 0.35);
}

.profile-arena-glow-b {
    width: 280px;
    height: 280px;
    right: 5%;
    bottom: 20%;
    background: rgba(255, 60, 80, 0.25);
    animation-delay: -6s;
}

@keyframes profileGlowDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -15px) scale(1.08); }
}

.profile-arena-grid {
    position: absolute;
    inset: -50%;
    background-image:
        linear-gradient(rgba(127, 0, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 0, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    transform: perspective(400px) rotateX(58deg);
    transform-origin: center 30%;
    opacity: 0.7;
    mask-image: radial-gradient(ellipse 70% 55% at 50% 45%, black 20%, transparent 75%);
}

.profile-arena-scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 200, 0.4), transparent);
    box-shadow: 0 0 20px rgba(0, 255, 200, 0.3);
    animation: profileScan 6s linear infinite;
    opacity: 0.35;
}

@keyframes profileScan {
    0% { top: 5%; }
    100% { top: 95%; }
}

.profile-deco {
    position: absolute;
    font-size: clamp(48px, 8vw, 96px);
    opacity: 0.08;
    filter: drop-shadow(0 0 20px rgba(255, 200, 100, 0.3));
    user-select: none;
}

.profile-deco-tl { top: 8%; left: 6%; transform: rotate(-15deg); }
.profile-deco-tr { top: 12%; right: 8%; transform: rotate(12deg); }
.profile-deco-bl { bottom: 15%; left: 8%; transform: rotate(8deg); }
.profile-deco-br { bottom: 10%; right: 6%; transform: rotate(-8deg); }

.profile-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.profile-page {
    width: 100%;
    text-align: center;
}

.profile-card {
    text-align: center;
}

.profile-hero {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-page h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
    letter-spacing: 0.06em;
    text-shadow: 0 0 24px rgba(127, 0, 255, 0.5);
}

.profile-sub {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
    max-width: 36em;
    margin-left: auto;
    margin-right: auto;
}

.profile-card {
    background: linear-gradient(145deg, rgba(18, 12, 32, 0.92), rgba(8, 10, 24, 0.95));
    border: 1px solid rgba(160, 120, 255, 0.25);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 100, 50, 0.6), rgba(127, 0, 255, 0.6), transparent);
    opacity: 0.7;
}

.profile-card h3 {
    margin: 0 0 14px;
    font-size: 15px;
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.profile-email-heading {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}

.profile-email-heading__addr {
    display: block;
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    color: #88ffcc;
    word-break: break-all;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
    text-align: center;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7f00ff, #ff0055);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    line-height: 1;
    border: 3px solid #ffd700;
    box-shadow:
        0 0 24px rgba(255, 215, 0, 0.4),
        0 0 40px rgba(127, 0, 255, 0.25);
    flex-shrink: 0;
    overflow: hidden;
}

.profile-avatar.has-photo {
    padding: 0;
    font-size: 0;
    background: #0a0814;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.profile-avatar--btn {
    cursor: pointer;
    padding: 0;
    font: inherit;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-avatar--btn:hover {
    transform: scale(1.04);
    box-shadow:
        0 0 28px rgba(255, 215, 0, 0.55),
        0 0 48px rgba(127, 0, 255, 0.35);
}

.profile-avatar-editor {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.profile-avatar-editor__title {
    margin: 0 0 6px;
    font-size: 0.92rem;
    color: #fcecc6;
    text-align: center;
}

.profile-avatar-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px auto 12px;
    justify-content: center;
}

.profile-avatar-preset {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: rgba(12, 8, 28, 0.85);
    font-size: 1.65rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.profile-avatar-preset:hover {
    border-color: rgba(255, 215, 0, 0.65);
    transform: translateY(-1px);
}

.profile-avatar-preset.is-active {
    border-color: #ffd700;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
}

.profile-avatar-upload {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.profile-avatar-upload__label {
    cursor: pointer;
    margin: 0;
}

.btn-profile--outline {
    background: rgba(127, 0, 255, 0.18);
    border: 1px solid rgba(200, 160, 255, 0.45);
}

.btn-profile--ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(230, 220, 255, 0.9);
}

.profile-id-meta {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.65;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.profile-id-meta strong { color: #f0e6ff; }

.profile-identity {
    flex: 1;
    min-width: 120px;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    padding: 4px 4px 4px 18px;
    margin-left: 0;
    background: none;
    border: none;
    border-radius: 0;
    position: relative;
}

.profile-identity::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.14), transparent);
    pointer-events: none;
}

.profile-identity__label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(186, 230, 253, 0.75);
    text-transform: uppercase;
}

.profile-identity__label + .profile-identity__name,
.profile-identity__label + .profile-identity__job {
    margin-bottom: 0.35rem;
}

.profile-identity__name {
    margin: 0 0 0.5rem;
    font-size: clamp(1.1rem, 2.5vw, 1.45rem);
    font-weight: 900;
    line-height: 1.25;
    color: #fde68a;
    text-shadow: 0 0 16px rgba(251, 191, 36, 0.35);
    word-break: break-word;
}

.profile-identity__job {
    margin: 0;
    font-size: clamp(0.95rem, 2vw, 1.12rem);
    font-weight: 800;
    line-height: 1.3;
    color: var(--profile-job-color, #c084fc);
    text-shadow: 0 0 12px color-mix(in srgb, var(--profile-job-color, #c084fc) 45%, transparent);
    word-break: break-word;
}

.profile-field {
    margin-bottom: 14px;
}

.profile-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: rgba(240, 230, 255, 0.9);
    text-align: center;
}

.profile-field-hint {
    margin: -2px 0 8px;
    font-size: 11px;
    line-height: 1.45;
    color: rgba(180, 200, 255, 0.72);
    text-align: center;
}

.profile-field input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(140, 100, 255, 0.35);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
    text-align: center;
}

.profile-field input:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 12px rgba(0, 180, 255, 0.2);
}

.profile-field input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}

.profile-actions-center {
    justify-content: center;
}

.btn-profile {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #ff0055, #7f00ff);
    box-shadow: 0 4px 16px rgba(127, 0, 255, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-profile:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(255, 0, 100, 0.35);
}

.btn-profile.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(160, 120, 255, 0.4);
    color: #f0e6ff;
    box-shadow: none;
}

.btn-profile:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.email-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    margin: 0 auto 12px;
}

.email-status.verified {
    background: rgba(0, 200, 136, 0.15);
    border: 1px solid rgba(0, 200, 136, 0.4);
    color: #88ffcc;
}

.email-status.unverified {
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid rgba(255, 170, 0, 0.4);
    color: #ffcc66;
}

.email-status.none {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--muted);
}

.profile-email-bound {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 200, 136, 0.12);
    border: 1px solid rgba(0, 200, 136, 0.45);
    color: #a8ffd8;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.profile-email-bound.hidden {
    display: none;
}

.profile-email-bound-inline {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 200, 136, 0.12);
    border: 1px solid rgba(0, 200, 136, 0.45);
    color: #a8ffd8;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.profile-email-verify-wrap {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(127, 0, 255, 0.1);
    border: 1px solid rgba(163, 112, 247, 0.35);
}

.profile-email-verify-wrap.hidden {
    display: none;
}

.profile-email-verify-hint {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

#profile-email-form-wrap.is-bound-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.btn-profile.is-countdown {
    min-width: 9.5em;
}

.verify-code-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.verify-code-row input {
    flex: 1;
    letter-spacing: 4px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

.profile-msg {
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
    text-align: center;
}

.profile-msg.ok { color: #88ffcc; }
.profile-msg.err { color: #ff99bb; }

.profile-pw-intro {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 12px;
    text-align: center;
}

.profile-pw-status {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0, 200, 136, 0.08);
    border: 1px solid rgba(0, 200, 136, 0.3);
    text-align: center;
}

.profile-pw-badge {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
    color: #88ffcc;
}

.profile-pw-status-hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: rgba(180, 230, 210, 0.85);
}

.profile-pw-change-title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: #d4b8ff;
    text-align: center;
}

.profile-pw-change-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    justify-content: center;
}

.profile-forgot-row {
    margin: 12px 0 0;
    text-align: center;
}

.btn-forgot-pw-link {
    border: none;
    background: none;
    color: #00d4ff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}

.btn-forgot-pw-link:hover {
    color: #88eeff;
}

.persist-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(0, 200, 136, 0.08);
    border: 1px solid rgba(0, 200, 136, 0.25);
    font-size: 12px;
    color: #a8e6c8;
    margin-bottom: 16px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-box-profile {
    padding: 14px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.15);
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-box-profile:hover {
    border-color: rgba(255, 215, 0, 0.35);
    box-shadow: 0 0 16px rgba(255, 200, 0, 0.12);
}

.stat-box-profile .num {
    font-size: 20px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

.stat-box-profile .lbl {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

@media (max-width: 720px) {
    .profile-view {
        padding: 4px 12px 40px;
    }

    .profile-stage {
        max-width: min(400px, calc(100% - 8px));
    }

    .profile-card {
        padding: 16px 14px;
        text-align: center;
    }

    .profile-card h3,
    .profile-avatar-editor__title {
        justify-content: center;
        text-align: center;
    }

    .profile-field label,
    .profile-field-hint,
    .profile-pw-intro,
    .profile-email-verify-hint,
    .profile-pw-status-hint,
    .profile-pw-change-title {
        text-align: center;
    }

    .profile-field input {
        text-align: center;
    }

    .profile-actions,
    .profile-actions-center,
    .profile-pw-change-actions {
        justify-content: center;
    }

    .profile-avatar-presets {
        justify-content: center;
    }

    .profile-avatar-upload {
        justify-content: center;
    }

    .email-status {
        margin-left: auto;
        margin-right: auto;
    }

    .profile-email-bound,
    .profile-email-bound-inline {
        text-align: center;
    }

    .verify-code-row {
        flex-direction: column;
        align-items: stretch;
    }

    .verify-code-row .btn-profile {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .profile-deco {
        font-size: 40px;
        opacity: 0.05;
    }

    .profile-avatar-row {
        flex-direction: column;
        text-align: center;
    }

    .profile-id-meta {
        text-align: center;
    }

    .profile-identity {
        margin-left: 0;
        max-width: none;
        width: 100%;
        padding: 12px 4px 0;
    }

    .profile-identity::before {
        left: 12%;
        right: 12%;
        top: 0;
        bottom: auto;
        width: auto;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    }
}

/* ── 頭像裁切／旋轉編輯器 ── */
.avatar-crop-modal {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.avatar-crop-modal.hidden {
    display: none;
}

body.avatar-crop-open {
    overflow: hidden;
}

.avatar-crop-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 16, 0.82);
    backdrop-filter: blur(4px);
}

.avatar-crop-modal__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 380px);
    padding: 20px 18px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.35);
    background:
        linear-gradient(180deg, rgba(24, 14, 48, 0.98), rgba(8, 10, 24, 0.98));
    box-shadow: 0 0 40px rgba(127, 0, 255, 0.25);
}

.avatar-crop-modal__panel h3 {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.05rem;
    color: #fcecc6;
}

.avatar-crop-modal__hint {
    margin: 0 0 14px;
    text-align: center;
    font-size: 0.82rem;
    color: rgba(210, 220, 255, 0.78);
    line-height: 1.45;
}

.avatar-crop-viewport {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 215, 0, 0.65);
    box-shadow:
        0 0 24px rgba(255, 215, 0, 0.25),
        inset 0 0 0 999px rgba(0, 0, 0, 0.35);
    background: #0a0814;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.avatar-crop-viewport:active {
    cursor: grabbing;
}

.avatar-crop-viewport img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    pointer-events: none;
    transform-origin: center center;
}

.avatar-crop-rotate-btns {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.avatar-crop-rotate-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 215, 0, 0.45);
    background: rgba(127, 0, 255, 0.22);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.12s ease;
}

.avatar-crop-rotate-btn:hover {
    border-color: rgba(255, 215, 0, 0.85);
    transform: scale(1.05);
}

.avatar-crop-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.avatar-crop-control {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(220, 230, 255, 0.92);
}

.avatar-crop-control__label {
    font-weight: 700;
}

.avatar-crop-control__val {
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #ffd700;
}

.avatar-crop-control input[type='range'] {
    width: 100%;
    accent-color: #c084fc;
}

.avatar-crop-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.avatar-crop-actions .btn-profile {
    min-width: 108px;
}
