/* Galaxy Materializer v25 — /gg/img/ absolute asset paths */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

.page.galaxyGates {
    --accent: #5b9aff;
    --accent-dim: rgba(91, 154, 255, 0.14);
    --glass: rgba(10, 14, 24, 0.88);
    --glass-2: rgba(16, 22, 36, 0.72);
    --edge: rgba(255, 255, 255, 0.09);
    --edge-hi: rgba(255, 255, 255, 0.16);
    --text: #f1f5f9;
    --muted: #8fa3bc;
    --uridium: #6ec8ff;
    --extra: #7ddea0;
    --nano: #e8c468;
    --lives: #f472b6;
    --ok: #4ade80;
    --radius: 12px;
    --radius-sm: 8px;
    --gap: 10px;
    --portal-w: min(420px, 100%);
    --portal-h: 236px;
    --gg-top: 252px;
    --page-pad: 14px;

    position: fixed;
    top: var(--gg-top);
    left: 0;
    right: 0;
    bottom: 12px;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    font-family: Rajdhani, 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    overflow: hidden;
    z-index: 5;
}
.page.galaxyGates .footer { display: none !important; }

#gg-window[data-accent="alpha"]   { --accent: #5b9aff; }
#gg-window[data-accent="beta"]    { --accent: #e8a84a; }
#gg-window[data-accent="gamma"]   { --accent: #b07aff; }
#gg-window[data-accent="delta"]   { --accent: #3dd6c8; }
#gg-window[data-accent="epsilon"] { --accent: #f472b6; }
#gg-window[data-accent="zeta"]    { --accent: #38bdf8; }
#gg-window[data-accent="kappa"]   { --accent: #fb7185; }
#gg-window[data-accent="lambda"]  { --accent: #818cf8; }
#gg-window[data-accent="kronos"]  { --accent: #e879f9; }
#gg-window[data-accent="hades"]   { --accent: #f87171; }
#gg-window[data-accent="kuiper"]  { --accent: #94a3b8; }

/* ── Viewport shell ── */
.gm-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--page-pad);
    box-sizing: border-box;
}
.gm-shell {
    width: 100%;
    max-width: 1080px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

/* ── Panel ── */
#gg-window.gm-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    margin: 0 auto;
    position: relative;
    border: 1px solid var(--edge) !important;
    border-radius: 16px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(20, 40, 80, 0.35), transparent 50%),
        var(--glass) !important;
    backdrop-filter: blur(28px) saturate(1.25);
    -webkit-backdrop-filter: blur(28px) saturate(1.25);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
#gg-window.gm-panel::before {
    display: block !important;
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 2px;
    z-index: 20;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    pointer-events: none;
}
#gg-window.gm-panel > * { position: relative; z-index: 1; }
#gg-window.gg-busy {
    cursor: wait;
}
/* No full-window blur/dim on click — only disable the spin controls. */
#gg-window.gg-busy::after {
    display: none !important;
}
#gg-window.gg-busy .gm-spin-amount,
#gg-window.gg-busy .gg-btn-energy,
#gg-window.gg-busy .gg-btn-free {
    pointer-events: none;
    opacity: 0.7;
}

/* ── Header ── */
.gm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--edge);
    background: var(--glass-2);
    flex-shrink: 0;
}
.gm-bar-kicker {
    margin: 0 0 2px;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.gm-bar-title h1 {
    margin: 0;
    font-family: Orbitron, Tahoma, sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text);
    text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
.gm-bar-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.gm-stat {
    padding: 6px 11px;
    min-width: 92px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--edge);
    background: rgba(0, 0, 0, 0.22);
}
.gm-stat-lbl {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.gm-stat-val {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.gm-stat.uridium .gm-stat-val { color: var(--uridium); }
.gm-stat.extra .gm-stat-val { color: var(--extra); }
.gm-stat.nano .gm-stat-val { font-size: 11px; }
.gm-stat-bar {
    height: 2px;
    margin-top: 4px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 2px;
    overflow: hidden;
}
.gm-stat-bar i {
    display: block;
    height: 100%;
    background: var(--nano);
    transition: width 0.25s ease;
}

/* ── Main 3 columns ── */
.gm-grid {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) 258px;
    gap: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* Gates */
.gm-rail {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 6px;
    border-right: 1px solid var(--edge);
    background: rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    min-height: 0;
}
.gm-rail-title {
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--edge);
}
.gg-gate-tab {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 6px 7px !important;
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    text-align: left !important;
    color: var(--muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
    box-shadow: none !important;
}
.gg-gate-thumb {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #152033;
}
.gg-gate-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.gg-gate-tab:hover {
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}
.gg-gate-tab.active {
    color: var(--text) !important;
    background: var(--accent-dim) !important;
    border-color: var(--edge-hi) !important;
    box-shadow: inset 2px 0 0 var(--accent) !important;
}
.gg-gate-tab.locked {
    opacity: 0.28;
    pointer-events: none;
}
.gg-gate-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Center column */
.gm-core {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--edge);
}
.gm-core-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    min-height: 36px;
    border-bottom: 1px solid var(--edge);
    flex-shrink: 0;
}
#gg-status-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gg-parts-pill {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: Orbitron, Tahoma, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e8f4ff;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, rgba(255,255,255,0.12));
    box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 20%, transparent);
}
.gm-core-tools {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.gm-stage-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 12px 16px 8px;
    overflow: hidden;
}
.gm-portal,
.gg-viewport {
    position: relative;
    box-sizing: border-box;
    width: 380px;
    min-width: 280px;
    max-width: 100%;
    height: var(--portal-h);
    min-height: var(--portal-h);
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--edge-hi));
    background-color: #0a1220;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 12px 36px rgba(0, 0, 0, 0.55),
        0 0 40px color-mix(in srgb, var(--accent) 18%, transparent);
}
.gg-stage-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-color: #050810;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.gm-portal-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 28%, transparent 62%, rgba(0, 0, 0, 0.5) 100%),
        radial-gradient(ellipse 70% 55% at 50% 45%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.gg-stage-meta { display: none !important; }
.gg-stage-art {
    position: absolute;
    left: 50%;
    top: 44%;
    z-index: 3;
    width: min(78%, 300px);
    height: auto;
    max-height: 82%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.65));
    animation: gg-gate-float 5.5s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
}
@keyframes gg-gate-float {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, calc(-50% - 5px)); }
}
.gg-stage-progress {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 36px;
    z-index: 4;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.gg-stage-progress > i {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: width 0.35s ease;
}
.gg-stage-count {
    position: absolute !important;
    right: 10px !important;
    bottom: 8px !important;
    z-index: 5 !important;
    padding: 5px 11px !important;
    font-family: Orbitron, Tahoma, sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    color: #fff !important;
    background: rgba(6, 10, 18, 0.88) !important;
    border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--edge)) !important;
    border-radius: 8px !important;
    backdrop-filter: blur(10px) !important;
}

/* Footer: lives + prepare */
.gm-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--edge);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}
.gm-footer-lives {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.gm-lives-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--edge);
    background: rgba(0, 0, 0, 0.2);
}
.gm-lives-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(244, 114, 182, 0.12);
    border: 1px solid rgba(244, 114, 182, 0.28);
    position: relative;
    flex-shrink: 0;
}
.gm-lives-icon::after {
    content: '♥';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--lives);
}
.gm-lives-lbl {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
}
.gm-lives-num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: var(--lives);
    font-variant-numeric: tabular-nums;
}
.gg-btn-prepare {
    min-width: 140px;
    flex-shrink: 0;
}

/* Right console */
.gm-console {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: 10px;
    min-height: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}
.gm-card {
    padding: 10px 11px;
    border-radius: var(--radius);
    border: 1px solid var(--edge);
    background: rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}
.gm-card--grow {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.gm-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.gm-card-title {
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.gm-mult-badge,
#gg-mult-val {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ok);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: var(--radius-sm);
}
.gm-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 8px;
    cursor: pointer;
}
.gm-check input { accent-color: var(--ok); }
.gm-mult-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.gg-mult-bar {
    height: 2px;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}
.gg-mult-bar i {
    display: block;
    height: 100%;
    background: var(--ok);
    transition: width 0.2s;
}

.gm-spin-amount {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: stretch;
}
.gm-spin-amount .gm-btn--amount {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}
.gm-spin-amount .gm-btn--icon {
    flex: 0 0 40px;
    width: 40px;
    padding-left: 0;
    padding-right: 0;
}
.gg-spin-progress {
    margin: 4px 0 6px;
    min-height: 12px;
    font-size: 9px;
    color: var(--muted);
    text-align: center;
}

#gg-live-log {
    flex: 1 1 auto;
    min-height: 48px;
    max-height: 100%;
    margin-top: 6px;
    overflow-y: auto;
    padding: 8px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    line-height: 1.5;
    color: #9ec0e8;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(8, 14, 26, 0.92), rgba(4, 8, 14, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.07);
}
#gg-live-log::-webkit-scrollbar { width: 4px; }
#gg-live-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}
#gg-live-log .line { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
#gg-live-log .line-new { color: #fff; background: rgba(255, 255, 255, 0.05); }

/* ── Unified buttons ── */
.page.galaxyGates #gg-window button {
    float: none;
    line-height: normal;
    text-shadow: none;
    letter-spacing: normal;
    font-family: inherit;
}
.page.galaxyGates #gg-window button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.gm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    font-family: Orbitron, Tahoma, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 1px solid var(--edge);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.1s, filter 0.12s, box-shadow 0.12s;
}
.gm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}
.gm-btn--primary,
.gg-btn-energy {
    width: 100%;
    padding: 11px 14px !important;
    color: #fff !important;
    background: linear-gradient(180deg, #4d8ef7 0%, #3568d4 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 4px 14px rgba(53, 104, 212, 0.35);
}
.gm-btn--primary:hover:not(:disabled),
.gg-btn-energy:hover:not(:disabled) {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.gm-btn--accent,
.gg-btn-prepare {
    color: #fff !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent)) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 0 20px color-mix(in srgb, var(--accent) 28%, transparent);
}
.gm-btn--accent:hover:not(:disabled),
.gg-btn-prepare:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.gm-btn--soft,
.gg-btn-lives {
    flex-direction: column !important;
    gap: 1px !important;
    padding: 7px 12px !important;
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid var(--edge-hi) !important;
}
.gm-btn--soft:hover,
.gg-btn-lives:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(244, 114, 182, 0.35) !important;
}
.gg-btn-lives-cost {
    font-size: 10px;
    font-weight: 500;
    color: var(--uridium);
}
.gm-btn--ghost,
.gg-btn-free {
    width: 100%;
    padding: 9px !important;
    font-size: 11px !important;
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--edge) !important;
}
.gm-btn--ghost:hover:not(:disabled),
.gg-btn-free:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08) !important;
}
.gm-btn--icon,
.gm-btn-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    padding: 0 !important;
    font-size: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--edge) !important;
}
.gm-btn--icon:hover,
.gm-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}
.gm-btn--amount {
    flex: 1;
    padding: 8px 6px !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    color: var(--muted) !important;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--edge) !important;
    text-align: center;
}
.gm-btn--amount:hover {
    color: var(--text) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}
.gm-btn--chip,
.gg-mult-steps button {
    padding: 6px 0 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: var(--muted) !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--edge) !important;
    border-radius: 5px !important;
}
.gm-btn--chip.on,
.gg-mult-steps button.on {
    color: var(--ok) !important;
    background: rgba(74, 222, 128, 0.12) !important;
    border-color: rgba(74, 222, 128, 0.3) !important;
}

.page.galaxyGates #gg-spin-count {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Legacy class hooks */
.gm-core-bar { display: none; }
.gm-actions,
.gm-lives-card,
.gm-lives-display,
.gm-log-title,
.gm-mult-head,
.gm-boost-row,
.gm-boost-btn,
.gm-boost-pill { display: none; }

@supports not (backdrop-filter: blur(10px)) {
    #gg-window.gm-panel { background: rgba(14, 18, 28, 0.95) !important; }
}

@media (max-width: 960px) {
    .page.galaxyGates { --gg-top: 268px; --page-pad: 8px; }
    .gm-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .gm-rail {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 64px;
        border-right: none;
        border-bottom: 1px solid var(--edge);
    }
    .gm-rail-title { width: 100%; }
    .gm-core { border-right: none; border-bottom: 1px solid var(--edge); }
    .gm-console { max-height: 220px; }
}

@media (max-height: 820px) {
    .page.galaxyGates {
        --gg-top: 238px;
        --portal-w: 280px;
        --portal-h: 150px;
    }
}

@media (max-height: 700px) {
    .page.galaxyGates {
        --gg-top: 220px;
        --portal-w: 260px;
        --portal-h: 136px;
    }
}
