/* ==========================================================================
   KAHOOT-STYLE QUIZ STYLESHEET
   Thema: Rechtliche Grundlagen der Berufsausbildung (BBiG, JArbSchG)
   ========================================================================== */

:root {
    --bg-dark: #330f62;
    --bg-main: #46178f;
    --bg-light: #5923aa;
    
    /* Kahoot Farben */
    --color-red: #e21b3c;
    --color-blue: #1368ce;
    --color-yellow: #ffa602;
    --color-green: #26890c;

    --color-red-dark: #b8142f;
    --color-blue-dark: #0f4ea0;
    --color-yellow-dark: #cc8400;
    --color-green-dark: #1b6308;

    --text-white: #ffffff;
    --text-muted: #dcd6ec;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-dark: rgba(0, 0, 0, 0.35);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-pop: 0 6px 0 rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: radial-gradient(circle at 50% 20%, var(--bg-light) 0%, var(--bg-main) 60%, var(--bg-dark) 100%);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Hintergrund-Muster (Kahoot Shapes) */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    opacity: 0.08;
    animation: floatShape 24s infinite linear;
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 70px solid #fff;
    top: 15%;
    left: 10%;
    animation-duration: 22s;
}

.shape-diamond {
    width: 60px;
    height: 60px;
    background: #fff;
    transform: rotate(45deg);
    top: 65%;
    left: 85%;
    animation-duration: 28s;
}

.shape-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    top: 80%;
    left: 20%;
    animation-duration: 32s;
}

.shape-square {
    width: 60px;
    height: 60px;
    background: #fff;
    top: 25%;
    left: 80%;
    animation-duration: 26s;
}

@keyframes floatShape {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* Header & Navbar */
header {
    position: relative;
    z-index: 10;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    cursor: pointer;
    text-transform: uppercase;
}

.brand-badge {
    background: #fff;
    color: var(--bg-main);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Haupt-Container */
main {
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   VIEWS (Lobby, Host, Player, Solo)
   ========================================================================== */
.view {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
}

.view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
}

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

/* ==========================================================================
   HOME VIEW
   ========================================================================== */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 30px;
    text-align: center;
    padding: 20px 0;
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.4;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 950px;
}

.action-card {
    background: var(--card-bg);
    color: #222;
    padding: 30px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
    transition: transform 0.25s, box-shadow 0.25s;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.card-icon {
    font-size: 3rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
}

.card-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.4;
}

.pin-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-field {
    width: 100%;
    padding: 14px;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    border: 3px solid #e0e0e0;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--bg-main);
}

/* Große Kahoot Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    padding: 16px 28px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.15s;
    box-shadow: var(--shadow-pop);
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.btn-primary {
    background: #333333;
    color: #ffffff;
}

.btn-primary:hover {
    background: #111111;
}

.btn-accent {
    background: var(--color-green);
    color: #ffffff;
}

.btn-accent:hover {
    background: var(--color-green-dark);
}

.btn-purple {
    background: var(--bg-main);
    color: #ffffff;
}

.btn-purple:hover {
    background: var(--bg-dark);
}

/* ==========================================================================
   HOST VIEW & LOBBY
   ========================================================================== */
.host-lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.lobby-pin-box {
    background: #ffffff;
    color: #111;
    padding: 24px 50px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.lobby-pin-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: #666;
    letter-spacing: 1px;
}

.lobby-pin-code {
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--bg-main);
}

.players-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.25);
    padding: 12px 24px;
    border-radius: var(--radius-md);
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    min-height: 120px;
    padding: 20px;
}

.player-chip {
    background: #ffffff;
    color: #222;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.3); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   HOST QUESTION SCREEN
   ========================================================================== */
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.question-counter {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1.1rem;
}

.question-topic {
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.question-box {
    background: #ffffff;
    color: #111111;
    padding: 28px 32px;
    border-radius: var(--radius-lg);
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    box-shadow: var(--shadow-glow);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0 20px 0;
    line-height: 1.35;
}

.question-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 900;
    box-shadow: var(--shadow-pop);
}

.answers-counter {
    font-size: 1.3rem;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 24px;
    border-radius: 25px;
}

/* 4 Kahoot Antwort-Karten */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex: 1;
}

.answer-card {
    border-radius: var(--radius-md);
    padding: 24px 20px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-pop);
    position: relative;
    cursor: default;
    transition: transform 0.15s, opacity 0.3s;
    user-select: none;
    line-height: 1.3;
}

.answer-card .symbol {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    flex-shrink: 0;
}

.answer-red { background: var(--color-red); }
.answer-blue { background: var(--color-blue); }
.answer-yellow { background: var(--color-yellow); }
.answer-green { background: var(--color-green); }

/* Dimm-Effekt für falsche Antworten */
.answer-card.dimmed {
    opacity: 0.35;
}

.answer-card.correct-highlight {
    outline: 5px solid #ffffff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.7);
    transform: scale(1.02);
}

/* ==========================================================================
   RESULTS & STATISTIKEN
   ========================================================================== */
.results-modal {
    background: var(--card-bg);
    color: #222;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.explanation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--bg-main);
}

.explanation-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #333;
}

.chart-bars {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 160px;
    padding: 10px 0;
    border-bottom: 3px solid #ddd;
    margin-bottom: 10px;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    gap: 8px;
}

.chart-bar-fill {
    width: 100%;
    border-radius: 6px 6px 0 0;
    min-height: 6px;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chart-count {
    font-size: 1.2rem;
    font-weight: 800;
}

/* ==========================================================================
   LEADERBOARD & PODIUM
   ========================================================================== */
.leaderboard-container {
    max-width: 750px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.leaderboard-title {
    font-size: 2.2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 15px;
}

.leaderboard-row {
    background: #ffffff;
    color: #222222;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-pop);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 800;
}

.leaderboard-rank {
    width: 40px;
    font-size: 1.5rem;
    color: var(--bg-main);
}

.leaderboard-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-flame {
    color: #ff5722;
    font-size: 1.1rem;
}

.leaderboard-score {
    color: #111;
    font-weight: 900;
}

/* Podium Screen */
.podium-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 30px;
    text-align: center;
}

.podium-stage {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 650px;
    height: 320px;
    margin-top: 20px;
}

.podium-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-pop);
    color: #fff;
    padding-bottom: 20px;
    animation: slideUp 0.8s ease-out forwards;
}

.podium-step-2 {
    background: #9aa0a6;
    height: 60%;
    animation-delay: 0.3s;
}

.podium-step-1 {
    background: #f9ab00;
    height: 85%;
    animation-delay: 0.8s;
}

.podium-step-3 {
    background: #c57d56;
    height: 45%;
    animation-delay: 0.1s;
}

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

.podium-avatar {
    font-size: 3rem;
    margin-bottom: 8px;
}

.podium-player-name {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 4px;
}

.podium-score {
    font-size: 1rem;
    font-weight: 700;
    opacity: 0.9;
}

.podium-rank-num {
    font-size: 3rem;
    font-weight: 900;
    margin-top: 15px;
}

/* ==========================================================================
   PLAYER MOBILE VIEW
   ========================================================================== */
.player-gameplay {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    gap: 12px;
}

.player-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    flex: 1;
    min-height: 340px;
}

.player-btn {
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-pop);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 3.5rem;
    transition: transform 0.1s, opacity 0.2s;
    user-select: none;
}

.player-btn:active {
    transform: scale(0.96);
}

.player-btn.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.player-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 16px;
    padding: 30px;
    border-radius: var(--radius-lg);
}

.feedback-correct {
    background: var(--color-green);
}

.feedback-wrong {
    background: var(--color-red);
}

.feedback-title {
    font-size: 2.8rem;
    font-weight: 900;
}

.feedback-points {
    font-size: 1.8rem;
    font-weight: 800;
}

/* ==========================================================================
   SOLO PRACTICE VIEW
   ========================================================================== */
.solo-container {
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .hero-title { font-size: 2.2rem; }
    .lobby-pin-code { font-size: 3.2rem; }
    .question-box { font-size: 1.25rem; padding: 18px; }
    .answers-grid { grid-template-columns: 1fr; }
    .answer-card { font-size: 1.1rem; padding: 16px; }
    .timer-circle { width: 60px; height: 60px; font-size: 1.6rem; }
}
