/* ======================================================
   Maguioria STORIES — Auth & Account
   ====================================================== */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 1rem 3rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: rgba(31, 15, 61, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(196, 181, 253, 0.15);
    border-radius: var(--radius-lg);
    padding: 2.4rem 2rem;
    box-shadow: var(--shadow-card);
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(800px 200px at 50% -10%, rgba(255, 122, 89, 0.18), transparent 60%);
    pointer-events: none;
}

.auth-card-inner {
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--cream);
    margin-bottom: 0.5rem;
}

.auth-title {
    font-family: 'Fraunces', serif;
    font-size: 1.9rem;
    line-height: 1.15;
    color: var(--cream);
    margin: 0.25rem 0 0.4rem;
}

.auth-sub {
    color: var(--text-soft);
    font-size: 0.98rem;
    margin-bottom: 1.6rem;
}

.auth-field {
    margin-bottom: 1rem;
}

.auth-field label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-soft);
    margin-bottom: 0.4rem;
    letter-spacing: 0.3px;
}

.auth-field input {
    width: 100%;
    background: rgba(20, 8, 39, 0.55);
    border: 1px solid rgba(196, 181, 253, 0.2);
    color: var(--cream);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.auth-field input:focus {
    border-color: var(--coral);
    box-shadow: 0 0 0 4px rgba(255, 77, 141, 0.18);
}

.auth-field input::placeholder {
    color: rgba(203, 184, 224, 0.45);
}

.auth-field.with-icon {
    position: relative;
}

.auth-field.with-icon input {
    padding-right: 2.7rem;
}

.auth-field .field-toggle {
    position: absolute;
    right: 0.85rem;
    top: 2.1rem;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.4rem 0 1.2rem;
    font-size: 0.9rem;
}

.auth-row label {
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
}

.auth-row a {
    color: var(--gold-soft);
    text-decoration: none;
    font-weight: 600;
}

.auth-row a:hover {
    text-decoration: underline;
}

.btn-magic {
    width: 100%;
    border: 0;
    background: var(--grad-magic);
    color: white;
    padding: 0.95rem 1.2rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
    font-family: inherit;
}

.btn-magic:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 24px 70px -15px rgba(255, 77, 141, 0.55);
}

.btn-magic:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-ghost {
    width: 100%;
    border: 1px solid rgba(196, 181, 253, 0.25);
    background: transparent;
    color: var(--cream);
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 200ms var(--ease), border-color 200ms var(--ease);
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-ghost:hover {
    background: rgba(196, 181, 253, 0.08);
    border-color: rgba(196, 181, 253, 0.45);
}

.auth-divider {
    text-align: center;
    color: var(--text-mute);
    font-size: 0.85rem;
    margin: 1.2rem 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 30px);
    height: 1px;
    background: rgba(196, 181, 253, 0.18);
}

.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-foot {
    text-align: center;
    margin-top: 1.4rem;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.auth-foot a {
    color: var(--gold-soft);
    font-weight: 700;
    text-decoration: none;
}

.auth-foot a:hover { text-decoration: underline; }

.auth-alert {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.auth-alert.error {
    background: rgba(255, 77, 141, 0.12);
    border: 1px solid rgba(255, 77, 141, 0.35);
    color: #ffd6e3;
}

.auth-alert.success {
    background: rgba(94, 234, 212, 0.10);
    border: 1px solid rgba(94, 234, 212, 0.35);
    color: #c9fdf2;
}

/* ====== Spinner inline ====== */
.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Account dashboard ===== */
.account-shell {
    min-height: 100vh;
    padding: 6rem 1rem 4rem;
    position: relative;
    z-index: 1;
}

.account-container {
    max-width: 1180px;
    margin: 0 auto;
}

.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.4rem;
}

.account-greeting h1 {
    font-family: 'Fraunces', serif;
    font-size: 2.2rem;
    margin: 0;
    color: var(--cream);
}

.account-greeting p {
    color: var(--text-soft);
    margin: 0.3rem 0 0;
}

.tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.8rem;
    padding: 0.4rem;
    background: rgba(20, 8, 39, 0.6);
    border: 1px solid rgba(196, 181, 253, 0.12);
    border-radius: 999px;
    width: fit-content;
}

.tab-btn {
    border: 0;
    background: transparent;
    color: var(--text-soft);
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 180ms var(--ease), color 180ms var(--ease);
    font-family: inherit;
}

.tab-btn:hover { color: var(--cream); }

.tab-btn.active {
    background: var(--grad-logo);
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(255, 77, 141, 0.6);
}

.section-card {
    background: rgba(31, 15, 61, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(196, 181, 253, 0.12);
    border-radius: var(--radius);
    padding: 1.6rem;
    margin-bottom: 1.4rem;
    color: var(--text);
}

.section-card h2 {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    color: var(--cream);
    margin: 0 0 1rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.profile-grid div span {
    display: block;
    color: var(--text-mute);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.25rem;
}

.profile-grid div strong {
    color: var(--cream);
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.story-item {
    background: rgba(20, 8, 39, 0.55);
    border: 1px solid rgba(196, 181, 253, 0.15);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 200ms var(--ease), border-color 200ms var(--ease);
    display: flex;
    flex-direction: column;
}

.story-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 77, 141, 0.45);
}

.story-cover {
    height: 130px;
    background: linear-gradient(135deg, #ff7a59, #ff4d8d, #c084fc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: #fff5e1;
}

.story-body {
    padding: 0.9rem 1rem 1.1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.story-title {
    color: var(--cream);
    font-weight: 700;
    margin: 0 0 0.3rem;
    font-size: 1rem;
    line-height: 1.25;
}

.story-meta {
    color: var(--text-mute);
    font-size: 0.78rem;
    margin-top: auto;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-soft);
}

.empty-state .emoji {
    font-size: 2.4rem;
    display: block;
    margin-bottom: 0.4rem;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}

.tbl th, .tbl td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid rgba(196, 181, 253, 0.10);
    font-size: 0.92rem;
}

.tbl th {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.74rem;
    color: var(--text-mute);
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.badge.green { background: rgba(94, 234, 212, 0.18); color: #5eead4; }
.badge.gold  { background: rgba(255, 200, 87, 0.18); color: #ffc857; }
.badge.gray  { background: rgba(138, 122, 168, 0.22); color: #cbb8e0; }
.badge.pink  { background: rgba(255, 77, 141, 0.18); color: #ff8fb3; }

/* ===== Cuentos ejemplo grid ===== */
.cuentos-shell {
    min-height: 100vh;
    padding: 6rem 1rem 4rem;
    position: relative;
    z-index: 1;
}

.cuentos-container {
    max-width: 1180px;
    margin: 0 auto;
}

.cuentos-header {
    text-align: center;
    margin-bottom: 2.6rem;
}

.cuentos-header h1 {
    font-family: 'Fraunces', serif;
    font-size: 2.6rem;
    color: var(--cream);
    margin: 0.4rem 0 0.6rem;
}

.cuentos-header p {
    color: var(--text-soft);
    max-width: 640px;
    margin: 0 auto;
}

.cuentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.4rem;
}

.cuento-card {
    background: rgba(31, 15, 61, 0.65);
    border: 1px solid rgba(196, 181, 253, 0.12);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.cuento-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 122, 89, 0.45);
    box-shadow: 0 24px 60px -20px rgba(255, 77, 141, 0.45);
}

.cuento-cover {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #fff5e1;
    position: relative;
    overflow: hidden;
}

.cuento-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 80px at 30% 30%, rgba(255,255,255,0.25), transparent 60%);
    pointer-events: none;
}

.cuento-body {
    padding: 1rem 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cuento-tag {
    display: inline-block;
    background: rgba(255, 200, 87, 0.18);
    color: var(--gold-soft);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.cuento-title {
    font-family: 'Fraunces', serif;
    color: var(--cream);
    font-size: 1.15rem;
    line-height: 1.2;
    margin: 0 0 0.3rem;
}

.cuento-sub {
    color: var(--text-soft);
    font-size: 0.85rem;
    margin: 0 0 0.7rem;
    flex: 1;
}

.cuento-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-mute);
    font-size: 0.78rem;
}

.cuento-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--gold-soft);
    font-weight: 700;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 1.4rem;
}

.back-link:hover { color: var(--cream); }

/* ====== Welcome dashboard ====== */
.welcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.welcome-stat {
    background: rgba(20, 8, 39, 0.6);
    border: 1px solid rgba(196, 181, 253, 0.15);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
}

.welcome-stat .label {
    color: var(--text-mute);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 0.4rem;
}

.welcome-stat .value {
    color: var(--cream);
    font-family: 'Fraunces', serif;
    font-size: 1.7rem;
    line-height: 1.1;
}

.welcome-stat .sub {
    color: var(--text-soft);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* Character circles (estilo testing) */
.char-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    justify-content: flex-start;
    padding: 0.6rem 0 0.2rem;
}

.char-pill {
    width: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 280ms cubic-bezier(.34,1.56,.64,1);
    position: relative;
}

.char-pill:hover { transform: translateY(-6px) scale(1.04); }

.char-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.35);
    border: 2px solid rgba(196,181,253,0.20);
    background: linear-gradient(135deg, #7b2ff7, #ff4d8d);
    position: relative;
}

.char-avatar img {
    width: 100%; height: 100%; object-fit: cover;
}

.char-pill:hover .char-avatar {
    box-shadow: 0 0 30px rgba(123,47,247,0.55), 0 8px 25px rgba(0,0,0,0.4);
}

.char-edit-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(15,12,41,0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    opacity: 0;
    transition: opacity 200ms ease;
}

.char-pill:hover .char-edit-overlay { opacity: 1; }

.char-pill .char-name {
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--cream);
    text-align: center;
}

.char-pill .char-meta {
    font-size: 0.78rem;
    color: var(--text-mute);
}

.add-char-pill {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px dashed rgba(196,181,253,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: var(--text-soft);
    background: rgba(123,47,247,0.08);
    transition: all 0.25s;
}

.char-pill:hover .add-char-pill {
    border-color: #c084fc;
    background: rgba(123,47,247,0.18);
    color: #fff;
    transform: scale(1.05);
}

/* Modal magic */
.magic-modal .modal-content {
    background: rgba(20, 8, 39, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(196,181,253,0.18);
    border-radius: var(--radius);
    color: var(--text);
}

.magic-modal .modal-header {
    border-bottom: 1px solid rgba(196,181,253,0.10);
}

.magic-modal .modal-footer {
    border-top: 1px solid rgba(196,181,253,0.10);
}

.magic-modal .form-label {
    color: var(--text-soft);
    font-size: 0.86rem;
    font-weight: 600;
}

.magic-modal .form-control,
.magic-modal .form-select {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(196,181,253,0.18);
    color: var(--cream);
}

.magic-modal .form-control:focus,
.magic-modal .form-select:focus {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,77,141,0.55);
    color: var(--cream);
    box-shadow: 0 0 0 3px rgba(255,77,141,0.15);
}

/* ── Chip / pill selector (welcome modals) ── */
.magic-modal .form-label-magic {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-soft);
    margin-bottom: 6px;
    display: block;
}

.magic-modal .form-magic {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(196,181,253,0.18);
    border-radius: 14px;
    color: var(--cream);
    padding: 12px 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.magic-modal .form-magic:focus {
    outline: none;
    border-color: rgba(255,77,141,0.55);
    box-shadow: 0 0 0 3px rgba(255,77,141,0.15);
    background: rgba(255,255,255,0.08);
}

.magic-modal .chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.magic-modal .chip {
    padding: 8px 18px;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.25s;
    user-select: none;
}

.magic-modal .chip:hover {
    border-color: rgba(123,47,247,0.4);
    background: rgba(123,47,247,0.08);
}

.magic-modal .chip.active {
    border-color: #7b2ff7;
    background: linear-gradient(135deg, rgba(123,47,247,0.25), rgba(255,77,166,0.15));
    color: #fff;
    box-shadow: 0 0 15px rgba(123,47,247,0.2);
}

/* ── Avatar palette (matches /Testing) ── */
.char-avatar.avatar-bg-1 { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.char-avatar.avatar-bg-2 { background: linear-gradient(135deg, #7b2ff7, #5f27cd); }
.char-avatar.avatar-bg-3 { background: linear-gradient(135deg, #1a73e8, #0984e3); }
.char-avatar.avatar-bg-4 { background: linear-gradient(135deg, #ff4da6, #e84393); }
.char-avatar.avatar-bg-5 { background: linear-gradient(135deg, #ff8c42, #fdcb6e); }
.char-avatar.avatar-bg-6 { background: linear-gradient(135deg, #34d399, #00b894); }
.char-avatar.avatar-bg-7 { background: linear-gradient(135deg, #00cec9, #0abde3); }
.char-avatar.avatar-bg-8 { background: linear-gradient(135deg, #a29bfe, #6c5ce7); }

/* Disabled add-character pill */
.char-pill.disabled {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

.upload-dropzone {
    border: 2px dashed rgba(196,181,253,0.35);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    background: rgba(123,47,247,0.06);
    transition: all 0.25s;
    cursor: pointer;
}

.upload-dropzone:hover {
    border-color: #ff4d8d;
    background: rgba(255,77,141,0.08);
}

.crop-frame {
    width: 320px;
    height: 320px;
    max-width: 100%;
    margin: 0 auto;
    background: #0f0c29;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    touch-action: none;
    user-select: none;
    cursor: grab;
}

.crop-frame:active { cursor: grabbing; }

.crop-frame .crop-img {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}

.crop-frame .crop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 2px rgba(196,181,253,0.35);
    border-radius: 18px;
}

/* Sparkle / magic loader */
.magic-loader {
    position: relative;
    width: 100%;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: var(--cream);
}

.magic-orb {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff7a59, #ff4d8d, #c084fc, #5eead4, #ffc857, #ff7a59);
    filter: blur(0.5px);
    animation: orbSpin 3.2s linear infinite, orbPulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(255,77,141,0.55), 0 0 100px rgba(192,132,252,0.35);
    margin-bottom: 1rem;
}

@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbPulse {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(1.06); }
}

.magic-sparkle {
    position: absolute;
    font-size: 1.1rem;
    animation: floatSparkle 2.4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes floatSparkle {
    0%   { transform: translateY(0) scale(0.8); opacity: 0; }
    50%  { opacity: 1; }
    100% { transform: translateY(-30px) scale(1.2); opacity: 0; }
}

.welcome-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.4rem;
}

.welcome-nav a {
    background: rgba(20,8,39,0.6);
    border: 1px solid rgba(196,181,253,0.15);
    color: var(--text-soft);
    padding: 0.55rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 200ms ease;
}

.welcome-nav a:hover,
.welcome-nav a.active {
    color: #fff;
    background: var(--grad-logo);
    border-color: transparent;
}

.cancel-reason {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid rgba(196,181,253,0.18);
    border-radius: 14px;
    cursor: pointer;
    margin-bottom: 0.6rem;
    background: rgba(20,8,39,0.55);
    transition: all 200ms ease;
}

.cancel-reason:hover { border-color: rgba(255,77,141,0.45); }

.cancel-reason.active {
    background: rgba(255,77,141,0.1);
    border-color: #ff4d8d;
    color: var(--cream);
}

/* ===== Sidebar layout ===== */
.account-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    max-width: 1280px;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    top: 6rem;
    width: 240px;
    flex-shrink: 0;
    background: rgba(20, 8, 39, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(196, 181, 253, 0.12);
    border-radius: var(--radius);
    padding: 1.2rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem 0.9rem;
    border-bottom: 1px solid rgba(196,181,253,0.10);
    margin-bottom: 0.6rem;
    font-family: 'Fraunces', serif;
    font-weight: 800;
    font-size: 1.25rem;
    background: var(--grad-logo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
}

.sidebar-brand .sparkle { -webkit-text-fill-color: initial; }

.sidebar a.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 180ms ease;
}

.sidebar a.sidebar-link:hover {
    color: var(--cream);
    background: rgba(196,181,253,0.08);
}

.sidebar a.sidebar-link.active {
    color: #fff;
    background: var(--grad-logo);
    box-shadow: 0 8px 20px -10px rgba(255,77,141,0.6);
}

.sidebar a.sidebar-link.logout {
    margin-top: auto;
    color: var(--text-mute);
    border-top: 1px solid rgba(196,181,253,0.08);
    padding-top: 0.9rem;
    border-radius: 0;
}

.sidebar a.sidebar-link.logout:hover {
    color: #ff8aa6;
    background: transparent;
}

.account-main {
    flex: 1;
    min-width: 0;
}

.sidebar-toggle {
    display: none;
    background: rgba(20,8,39,0.6);
    border: 1px solid rgba(196,181,253,0.18);
    color: var(--cream);
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    margin-bottom: 1rem;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 900px) {
    .account-layout { flex-direction: column; gap: 1rem; }
    .sidebar {
        position: relative;
        top: 0;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 0.6rem;
    }
    .sidebar-brand { display: none; }
    .sidebar a.sidebar-link { white-space: nowrap; }
    .sidebar a.sidebar-link.logout {
        margin-top: 0;
        border-top: 0;
        padding-top: 0.7rem;
        border-radius: 12px;
    }
}

/* ===== Char hover action buttons (avatar circle) ===== */
.char-avatar .char-action-stack {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(15,12,41,0.62);
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
}

.char-pill:hover .char-avatar .char-action-stack {
    opacity: 1;
    pointer-events: auto;
}

.char-action-stack button {
    border: 0;
    background: rgba(255,255,255,0.10);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 180ms ease, background 180ms ease;
}

.char-action-stack button:hover {
    transform: scale(1.12);
    background: var(--grad-logo);
}

/* Add-character circle: button to upload directly on the avatar circle on hover */
.add-upload-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: var(--grad-logo);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 8px 20px -8px rgba(255,77,141,0.7);
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease;
}

.char-pill:hover .add-upload-btn {
    opacity: 1;
    transform: scale(1.05);
}

/* Timezone select option styling (dark dropdown contrast) */
.tz-select option {
    color: #000;
    background: #fff;
}

/* Delete action highlighted */
.char-action-stack button.char-delete-btn {
    background: rgba(255, 77, 141, 0.18);
}

.char-action-stack button.char-delete-btn:hover {
    background: linear-gradient(135deg, #ff4d8d, #b91c1c);
}
