/* css/styles-shared.css */

/* --- CSS Variables & Global Reset --- */
:root {
    /* Vowel Colors */
    --a-color: #ff6b6b; --e-color: #feca57; --i-color: #ff9ff3; 
    --o-color: #54a0ff; --u-color: #5f27cd;
    
    --A-color: #ff9ff3; --E-color: #5f27cd; --I-color: #54a0ff; 
    --O-color: #feca57; --U-color: #1dd1a1;

    /* Backgrounds */
    --primary-gradient: linear-gradient(to bottom, #020024 0%, #090979 40%, #00d4ff 100%);
    --card-bg: radial-gradient(circle at 30% 30%, #ffffff, #e0e0e0);
    --overlay-bg: rgba(0, 0, 0, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.1);
    
    /* Text Shadows */
    --text-shadow-glow: 0 0 5px rgba(255, 255, 255, 0.5);
    --text-shadow-strong: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 10px rgba(0, 212, 255, 0.8);

    /* Team Colors - UPDATED */
    --team-a-color: #1dd1a1; /* Greenish */
    --team-b-color: #ff9f43; /* ORANGE */
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    color: white;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* --- Background Stars Animation --- */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.star {
    position: absolute;
    background-color: #ffd700;
    border-radius: 50%;
    animation: twinkle var(--duration) infinite ease-in-out;
    opacity: 0.8;
    box-shadow: 0 0 5px #ffd700;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* --- Navigation Buttons --- */
.nav-btn {
    padding: 10px 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    font-family: inherit;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1003;
}

.nav-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.nav-btn:active {
    transform: scale(0.95);
}

.btn-home {
    background: linear-gradient(145deg, #1dd1a1, #10ac84);
}

.btn-back {
    background: linear-gradient(145deg, #ff6b6b, #ee5253);
}

/* --- Header & Controls --- */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 15px;
    position: relative;
}

.progress-text {
    color: #fff;
    font-size: 1em;
    text-shadow: var(--text-shadow-glow);
    flex-grow: 1;
    text-align: center;
}

.controls-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Timer Box & Level Display (Shared Slot Styles) --- */
.timer-box,
.level-display {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    position: static;
    color: #ffeaa7;
    text-shadow: 0 0 5px #ffeaa7;
}

/* Hide classes for toggling visibility between modes */
.timer-hidden {
    display: none !important;
}

.level-hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* Small Control Buttons */
.btn-small {
    padding: 6px 15px;
    border: none;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
    font-family: inherit;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.btn-pause {
    background: linear-gradient(145deg, #feca57, #ff9f43);
}

.btn-reset {
    background: linear-gradient(145deg, #ff6b6b, #ee5253);
    color: white;
}

.btn-small:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.btn-small:active {
    transform: scale(0.95);
}

/* --- NEW: Start Button Style (Matches Box Theme) --- */
.btn-start {
    /* Matches timer/dropdown background */
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 20px; /* Slightly wider than timer, shorter height */
    font-size: 1em;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.2s;
    margin-left: 10px;
    display: inline-block;
    text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    background: rgba(20, 20, 20, 0.6);
}

.btn-start:active {
    transform: scale(0.95);
}

/* --- Progress Bar --- */
.progress-bar {
    width: 100%;
    max-width: 900px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #feca57, #ff9ff3);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px #feca57;
}

/* --- Drop Zones (Vowel Boxes) --- */
.drop-zones-wrapper {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.zone-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.box {
    width: 100px;
    height: 80px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.box-title {
    font-size: 1.1em;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
    margin-bottom: 0;
    line-height: 1;
    font-weight: bold;
}

.box span {
    font-size: 2.2em;
    font-weight: bold;
    margin-top: 2px;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    line-height: 1;
}

/* Short Vowels */
.box[data-vowel="a"] { background: rgba(230, 170, 230, 0.6); } .box[data-vowel="a"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="e"] { background: rgba(170, 200, 230, 0.6); } .box[data-vowel="e"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="i"] { background: rgba(170, 230, 170, 0.6); } .box[data-vowel="i"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="o"] { background: rgba(230, 220, 170, 0.6); } .box[data-vowel="o"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="u"] { background: rgba(230, 170, 170, 0.6); } .box[data-vowel="u"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }

/* Long Vowels */
.box[data-vowel="A"] { background: rgba(160, 80, 160, 0.75); border-color: #aa55aa; } .box[data-vowel="A"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="E"] { background: rgba(80, 120, 160, 0.75); border-color: #5588aa; } .box[data-vowel="E"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="I"] { background: rgba(80, 160, 80, 0.75); border-color: #55aa55; } .box[data-vowel="I"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="O"] { background: rgba(160, 140, 80, 0.75); border-color: #aa8855; } .box[data-vowel="O"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }
.box[data-vowel="U"] { background: rgba(160, 80, 80, 0.75); border-color: #aa5555; } .box[data-vowel="U"] span { color: #ffffff; text-shadow: 0 0 3px rgba(255,255,255, 0.5); }

.box.drag-over {
    transform: scale(1.15) translateY(-5px);
    background-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.5);
    border-style: solid;
}

.box.selected-target {
    animation: pulse-glow 0.5s ease-in-out;
    border: 3px solid #ffd700;
    box-shadow: 0 0 15px #ffd700;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* --- Word Card --- */
.current-word-container, .teams-word-container {
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0 20px 0;
    width: 100%;
}

.card {
    width: auto;
    min-width: 100px;
    max-width: 220px;
    height: 100px;
    background: var(--card-bg);
    border: 4px solid #333;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    cursor: grab;
    user-select: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    transition: transform 0.2s, border-color 0.2s;
    color: #333;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 10px;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    touch-action: none;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.card:hover { transform: translateY(-5px) scale(1.05); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.6; transform: scale(0.9) !important; }
.card.selected { cursor: pointer; border-color: #ffd700; }

/* --- Result Message --- */
#result-message {
    height: 30px;
    font-size: 1.3em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: var(--text-shadow-glow);
}

/* --- Overlays --- */
#pause-overlay, #score-overlay, #level-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

#pause-overlay h2, #score-overlay h2, #level-screen h2 {
    font-size: 3em;
    color: #feca57;
    text-shadow: 0 0 20px #feca57;
    margin-bottom: 30px;
    text-align: center;
}

/* --- Big Action Buttons --- */
.btn-big {
    padding: 15px 40px;
    font-size: 1.4em;
    min-width: 280px;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    transition: all 0.2s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.btn-big:hover { transform: scale(1.05); box-shadow: 0 7px 20px rgba(0,0,0,0.5); }
.btn-big:active { transform: scale(0.98); }

.btn-countdown { background: linear-gradient(145deg, #ff9f43, #feca57); color: #333; }
.btn-freeplay { background: linear-gradient(145deg, #4facfe, #00f2fe); color: white; }
.btn-levels { background: linear-gradient(145deg, #a29bfe, #6c5ce7); color: white; }
.btn-next { background: linear-gradient(145deg, #1dd1a1, #10ac84); color: white; }

/* --- Score Details --- */
.score-details {
    font-size: 1.5em;
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.8;
}
.score-highlight { color: #feca57; font-size: 1.8em; text-shadow: 0 0 10px #feca57; }

/* =========================================
   TEAMS MODE STYLES
   ========================================= */

.teams-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 10px;
    padding: 0 20px;
}

.team-score-box {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 10px 20px;
    text-align: center;
    min-width: 120px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    flex: 1;
}

.team-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.team-score {
    font-size: 2.5em;
    font-weight: bold;
    line-height: 1;
    color: #fff; /* Default score color */
}

/* Team Specific Colors */
.team-a .team-name { color: var(--team-a-color); text-shadow: 0 0 5px var(--team-a-color); }
.team-a .team-score { color: #fff; }

.team-b .team-name { color: var(--team-b-color); text-shadow: 0 0 5px var(--team-b-color); } /* Orange Name */
.team-b .team-score { color: #fff; } /* Keep score white for contrast, or change to orange if preferred */

/* Timer Dropdown Select */
.timer-select {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 5px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    text-align: center;
    font-size: 0.9em;
    min-width: 100px;
}
.timer-select option { background: #222; color: #fff; }

/* Teams Mode Layout Structure */
.teams-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    align-items: center;
}

.teams-drop-zones {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 40px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.teams-zone-column {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.teams-zone-column h3 {
    margin-bottom: 15px;
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.teams-zone-column.team-a h3 { color: var(--team-a-color); text-shadow: 0 0 10px var(--team-a-color); }
.teams-zone-column.team-b h3 { color: var(--team-b-color); text-shadow: 0 0 10px var(--team-b-color); } /* Orange Header */

/* Responsive Adjustments */
@media (max-width: 900px) {
    .teams-scoreboard { flex-direction: column; gap: 10px; align-items: center; }
    .teams-drop-zones { flex-direction: column; gap: 30px; }
    .teams-zone-column { width: 100%; }
    .controls-right { justify-content: center; }
    .btn-start { margin: 10px auto; display: block; }
}

@media (max-width: 600px) {
    .header-top { flex-direction: column; gap: 10px; }
    .controls-right { width: 100%; justify-content: space-between; flex-direction: column; align-items: stretch; }
    .zone-row { gap: 5px; }
    .box { width: 70px; height: 60px; }
    .box-title { font-size: 0.8em; }
    .box span { font-size: 1.5em; }
    .nav-btn { padding: 8px 12px; font-size: 0.9em; }
    .btn-big { width: 90%; min-width: auto; font-size: 1.2em; }
    .timer-box, .level-display, .timer-select, .btn-start { min-width: auto; padding: 8px 12px; font-size: 0.9em; margin: 5px 0; width: 100%; }
    .btn-small { padding: 5px 10px; font-size: 0.8em; width: 100%; }
    .teams-word-container .card { font-size: 1.4em; height: 80px; }
}