/* ============================================
   HACKERHJULET - Professionelt Design
   ============================================ */

:root {
    --primary: #1a5fb4;
    --primary-light: #3584e4;
    --primary-dark: #0d3a73;
    --accent: #c01c28;
    --success: #26a269;
    --warning: #e5a50a;
    --bg-white: #ffffff;
    --bg-light: #f6f5f4;
    --bg-dark: #1e1e1e;
    --text-dark: #1e1e1e;
    --text-light: #ffffff;
    --text-muted: #5e5c64;
    --border: #deddda;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.14);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15), 0 5px 10px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.2);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-dark);
    line-height: 1.5;
}

/* ============================================
   Welcome Screen
   ============================================ */

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
}

.game-header {
    text-align: center;
    margin-bottom: 16px;
}

.game-header h1 {
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    color: #fff;
    font-weight: 800;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.9);
    font-weight: 400;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.welcome-panel {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 600;
}

.panel-content {
    padding: 18px 20px;
}

.info-text {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.features {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    flex: 1 1 auto;
    min-width: fit-content;
}

.feature:hover {
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    font-size: 1.1rem;
}

.feature span {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.85rem;
}

/* Player Setup */
.player-setup {
    margin-bottom: 18px;
}

.player-setup label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.85rem;
}

.player-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.player-btn,
.round-btn {
    flex: 1;
    padding: 8px 4px;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-btn:hover,
.round-btn:hover {
    border-color: var(--primary);
    background: #e8f0fc;
}

.player-btn.active,
.round-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.player-names {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 140px;
    overflow-y: auto;
}

.player-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.player-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.15);
}

.player-input::placeholder {
    color: #999;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Footer */
.panel-footer {
    padding: 14px 20px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

.panel-footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-align: center;
}

.dceo-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dceo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dceo-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   Game Screen
   ============================================ */

.game-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    padding: 28px;
    min-height: 100vh;
    max-width: 1500px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.4);
}

/* Scoreboard */
.scoreboard {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 28px;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bg-light);
}

.scoreboard-header h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.round-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: 20px;
}

.player-scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-score-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: 12px;
    border-left: 4px solid var(--border);
    transition: all 0.2s ease;
}

.player-score-item.active {
    border-left-color: var(--primary);
    background: #e8f0fc;
    box-shadow: var(--shadow-sm);
}

.player-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.player-info {
    flex: 1;
}

.player-info .name {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.player-info .stats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

/* DCEO Info */
.dceo-info {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.dceo-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}

.dceo-info a {
    display: block;
    padding: 10px 14px;
    background: var(--bg-light);
    border-radius: 8px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.dceo-info a:hover {
    background: #e8f0fc;
    transform: translateX(4px);
}

/* ============================================
   Wheel Section
   ============================================ */

.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 24px;
}

.wheel-wrapper {
    position: relative;
    filter: drop-shadow(0 10px 40px rgba(0,0,0,0.4));
}

.wheel-container {
    position: relative;
    width: min(550px, 85vw);
    height: min(550px, 85vw);
}

#wheel {
    width: 100%;
    height: 100%;
    transition: transform 5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.wheel-pointer {
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%) rotate(-90deg);
    width: 50px;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.pointer-svg {
    width: 100%;
}

/* Spin Button */
.spin-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 56px;
    background: linear-gradient(135deg, var(--accent) 0%, #9a161f 100%);
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-lg);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.spin-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(192, 28, 40, 0.4);
}

.spin-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spin-icon {
    font-size: 1.3rem;
}

.current-player-display {
    background: var(--bg-white);
    padding: 16px 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.current-player-display .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.current-player-display .player-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* ============================================
   Question Panel
   ============================================ */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
}

.question-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 650px;
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 200;
    overflow: hidden;
}

.question-panel.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.question-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.category-icon {
    font-size: 2.2rem;
}

.question-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
}

.question-content {
    padding: 32px 28px;
}

.question-text {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.question-timer {
    height: 8px;
    background: var(--bg-light);
    margin: 0 28px;
    border-radius: 4px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--accent));
    transition: width 0.1s linear;
}

.answer-section {
    padding: 28px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

.answer-prompt {
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
}

.answer-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.answer-btn {
    padding: 18px 14px;
    border: 3px solid;
    border-radius: 14px;
    background: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.answer-btn .btn-icon {
    font-size: 1.6rem;
}

.answer-btn.correct {
    border-color: var(--success);
    color: var(--success);
}

.answer-btn.correct:hover {
    background: var(--success);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(38, 162, 105, 0.3);
}

.answer-btn.partial {
    border-color: var(--warning);
    color: #8a6508;
}

.answer-btn.partial:hover {
    background: var(--warning);
    color: var(--text-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 165, 10, 0.3);
}

.answer-btn.wrong {
    border-color: var(--accent);
    color: var(--accent);
}

.answer-btn.wrong:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(192, 28, 40, 0.3);
}

/* ============================================
   Game Over Panel
   ============================================ */

.gameover-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 520px;
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 40px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 300;
}

.gameover-panel.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.gameover-title {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 32px;
    font-weight: 800;
}

.final-scores {
    margin-bottom: 32px;
}

.final-score-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: var(--bg-light);
    border-radius: 14px;
}

.final-score-item.first {
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
    border: 2px solid #ffc107;
    box-shadow: var(--shadow-sm);
}

.rank {
    font-size: 1.4rem;
    font-weight: 800;
    width: 44px;
    color: var(--text-muted);
}

.final-score-item.first .rank {
    color: #d4a500;
}

.final-player-info {
    flex: 1;
    text-align: left;
}

.final-player-info .name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.final-player-info .details {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.final-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.gameover-buttons {
    display: flex;
    gap: 14px;
}

.gameover-buttons .btn-primary,
.gameover-buttons .btn-secondary {
    flex: 1;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-secondary {
    background: var(--bg-light);
    border: 2px solid var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #e8f0fc;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Score Popup */
.score-popup {
    position: fixed;
    font-size: 2.5rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 500;
    animation: scorePopup 1.2s ease-out forwards;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.score-popup.positive {
    color: var(--success);
}

.score-popup.partial {
    color: var(--warning);
}

@keyframes scorePopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.4);
    }
}

/* Canvas */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1000px) {
    .game-container {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 20px;
    }

    .scoreboard {
        position: relative;
        top: 0;
        order: -1;
    }

    .player-scores {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .player-score-item {
        flex: 1 1 calc(50% - 5px);
        min-width: 160px;
    }

    .dceo-info {
        display: none;
    }

    .wheel-container {
        width: min(480px, 90vw);
        height: min(480px, 90vw);
    }
}

@media (max-width: 600px) {
    .game-container {
        padding: 12px;
    }

    .wheel-container {
        width: min(340px, 95vw);
        height: min(340px, 95vw);
    }

    .wheel-pointer {
        width: 35px;
        right: -18px;
    }

    .spin-button {
        padding: 16px 40px;
        font-size: 1rem;
    }

    .answer-buttons {
        grid-template-columns: 1fr;
    }

    .answer-btn {
        flex-direction: row;
        justify-content: center;
        padding: 14px 20px;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .player-score-item {
        flex: 1 1 100%;
    }

    .game-header h1 {
        font-size: 1.8rem;
    }

    .gameover-buttons {
        flex-direction: column;
    }

    /* Kompakt velkomstside på mobil */
    .main-container {
        padding: 12px;
        justify-content: flex-start;
        padding-top: 20px;
    }

    .game-header {
        margin-bottom: 12px;
    }

    .welcome-panel {
        max-width: 100%;
    }

    .panel-content {
        padding: 14px 16px;
    }

    .info-text {
        margin-bottom: 12px;
        font-size: 0.85rem;
    }

    .features {
        margin-bottom: 14px;
        gap: 6px;
    }

    .feature {
        padding: 6px 10px;
    }

    .feature span {
        font-size: 0.8rem;
    }

    .player-setup {
        margin-bottom: 14px;
    }

    .player-names {
        max-height: 100px;
    }

    .panel-footer {
        padding: 12px 16px;
    }

    .dceo-links {
        gap: 8px;
    }

    .dceo-link {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}
