/* ============================================================
   MODERN TOWER PAGE — CHESS KINGDOM V2
   Epic 18-Floor Spire, 4 Realms, Royal Codex & Mystic Chamber
   ============================================================ */

.modern-tower-wrapper {
    min-height: calc(100vh - 56px);
    background: radial-gradient(circle at 50% 10%, #20134D 0%, #0D0826 70%, #050314 100%);
    position: relative;
    padding-bottom: 60px;
    overflow-x: hidden;
}

/* Background Atmosphere (Stars & Fog) */
.tower-atmosphere {
    position: absolute;
    inset: 0;
    background: url('/images/bg-tower.png') center top/cover no-repeat;
    opacity: 0.22;
    pointer-events: none;
    mix-blend-mode: lighten;
}

/* Tower Header Bar */
.tower-header-bar {
    background: rgba(13, 8, 38, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.tower-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tower-back-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 215, 0, 0.35);
    color: #FFFFFF;
    font-size: 0.88rem;
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.tower-back-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--rpg-gold);
    transform: translateX(-3px);
}

.tower-title-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tower-title-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.tower-title-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: #FFFFFF;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.tower-secret-trigger {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.85), rgba(109, 40, 217, 0.9));
    border: 1.5px solid rgba(216, 180, 254, 0.6);
    color: #FFFFFF;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
    animation: secretPulse 2.5s infinite;
    transition: all 0.25s ease;
}

.tower-secret-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.7);
}

/* ---------- 2-COLUMN MAIN LAYOUT ---------- */
.tower-main-layout {
    max-width: 1400px;
    margin: 24px auto 0;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 480px 1fr;
    gap: 32px;
    align-items: start;
    position: relative;
    z-index: 10;
}

/* Left Column: Visual Spire */
.tower-spire-column {
    background: rgba(18, 12, 44, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 2px solid rgba(255, 215, 0, 0.25);
    border-radius: 24px;
    padding: 24px 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

.tower-spire-column::-webkit-scrollbar {
    width: 6px;
}
.tower-spire-column::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 3px;
}

/* Peak & Crown */
.spire-peak {
    text-align: center;
    padding: 16px 0 24px;
    position: relative;
}

.spire-peak-crown {
    font-size: 3rem;
    animation: rpgFloatGlow 3s infinite ease-in-out;
}

.spire-peak-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--rpg-gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 6px;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

/* Realm Dividers */
.realm-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 14px;
    margin: 16px 0 12px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.realm-banner--diamond {
    background: var(--realm-diamond-gradient);
    color: #FFFFFF;
    box-shadow: var(--realm-diamond-glow);
}

.realm-banner--gold {
    background: var(--realm-gold-gradient);
    color: #381A00;
    box-shadow: var(--realm-gold-glow);
}

.realm-banner--silver {
    background: var(--realm-silver-gradient);
    color: #0F172A;
    box-shadow: var(--realm-silver-glow);
}

.realm-banner--bronze {
    background: var(--realm-bronze-gradient);
    color: #FFFFFF;
    box-shadow: var(--realm-bronze-glow);
}

/* Floor Platforms (Stepping Stones) */
.spire-floors-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spire-floor-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    user-select: none;
}

.spire-floor-node:hover:not(.locked) {
    transform: translateX(6px) scale(1.02);
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Floor States */
.spire-floor-node.active-selected {
    border-color: var(--rpg-gold) !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 140, 0, 0.08)) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35) !important;
}

.spire-floor-node.completed {
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.05));
}

.spire-floor-node.current-climbing {
    border-color: var(--rpg-gold);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(168, 85, 247, 0.15));
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.45);
    animation: currentFloorGlow 2.5s infinite alternate;
}

@keyframes currentFloorGlow {
    from { box-shadow: 0 0 16px rgba(255, 215, 0, 0.35); }
    to { box-shadow: 0 0 28px rgba(255, 215, 0, 0.65); }
}

.spire-floor-node.promotable {
    border-color: #38BDF8;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(37, 99, 235, 0.15));
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    animation: promotePulse 1.8s infinite ease-in-out;
}

@keyframes promotePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.spire-floor-node.locked {
    opacity: 0.55;
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.06);
}

/* Floor Left info */
.floor-node-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.floor-badge-number {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.45);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 900;
    color: #FFFFFF;
}

.spire-floor-node.completed .floor-badge-number {
    background: #10B981;
    border-color: #34D399;
    color: #FFFFFF;
}

.spire-floor-node.current-climbing .floor-badge-number {
    background: var(--rpg-gold-gradient);
    border-color: #FFE57F;
    color: #2D1400;
}

.floor-node-avatar-here {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
    animation: rpgFloatGlow 2s infinite ease-in-out;
    z-index: 10;
}

.floor-meta-titles {
    display: flex;
    flex-direction: column;
}

.floor-name-text {
    font-size: 0.95rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 0.3px;
}

.floor-stars-req {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--rpg-gold);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Floor Right badges */
.floor-node-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.floor-status-pill {
    font-size: 0.72rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.pill--completed { background: rgba(16, 185, 129, 0.25); color: #6EE7B7; border: 1px solid rgba(16, 185, 129, 0.4); }
.pill--current { background: rgba(255, 215, 0, 0.25); color: #FFE066; border: 1px solid rgba(255, 215, 0, 0.5); }
.pill--promotable { background: rgba(56, 189, 248, 0.3); color: #BAE6FD; border: 1px solid #38BDF8; font-weight: 900; }
.pill--locked { background: rgba(0, 0, 0, 0.4); color: rgba(255, 255, 255, 0.4); }

.floor-chest-icon {
    font-size: 1.3rem;
    animation: chestWiggle 3.5s infinite;
    cursor: help;
}

/* ---------- RIGHT COLUMN: ROYAL CODEX (TASK BOARD) ---------- */
.tower-codex-column {
    background: rgba(18, 12, 44, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.tower-codex-column::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--rpg-gold-gradient);
}

/* Codex Floor Header */
.codex-hero-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.codex-crest-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(168, 85, 247, 0.15));
    border: 2px solid var(--rpg-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35);
}

.codex-title-info {
    flex: 1;
}

.codex-floor-tag {
    font-size: 0.78rem;
    font-weight: 900;
    color: var(--rpg-gold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.codex-floor-name {
    font-size: 1.8rem;
    font-weight: 900;
    color: #FFFFFF;
    margin: 2px 0 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.codex-floor-lore {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Floor Overall Progress */
.codex-overall-progress {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.progress-labels-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.progress-bar-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-gold-fill {
    height: 100%;
    background: var(--rpg-gold-gradient);
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 4 Task Groups (Tactics, Middlegame, Endgame, Competition) */
.codex-groups-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.codex-group-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid var(--group-color, rgba(255, 255, 255, 0.12));
    border-radius: 18px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.codex-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
}

.codex-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.group-label-meta {
    display: flex;
    flex-direction: column;
}

.group-label-name {
    font-size: 1rem;
    font-weight: 800;
    color: #FFFFFF;
}

.group-label-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.group-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-pct-badge {
    font-size: 0.95rem;
    font-weight: 900;
}

.group-chevron-icon {
    font-size: 0.85rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.codex-group-tasks-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Individual Task Card */
.codex-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.codex-task-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateX(4px);
}

.codex-task-item.completed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.06);
}

.task-item-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.task-checkbox-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.task-info-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.task-title-text {
    font-size: 0.92rem;
    font-weight: 800;
    color: #FFFFFF;
}

.codex-task-item.completed .task-title-text {
    text-decoration: line-through;
    opacity: 0.65;
}

.task-desc-text {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.task-reward-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--rpg-gold);
    margin-top: 4px;
}

/* 3D Action Buttons inside Tasks */
.task-action-btn {
    border: none;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    text-align: center;
}

.task-action-btn:hover {
    transform: translateY(-2px) scale(1.05);
}

.btn-task-puzzle {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: #FFFFFF;
}

.btn-task-bot {
    background: linear-gradient(135deg, #F97316 0%, #C2410C 100%);
    color: #FFFFFF;
}

.btn-task-book {
    background: linear-gradient(135deg, #A855F7 0%, #7E22CE 100%);
    color: #FFFFFF;
}

.btn-task-done {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34D399;
    cursor: default;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .tower-main-layout {
        grid-template-columns: 1fr;
    }

    .tower-spire-column {
        position: static;
        max-height: none;
    }
}
