:root {
    --bg-color: #0b0c10;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #45f3ff;
    --primary-glow: rgba(69, 243, 255, 0.5);
    --secondary-color: #ff2e93;
    --secondary-glow: rgba(255, 46, 147, 0.5);
    --text-main: #f0f0f0;
    --text-muted: #8892b0;
    --font-family: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    /* Source Protection CSS */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

/* Allow selection in inputs and textareas only */
input, textarea {
    -webkit-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Background Animated Orbs */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.globe {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.globe-1 {
    width: 40vw;
    height: 40vw;
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, var(--secondary-color), transparent 70%);
}

.globe-2 {
    width: 50vw;
    height: 50vw;
    bottom: -20%;
    right: -10%;
    background: radial-gradient(circle, var(--primary-color), transparent 70%);
    animation-delay: -5s;
}

.globe-3 {
    width: 30vw;
    height: 30vw;
    top: 40%;
    left: 40%;
    background: radial-gradient(circle, #7d2ae8, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -50px) scale(1.1); }
}

/* Glassmorphism Utilities */
.glass-header {
    background: rgba(11, 12, 16, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem 2rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}
.highlight {
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
}
h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

/* Container & Logic */
.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.view-mode {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.view-mode.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lobby */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.room-card {
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
}

.room-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(69, 243, 255, 0.3);
}

.room-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.room-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.room-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.primary-btn {
    background: var(--primary-color);
    color: #000;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.primary-btn:hover {
    box-shadow: 0 0 25px var(--primary-color);
    transform: scale(1.05);
}

.secondary-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn:not(:disabled):hover {
    background: var(--glass-bg);
    border-color: var(--text-muted);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.icon-btn:hover {
    color: var(--text-main);
}

.pulse-glow {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(69, 243, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(69, 243, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(69, 243, 255, 0); }
}

/* Editor */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.editor-content {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

input[type="text"], textarea, select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-family: inherit;
    padding: 1rem;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
    resize: vertical;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: var(--primary-color);
}

.split-options {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.split-options select {
    width: auto;
}

/* Walkthrough */
.walkthrough-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.progress-container {
    flex-grow: 1;
    margin-left: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#progressText {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.progress-bar-bg {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-container {
    perspective: 1000px;
    height: 400px;
    margin: 2rem 0;
}

.memory-card {
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
    background: transparent;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    border-radius: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(69, 243, 255, 0.3);
    box-shadow: 0 0 30px rgba(69, 243, 255, 0.1);
}

.memory-card-front {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255,255,255,0.01));
}

.chunk-index {
    font-size: 5rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tap-hint {
    color: var(--primary-color);
    font-size: 1.2rem;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.memory-card-back {
    transform: rotateY(180deg);
    border-color: rgba(255, 46, 147, 0.3);
    box-shadow: 0 0 30px rgba(255, 46, 147, 0.1);
    overflow-y: auto;
}

.back-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    opacity: 0.3;
    margin-bottom: 1rem;
    text-align: center;
}

.memory-card-back p {
    font-size: 1.5rem;
    line-height: 1.6;
    max-height: 100%;
}

.walkthrough-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Print View */
.print-area {
    display: none;
}

@media print {
    body {
        background: white !important;
        color: black !important;
    }
    /* Hide everything else */
    .background-globes, .glass-header, .view-mode {
        display: none !important;
    }
    .print-area {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 2rem;
        font-family: serif;
    }
    .print-area h1 {
        color: black;
        margin-bottom: 1rem;
        text-align: center;
    }
    .print-item {
        margin-bottom: 2rem;
        page-break-inside: avoid;
        border-bottom: 1px solid #ccc;
        padding-bottom: 1rem;
    }
    .print-number {
        font-size: 1.5rem;
        font-weight: bold;
        color: #555;
        margin-bottom: 0.5rem;
    }
    .print-text {
        font-size: 1.2rem;
        line-height: 1.6;
    }
}
