/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables - VMG Brand */
:root {
    /* Brand Colors */
    --primary-red: #ee0247;
    --primary-gradient: linear-gradient(135deg, #ee0247 0%, #ff4d7d 100%);

    /* Dark Theme */
    --bg-dark: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.15);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;

    /* Game States */
    --cell-active: #fff3cd;
    --cell-highlight: #e7f3ff;
    --cell-correct: #d4edda;
    --cell-incorrect: #f8d7da;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 20px;
}

/* Background Video */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.4) 0%, rgba(20, 20, 30, 0.5) 100%);
    backdrop-filter: blur(1px);
}

/* Prompt Container */
.prompt-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.prompt-card {
    background: rgba(30, 30, 35, 0.95);
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 700px;
    width: 100%;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    animation: fadeInUp 0.6s ease-out;
}

.prompt-header {
    text-align: center;
    margin-bottom: 35px;
}

.prompt-header .logo-img-white {
    height: 60px;
    width: auto;
    margin-bottom: 10px;
    filter: brightness(0) invert(1);
}

.prompt-logo {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #ee0247 0%, #ff4d7d 50%, #ff8fa3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prompt-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 15px;
}

.prompt-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
}

.input-group textarea::placeholder {
    color: var(--text-muted);
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-red);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(238, 2, 71, 0.2);
}

.btn-large {
    padding: 18px 40px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-icon {
    font-size: 22px;
}

.btn-daily-star {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-color: #FFD700;
}

.btn-daily-star:hover {
    background: linear-gradient(135deg, #FFC700 0%, #FF9500 100%);
    border-color: #FFC700;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
}

.help-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 8px;
    font-style: italic;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 10px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.divider span {
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.loading-state {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

.status-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    display: none;
    text-align: center;
}

.status-message.success {
    background: rgba(40, 167, 69, 0.2);
    color: #6ae389;
    border: 1px solid rgba(40, 167, 69, 0.3);
    display: block;
}

.status-message.error {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(220, 53, 69, 0.3);
    display: block;
}

/* Main Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

/* Header */
header {
    background: linear-gradient(135deg, rgba(238, 2, 71, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    color: white;
    padding: 30px;
    border-bottom: 1px solid var(--border-subtle);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.logo-img {
    height: 50px;
    width: auto;
}

.header-title-group h1 {
    font-size: 42px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: white;
}

.header-title-group .subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 5px;
    font-weight: 400;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

input[type="file"] {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    margin-right: 10px;
}

button {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 2, 71, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-red);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

button:active {
    transform: translateY(0);
}

/* Game Area */
.game-area {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 25px;
    padding: 25px;
}

/* Clues Container */
.clues-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.clues-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.clues-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-red);
    background: linear-gradient(135deg, #ee0247 0%, #ff4d7d 50%, #ff8fa3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.clue-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(5px);
    border-color: var(--border-medium);
}

.clue-item.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary-red);
    box-shadow: 0 4px 12px rgba(238, 2, 71, 0.3);
}

.clue-number {
    font-weight: 700;
    color: var(--primary-red);
    margin-right: 8px;
}

.clue-item.active .clue-number {
    color: white;
}

/* Puzzle Container */
.puzzle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

#crosswordGrid {
    display: inline-grid;
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
}

.cell {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.cell.black {
    background: rgba(30, 30, 35, 0.95);
    border-color: rgba(30, 30, 35, 0.95);
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    background: transparent;
    outline: none;
    font-family: 'Poppins', sans-serif;
    color: #333;
}

.cell.active {
    background: #fff3cd;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px rgba(238, 2, 71, 0.3);
}

.cell.highlight {
    background: #e7f3ff;
}

.cell.correct {
    background: #d4edda;
    border-color: #28a745;
}

.cell.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.55em;
    font-weight: 700;
    color: var(--primary-red);
}

/* Message Box */
#message {
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    backdrop-filter: blur(10px);
}

#message.success {
    background: rgba(40, 167, 69, 0.2);
    color: #6ae389;
    border-color: rgba(40, 167, 69, 0.3);
}

#message.error {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
    border-color: rgba(220, 53, 69, 0.3);
}

#message.info {
    background: rgba(13, 202, 240, 0.2);
    color: #6dd5ed;
    border-color: rgba(13, 202, 240, 0.3);
}

/* Mobile Clue Tooltip */
.clue-tooltip {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 35, 0.98);
    border: 2px solid var(--primary-red);
    border-radius: 16px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    z-index: 1000;
    animation: slideUpFade 0.3s ease-out;
}

.clue-tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.tooltip-direction {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tooltip-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-red);
}

.tooltip-clue-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 1fr;
    }

    /* Hide clues sidebar on mobile, show tooltip instead */
    .clues-container {
        display: none !important;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 12px;
    }

    header {
        padding: 20px;
    }

    .header-logo {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .logo-img {
        height: 40px;
    }

    .header-title-group h1 {
        font-size: 28px;
    }

    .header-title-group .subtitle {
        font-size: 14px;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .controls button,
    .controls input[type="file"] {
        width: 100%;
    }

    .game-area {
        padding: 20px;
        gap: 20px;
    }

    .cell {
        width: 32px;
        height: 32px;
    }

    .cell input {
        font-size: 1em;
    }

    #message {
        font-size: 14px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .cell {
        width: 28px;
        height: 28px;
    }

    .cell input {
        font-size: 0.9em;
    }

    .cell-number {
        font-size: 0.55em;
    }
}
