* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(to bottom, #1a2942 0%, #000000 100%);
    color: #f0e68c;
    min-height: 100vh;
    padding: clamp(16px, 2vw, 32px);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/stars_for_background.png');
    background-size: cover;
    opacity: 0.3;
    z-index: 0;
    transform: translate3d(0px, 0px, 0) scale(1.05);
    transform-origin: center;
    will-change: transform;
    pointer-events: none;
}

.container {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(12px, 2vw, 24px);
    min-height: 90vh;
    height: clamp(640px, 92vh, 880px);
    position: relative;
    z-index: 1;
}

.window {
    background-color: rgba(26, 41, 66, 0.8);
    border: 2px solid #2d4a7c;
    border-radius: 8px;
    padding: 15px;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.display {
    display: flex;
    flex-direction: column;
}

.view-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    margin: 10px 0;
    position: relative;
}

.centered-container {
    position: relative;
    width: clamp(380px, 42vw, 560px);
    height: clamp(380px, 42vw, 560px);
}

#grid-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    grid-template-rows: repeat(30, 1fr);
    z-index: 2;
}

#highlightCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

#highlightCanvas.glow-active {
}

.grid-cell {
    border: 1px solid rgba(255, 255, 255, 0); /* Completely transparent border */
}

.grid-cell.highlight {
    background-color: rgba(255, 255, 0, 0.3);
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    margin: 0 auto;
    background-color: transparent;
    border-radius: 5px;
    z-index: 0;
}

.button-container {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
    width: 100%;
}

.button-container.back-left {
    justify-content: flex-start;
}

.button-container.back-left #nextBtn {
    margin-left: auto;
}


button {
    background-color: #2d4a7c;
    color: #ffd700;
    border: 2px solid #3d5a8c;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #3d5a8c;
}

.zoom-toggle-container {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
}

.zoom-toggle {
    min-width: auto;
    text-transform: none;
    letter-spacing: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background-color: transparent;
    border: none;
    padding: 6px;
    box-shadow: none;
    color: #ffd700;
    cursor: pointer;
}

.zoom-toggle:hover {
    background-color: transparent;
}

.zoom-toggle.active .magnifier-icon {
    border-color: #ffe28a;
    box-shadow: 0 0 12px rgba(255, 208, 115, 0.8), 0 0 25px rgba(255, 208, 115, 0.4);
}

.magnifier-icon {
    width: 20px;
    height: 20px;
    border: 2px solid #ffd700;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.magnifier-icon::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(255, 215, 0, 0) 0deg, rgba(255, 215, 0, 0.9) 120deg, rgba(255, 215, 0, 0) 360deg);
    opacity: 0;
    transform-origin: center;
    mask: radial-gradient(circle, transparent calc(50% - 3px), #000 calc(50% - 2px), #000 calc(50% + 2px), transparent calc(50% + 3px));
    -webkit-mask: radial-gradient(circle, transparent calc(50% - 3px), #000 calc(50% - 2px), #000 calc(50% + 2px), transparent calc(50% + 3px));
}

.zoom-toggle.active .magnifier-icon::before {
    opacity: 1;
    animation: magnifierOrbit 1.4s linear infinite;
}

.magnifier-icon::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 2px;
    background-color: #ffd700;
    bottom: -5px;
    right: -4px;
    transform: rotate(45deg);
    transform-origin: center;
    border-radius: 1px;
}

@keyframes magnifierOrbit {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.info {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 18px);
    height: 100%;
    overflow: hidden;
}

@media (max-height: 900px) {
    .centered-container {
        width: min(480px, 60vh);
        height: min(480px, 60vh);
    }
}

#section-alpha {
    flex: 0 0 auto;
    background: radial-gradient(circle at center, #3822CD 0%, rgba(5, 3, 15, 0.8) 70%, rgba(0, 0, 0, 0.5) 100%);
    border: 1px solid #3d5a8c;
    border-radius: 8px;
    max-height: 62%;
    overflow-y: auto;
}

#selection-list {
    flex: 1 1 auto;
    background: linear-gradient(180deg, #0d1a3a 0%, #040712 60%, #000000 100%);
    overflow-y: auto;
    min-height: 140px;
}

.info-section {
    border: 1px solid #3d5a8c;
    border-radius: 5px;
    padding: 10px;
}

.info-section h3 {
    margin-bottom: 15px;
    color: #ffd700;
}

.author-credit {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 0.8em;
    color: #fff;
    overflow: hidden;
}

@keyframes authorShine {
    0% {
        left: -150%;
    }
    50% {
        left: 150%;
    }
    100% {
        left: -150%;
    }
}

.author-credit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 20%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 215, 0, 0) 0%, rgba(255, 215, 0, 0.45) 50%, rgba(255, 215, 0, 0) 100%);
    transform: skewX(-20deg);
    pointer-events: none;
}

.author-credit:hover::after {
    animation: authorShine 2.4s linear infinite;
}

.author-credit a {
    color: inherit;
    text-decoration: none;
    cursor: text;
    outline: none;
}

.display h2 {
    font-family: 'Great Vibes', 'Brush Script MT', 'Segoe Script', cursive;
    font-size: 2.8rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 15px;
    color: #ffd700;
    letter-spacing: 0.05em;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.display-subtitle {
    text-align: center;
    margin-top: -8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #050c1a;
    -webkit-text-stroke: 0.25px #fff;
    text-stroke: 0.25px #fff;
}

.leaf-list {
    list-style: none;
    padding: 0;
}

.leaf-list li {
    padding: 10px 12px;
    margin: 8px 0;
    background-color: #1a2942; /* Deep blue */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #2d4a7c;
    text-align: center;
}

.leaf-list li:hover {
    background-color: #2d4a7c;
    color: #ffd700;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.tree-view-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.tree-lines-canvas,
.tree-nodes-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.tree-lines-canvas {
    z-index: 0;
}

.tree-nodes-layer {
    z-index: 1;
}

.tree-node {
    position: absolute;
    background-color: #0d1b2e;
    color: #ffd700;
    border: 1px solid #3d5a8c;
    border-radius: 14px;
    padding: 8px 14px;
    text-align: center;
    z-index: 2;
}

#magnifierLens {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ffd700;
    pointer-events: none;
    display: none;
    background-color: rgba(7, 14, 30, 0.85);
    background-repeat: no-repeat;
    background-position: 50% 50%;
    z-index: 5;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.magnifier-active {
    cursor: none;
}

.tree-node.sparkle {
    border-color: #ffd700;
    background: radial-gradient(circle at top, rgba(255, 215, 0, 0.3), #0d1b2e 60%);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8), 0 0 25px rgba(255, 215, 0, 0.4);
    color: #fffceb;
    animation: sparklePulse 1.5s ease-in-out infinite;
}

@keyframes sparklePulse {
    0% {
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.6), 0 0 18px rgba(255, 215, 0, 0.3);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 215, 0, 0.5);
        transform: translateY(-1px);
    }
    100% {
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.6), 0 0 18px rgba(255, 215, 0, 0.3);
        transform: translateY(0);
    }
}

.hidden {
    display: none;
}

@media (max-width: 1024px) {
  .container, .author-credit {
    display: none;
  }
  #starfield {
    display: none;
  }
  body::after {
    content: "This website is only available on laptop screens or larger.";
    color: white;
    font-size: 2em;
    text-align: center;
    display: block;
    margin-top: 20%;
  }
}
