/* ═══════════════════════════════════════════
   FRIENOGUESSR — Stylized Gamey UI
   ═══════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --bg-main: #f0fdf4;
    /* Ultra light pastel green */
    --bg-card: #ffffff;
    --text-primary: #334155;
    --text-header: #0ea5e9;
    /* Light blue header */
    --text-muted: #94a3b8;

    --primary-blue: #cce5ff;
    --primary-blue-border: #0ea5e9;
    --primary-blue-text: #0284c7;

    --primary-green: #d1f4ba;
    --primary-green-border: #22c55e;
    --primary-green-text: #166534;

    --radius-sm: 12px;
    --radius-md: 24px;
    --radius-pill: 50px;

    --font-display: 'Fredoka', cursive, sans-serif;
    --font-main: 'Nunito', sans-serif;

    --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.05);
    --shadow-btn: 3px 4px 0px rgba(0, 0, 0, 0.1);

    --transition: 0.15s ease-in-out;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    width: 100%;
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* ── Glass/White Card ── */
.glass-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: none;
}

/* ── Colors ── */
.c-blue {
    color: var(--primary-blue-border);
}

.c-green {
    color: var(--primary-green-border);
}

/* ── Buttons ── */
.btn {
    font-family: var(--font-main);
    font-weight: 700;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    border: 2px solid var(--primary-blue-border);
    box-shadow: var(--shadow-btn);
}

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

.btn-primary {
    background: var(--primary-blue);
    color: var(--primary-blue-text);
    border-color: var(--primary-blue-border);
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    justify-content: space-between;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--primary-green);
    color: var(--primary-green-text);
    border-color: var(--primary-green-border);
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
    justify-content: space-between;
}

.btn-secondary:hover {
    filter: brightness(1.05);
}

/* ── Inputs ── */
input[type="text"],
.settings-dropdown {
    font-family: var(--font-main);
    font-weight: 600;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    padding: 14px 20px;
    font-size: 16px;
    width: 100%;
    outline: none;
}

.code-input {
    text-align: center;
    font-family: var(--font-display) !important;
    letter-spacing: 2px;
}

/* ── Main Menu ── */
#screen-menu {
    justify-content: center;
    align-items: center;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    max-width: 480px;
    width: 100%;
    gap: 16px;
}

.logo-section {
    text-align: center;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    transform: rotate(-2deg);
    margin-bottom: 8px;
    filter: drop-shadow(1px 2px 0px rgba(0, 0, 0, 0.1));
}

.tagline {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    transform: rotate(1deg);
}

.menu-card {
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-radius: 40px;
}

/* ── Decorative Doodles ── */
.deco-dash {
    font-family: var(--font-display);
    color: var(--primary-green-border);
    font-weight: 800;
}

.arrow {
    color: inherit;
    font-size: 18px;
}

/* ── Lobby ── */
#screen-lobby {
    flex-direction: column;
}

.lobby-container {
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 24px;
    pointer-events: auto;
}

.lobby-header {
    margin-bottom: 24px;
    padding: 16px 24px;
}

.lobby-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.lobby-title-header {
    text-align: center;
    margin: 0 auto;
    color: var(--primary-blue-border);
    font-family: var(--font-display);
}

.lobby-panel {
    padding: 32px;
    border-radius: 36px;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}

.lobby-panel h2 {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--text-header);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

/* Sliders & Settings */
.flex-row-setting {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.flex-row-setting label {
    margin: 0;
    min-width: 140px;
    font-weight: 700;
    color: var(--text-primary);
}

.custom-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 12px 0;
    outline: none;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-blue-border);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0 2px;
}

/* Game-styled Dropdowns */
.settings-dropdown {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 36px 10px 16px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    min-width: 140px;
}

.settings-dropdown:hover {
    border-color: var(--primary-blue-border);
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
}

.settings-dropdown:focus {
    border-color: var(--primary-blue-border);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.settings-dropdown:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8fafc;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-weight: 800;
    font-size: 18px;
    border-radius: 50px;
    margin-bottom: 8px;
    transition: background 0.3s;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.player-item.light-text {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.player-item.dark-text {
    color: #0f172a;
}

.crown-icon {
    font-size: 20px;
    margin-right: 4px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
}

/* Color Picker UI */
.color-picker-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    border: 3px solid transparent;
}

.color-swatch:hover:not(.taken) {
    transform: scale(1.15);
}

.color-swatch.taken {
    opacity: 0.3;
    cursor: not-allowed;
    position: relative;
}

.color-swatch.taken::after {
    content: '✖';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 0, 0, 0.5);
    font-size: 14px;
    font-weight: 900;
}

.color-swatch.selected {
    border: 3px solid white;
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Settings Dividers */
.setting-underline {
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.setting-underline:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

/* Start Button Overrides */
.btn-start-custom {
    background-color: #dcfce7 !important;
    border-color: #166534 !important;
    color: #166534 !important;
    width: 200px !important;
    height: 64px !important;
    font-size: 20px !important;
    margin: 0 auto;
    font-weight: 800;
    display: inline-flex;
    justify-content: center;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-btn);
    border: 2px solid;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-start-custom:hover:not(:disabled) {
    background-color: #bbf7d0 !important;
    transform: translateY(-2px);
}

.btn-start-custom:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px rgba(0, 0, 0, 0);
}

.btn-ghost {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-primary);
}

/* ── Animation Background ── */
#svg-map-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% + 1500px);
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: url('../img/world.svg?v=3') repeat-x;
    background-size: auto 100%;
    animation: panMap 40s linear infinite;
    opacity: 0.8;
    will-change: transform;
}

@keyframes panMap {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-1000px, 0, 0);
    }
}

.floating-icons-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    font-size: 40px;
    animation: floatIcon 4s ease-in-out forwards;
    transform-origin: center;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes floatIcon {
    0% {
        transform: translateY(50px) rotate(0deg) scale(0);
        opacity: 0;
    }

    20% {
        transform: translateY(0px) rotate(var(--rot)) scale(var(--scale));
        opacity: 1;
    }

    80% {
        transform: translateY(-30px) rotate(calc(var(--rot) * 1.5)) scale(var(--scale));
        opacity: 1;
    }

    100% {
        transform: translateY(-60px) rotate(calc(var(--rot) * 2)) scale(0);
        opacity: 0;
    }
}

.flex-row {
    display: flex;
    align-items: center;
}

.gap-2 {
    gap: 8px;
}

.mt-2 {
    margin-top: 8px;
}

.hidden {
    display: none !important;
}

/* ── Game Screen ── */
#screen-game {
    display: none;
    position: relative;
    /* Context container */
}

#screen-game.active {
    display: flex;
}

.game-main-content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 5;
    overflow: hidden;
}

.game-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 290px;
    display: flex;
    flex-direction: column;
    padding: 80px 24px 24px 24px;
    z-index: 20;
    overflow-y: auto;
    background: transparent;
    pointer-events: none;
}

/* Remove .sidebar-action-panel totally since we extract action panels */
.action-panels-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.bare-action-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
}

.game-player-item {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 700;
}

.game-player-points {
    font-family: var(--font-display);
    font-size: 20px;
    margin-right: 12px;
}

.game-player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-player-name {
    font-size: 18px;
    line-height: 1.2;
}

.game-player-status {
    font-size: 13px;
    color: var(--text-muted);
}

#screen-game.active {
    display: flex;
}

.game-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.map-container {
    flex: 1;
    position: relative;
    width: 100%;
    z-index: 5;
}

.game-map {
    width: 100%;
    height: 100%;
    z-index: 5;
}

.bottom-panel {
    background: white;
    padding: 24px;
    z-index: 20;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.overlay-content,
.reveal-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.timer-display {
    font-size: 24px;
    font-weight: 800;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.clue-display {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 20;
    box-shadow: var(--shadow-btn);
    font-weight: 700;
    font-size: 20px;
}

.clue-word {
    color: var(--primary-blue-border);
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 9999;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    animation: toastFadeUp 3s ease-in-out forwards;
    white-space: pre-wrap;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.error {
    background: rgba(220, 38, 38, 0.9);
}

.toast.success {
    background: rgba(22, 163, 74, 0.9);
}

@keyframes toastFadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    70% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px);
    }
}

/* ── Advertisements ── */
.ad-container {
    width: 100%;
    min-height: 80px;
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
    text-align: center;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ad-container.side-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    z-index: 100;
}

.ad-container.side-ad.left {
    left: 20px;
}

.ad-container.side-ad.right {
    right: 20px;
}

/* Hide side ads on smaller mobile screens to prevent overlap */
@media (max-width: 1000px) {
    .ad-container.side-ad {
        display: none;
    }
}