/* ============================================================
   GAME SERU — Design System CSS
   Mobile-First · Dark Gaming Theme · Premium UI
   ============================================================ */

/* ── Google Fonts (sudah di-import via HTML) ── */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    /* Background */
    --bg-dark:        #0a0a14;
    --bg-dark-2:      #0f0f1e;
    --bg-surface:     #13131f;
    --bg-surface-2:   #1a1a2e;

    /* Card */
    --card-bg:        rgba(255, 255, 255, 0.04);
    --card-bg-2:      rgba(255, 255, 255, 0.08);
    --card-hover:     rgba(255, 255, 255, 0.07);

    /* Borders */
    --border-color:   rgba(255, 255, 255, 0.1);
    --border-bright:  rgba(255, 255, 255, 0.2);

    /* Text */
    --text-primary:   #f0f0ff;
    --text-secondary: #a0a0c0;
    --text-muted:     #6060a0;

    /* Accent */
    --accent-primary:   #8b5cf6;
    --accent-secondary: #6d28d9;
    --accent-glow:      rgba(139, 92, 246, 0.4);

    /* Game colors */
    --color-uno-red:    #ef4444;
    --color-uno-yellow: #eab308;
    --color-uno-green:  #22c55e;
    --color-uno-blue:   #3b82f6;
    --color-uno-wild:   #a855f7;

    /* Gradients */
    --gradient-purple:  linear-gradient(135deg, #8b5cf6, #6d28d9);
    --gradient-gold:    linear-gradient(135deg, #f59e0b, #d97706, #fbbf24);
    --gradient-hero:    linear-gradient(160deg, #0f0c29, #302b63, #24243e);
    --gradient-night:   linear-gradient(160deg, #0d0d1a, #1a0d2e, #0d0d1a);
    --gradient-day:     linear-gradient(160deg, #1a2744, #1e3a5f, #1a2744);

    /* Shadows */
    --shadow-card:      0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow:      0 0 30px rgba(139, 92, 246, 0.3);
    --shadow-btn:       0 4px 15px rgba(109, 40, 217, 0.5);

    /* Border Radius */
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Touch target */
    --touch-min: 44px;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}
p { color: var(--text-secondary); }
a { color: var(--accent-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: var(--touch-min);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--gradient-purple);
    color: #fff;
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(109, 40, 217, 0.7); }

.btn-secondary {
    background: var(--card-bg-2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--card-hover); border-color: var(--border-bright); }

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6); }

.btn-full { width: 100%; }
.btn-sm { min-height: 36px; padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-icon { font-size: 1.1em; }

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.08);
}
.form-select {
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
}
.form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-select option { background: var(--bg-surface-2); color: var(--text-primary); }

.pwd-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    color: var(--text-muted);
    min-height: auto;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-bright);
}
.card-xl {
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.badge-uno {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.badge-werewolf {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
}
.badge-waiting {
    background: rgba(234, 179, 8, 0.2);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #fde047;
}
.badge-playing {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
}

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg-2);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.75rem; border-width: 3px; }
.avatar-sm { width: 32px; height: 32px; font-size: 1rem; }
.avatar.online { border-color: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.avatar.dead { filter: grayscale(1) opacity(0.4); }

/* ── Player List ────────────────────────────────────────────── */
.player-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.625rem;
    transition: all var(--transition-fast);
}
.player-info { flex: 1; min-width: 0; }
.player-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.player-status { flex-shrink: 0; font-size: 1.25rem; }
.player-ready { color: #22c55e; }
.player-not-ready { color: var(--text-muted); }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.navbar-brand {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 1.1rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    text-decoration: none;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.navbar-avatar { cursor: pointer; }

/* ── Room Code Display ──────────────────────────────────────── */
.room-code {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.5rem;
    color: var(--text-primary);
    text-shadow: 0 0 20px var(--accent-glow);
}
.room-code-small {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    background: var(--card-bg-2);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* ── Toast Notifications ────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
    width: calc(100% - 2rem);
    max-width: 420px;
}
.toast {
    background: var(--card-bg-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    animation: toast-in 0.3s ease forwards;
    width: 100%;
    text-align: center;
}
.toast-success { border-color: rgba(34,197,94,0.5); color: #86efac; }
.toast-error   { border-color: rgba(239,68,68,0.5); color: #fca5a5; }
.toast-info    { border-color: rgba(59,130,246,0.5); color: #93c5fd; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); }
}

/* ── UNO Card Styles ────────────────────────────────────────── */
.uno-card {
    width: 60px;
    height: 90px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 900;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2);
    position: relative;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.uno-card:active { transform: scale(0.95); }
.uno-card.selected {
    transform: translateY(-14px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    border-color: #fff;
    z-index: 10;
}
.uno-card.merah   { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; }
.uno-card.kuning  { background: linear-gradient(135deg, #ca8a04, #eab308); color: #1a1a00; }
.uno-card.hijau   { background: linear-gradient(135deg, #15803d, #22c55e); color: #fff; }
.uno-card.biru    { background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff; }
.uno-card.wild    { background: linear-gradient(135deg, #1a1a2e, #4c1d95); color: #fff; border-color: rgba(255,255,255,0.4); }
.uno-card.back    { background: linear-gradient(135deg, #1a1a2e, #2d2b6b); border: 2px solid rgba(255,255,255,0.15); }
.uno-card-value { font-size: 1.5rem; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.uno-card-label { font-size: 0.55rem; letter-spacing: 0.5px; opacity: 0.8; margin-top: 2px; }
.uno-card.unplayable { opacity: 0.35; cursor: not-allowed; }

/* ── UNO Hand Scroll ────────────────────────────────────────── */
.uno-hand {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    padding: 1rem 0.75rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.uno-hand::-webkit-scrollbar { display: none; }
.uno-hand .uno-card { scroll-snap-align: center; }

/* ── Werewolf Phase Themes ──────────────────────────────────── */
.phase-malam { background: var(--gradient-night) !important; }
.phase-siang { background: var(--gradient-day) !important; }

/* ── Chat ───────────────────────────────────────────────────── */
.chat-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.chat-msg.me { align-self: flex-end; }
.chat-msg.them { align-self: flex-start; }
.chat-msg.system { align-self: center; max-width: 100%; }
.chat-bubble {
    padding: 0.5rem 0.875rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}
.chat-msg.me .chat-bubble { background: var(--gradient-purple); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.them .chat-bubble { background: var(--card-bg-2); border: 1px solid var(--border-color); color: var(--text-primary); border-bottom-left-radius: 4px; }
.chat-msg.system .chat-bubble { background: rgba(255,200,0,0.1); border: 1px solid rgba(255,200,0,0.2); color: #fde047; text-align: center; border-radius: 8px; font-size: 0.8rem; }
.chat-msg.werewolf .chat-bubble { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.chat-msg.arwah .chat-bubble { background: rgba(107,114,128,0.1); border: 1px solid rgba(107,114,128,0.2); color: #9ca3af; font-style: italic; }
.chat-sender { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 3px; padding: 0 0.25rem; }
.chat-msg.me .chat-sender { text-align: right; }

/* ── Modal Overlay ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    animation: fadein 0.2s ease;
}
.modal-box {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: slidein 0.25s ease;
}
.modal-box h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Section Headers ────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Game Arena Layout (full-height mobile) ─────────────────── */
.game-arena {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    max-width: 480px;
    margin: 0 auto;
}
.game-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10,10,20,0.9);
    backdrop-filter: blur(10px);
}
.game-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.game-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: rgba(10,10,20,0.8);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
    50%       { box-shadow: 0 0 25px var(--accent-glow), 0 0 50px rgba(139,92,246,0.2); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes bounce-in {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
@keyframes slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-bounce-in  { animation: bounce-in 0.4s ease forwards; }
.animate-slide-up   { animation: slide-up 0.3s ease forwards; }
.animate-spin       { animation: spin 1s linear infinite; }

/* ── Scrollbar (hidden global) ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* ── Loading Spinner ────────────────────────────────────────── */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.875rem; }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 1.25rem 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ── Timer ──────────────────────────────────────────────────── */
.timer-ring {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.375rem 0.875rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}
.timer-ring.urgent { border-color: rgba(239,68,68,0.5); color: #fca5a5; animation: pulse-glow 1s ease-in-out infinite; }

/* ── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.rounded-full { border-radius: var(--radius-full); }

/* ── Responsive Max Container ───────────────────────────────── */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 1.25rem;
}
.page-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.25rem;
    min-height: 100dvh;
}
