/* ============================================================
   Impro-Casino - Casino Theme Styles
   Dunkelgrün / Gold - Optimized for mobile + desktop
   ============================================================ */

:root {
    --bg-primary: #0a1f15;
    --bg-secondary: #0d2b1a;
    --bg-card: #112b1e;
    --bg-hover: #1a3d28;
    --accent-gold: #c9a227;
    --accent-gold-light: #e8d48b;
    --accent-gold-dim: #8b6914;
    --green: #1a5c3a;
    --green-light: #2d8a5a;
    --green-glow: rgba(26, 92, 58, 0.3);
    --text-primary: #f5f0e0;
    --text-secondary: #e8e0cc;
    --text-gray: #8a9a8e;
    --danger: #c62828;
    --danger-light: #ff5252;
    --success: #2e7d32;
    --success-light: #4ade80;
    --warning: #f59e0b;
    --border: rgba(201, 162, 39, 0.25);
    --border-light: rgba(201, 162, 39, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-gold-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-gold); }

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}
.container-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.app-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.app-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-gold);
    letter-spacing: 0.02em;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
    border-color: rgba(201, 162, 39, 0.4);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-subtitle {
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-green {
    background: rgba(45, 138, 90, 0.25);
    color: var(--success-light);
    border: 1px solid rgba(74, 222, 128, 0.3);
}
.badge-gray {
    background: rgba(138, 154, 142, 0.15);
    color: var(--text-gray);
    border: 1px solid rgba(138, 154, 142, 0.2);
}
.badge-gold {
    background: rgba(201, 162, 39, 0.2);
    color: var(--accent-gold-light);
    border: 1px solid rgba(201, 162, 39, 0.35);
}
.badge-red {
    background: rgba(198, 40, 40, 0.2);
    color: var(--danger-light);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

/* ============================================================
   LIVE DOT
   ============================================================ */
.live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--success-light);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-gold {
    background: var(--accent-gold);
    color: var(--bg-primary);
    border-color: var(--accent-gold);
}
.btn-gold:hover:not(:disabled) { background: var(--accent-gold-light); border-color: var(--accent-gold-light); }

.btn-green {
    background: var(--green);
    color: white;
    border-color: var(--green);
}
.btn-green:hover:not(:disabled) { background: var(--green-light); border-color: var(--green-light); }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-light); border-color: var(--danger-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-gray);
    border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: rgba(201, 162, 39, 0.08); color: var(--text-primary); }

.btn-outline {
    background: transparent;
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}
.btn-outline:hover:not(:disabled) { background: rgba(201, 162, 39, 0.1); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.5rem; font-size: 1.1rem; }
.w-full { width: 100%; }

/* ============================================================
   INPUTS
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}
input::placeholder { color: var(--text-gray); opacity: 0.6; }

/* ============================================================
   TABS
   ============================================================ */
.tab-list {
    display: flex;
    gap: 0.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-btn {
    padding: 0.625rem 1.125rem;
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: all 0.2s;
}
.tab-btn.active {
    color: var(--accent-gold-light);
    border-bottom-color: var(--accent-gold);
    background: rgba(201, 162, 39, 0.06);
}
.tab-btn:hover:not(.active) { color: var(--text-primary); }

.tab-panel { display: none; padding-top: 1rem; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

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

/* ============================================================
   PLAYER LIST
   ============================================================ */
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    gap: 0.75rem;
}
.player-item:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}
.player-item.selected {
    border-color: var(--accent-gold);
    background: rgba(201, 162, 39, 0.08);
    box-shadow: 0 0 0 1px var(--accent-gold-dim);
}
.player-item.eliminated {
    opacity: 0.5;
    background: rgba(198, 40, 40, 0.05);
}
.player-item.eliminated .player-name {
    text-decoration: line-through;
    color: var(--text-gray);
}
.player-name {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-chips {
    font-weight: 800;
    color: var(--accent-gold-light);
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
}

/* ============================================================
   CHIP BAR
   ============================================================ */
.chip-bar-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}
.chip-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.chip-bar-default { background: linear-gradient(90deg, var(--green), var(--green-light)); }
.chip-bar-gold { background: linear-gradient(90deg, var(--accent-gold-dim), var(--accent-gold)); }
.chip-bar-silver { background: linear-gradient(90deg, #666, #999); }
.chip-bar-bronze { background: linear-gradient(90deg, #8b4513, #cd853f); }

/* ============================================================
   SABOTAGE GRID
   ============================================================ */
.sabotage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.sabotage-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.sabotage-card:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.sabotage-card:disabled { opacity: 0.3; cursor: not-allowed; }
.sabotage-card span { font-size: 0.7rem; color: var(--text-gray); letter-spacing: 0.05em; }
.sabotage-twist:hover:not(:disabled) { border-color: #3b82f6; }
.sabotage-genre:hover:not(:disabled) { border-color: #a855f7; }
.sabotage-stumm:hover:not(:disabled) { border-color: #6b7280; }

/* ============================================================
   PODIUM
   ============================================================ */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin: 2rem 0 3rem;
    padding: 1rem;
}
.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}
.podium-1 { order: 2; }
.podium-2 { order: 1; }
.podium-3 { order: 3; }
.podium-bar {
    width: 80px;
    border-radius: 8px 8px 0 0;
    transition: height 0.5s ease;
}
.podium-1 .podium-bar { background: linear-gradient(180deg, var(--accent-gold), var(--accent-gold-dim)); }
.podium-2 .podium-bar { background: linear-gradient(180deg, #b0b0b0, #707070); }
.podium-3 .podium-bar { background: linear-gradient(180deg, #cd853f, #8b4513); }
.podium-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.podium-chips {
    font-weight: 800;
    color: var(--accent-gold-light);
    font-size: 1.1rem;
}
.podium-rank {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-gold-dim);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent-gold);
    color: var(--bg-primary);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    z-index: 9999;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: var(--shadow);
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   WORD CLOUD / TAGS
   ============================================================ */
.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}
.word-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: popIn 0.3s ease;
}
.word-tag .count {
    font-size: 0.7rem;
    color: var(--accent-gold);
    font-weight: 700;
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.modal.active { display: flex; animation: fadeIn 0.2s ease; }
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-gray { color: var(--text-gray); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-8 { margin-bottom: 2rem; }
.space-y > * + * { margin-top: 0.5rem; }
.font-bold { font-weight: 700; }
.text-3xl { font-size: 1.875rem; }
.text-5xl { font-size: 3rem; }
.text-xl { font-size: 1.25rem; }
.w-full { width: 100%; }
.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 420px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(201, 162, 39, 0.2);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   REACTION BUTTONS
   ============================================================ */
.reaction-btn {
    transition: all 0.15s ease;
    position: relative;
}
.reaction-btn:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.15);
    border-color: var(--accent-gold);
    transform: scale(1.15);
}
.reaction-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   TIPP / BLUFF-GUESS BUTTONS
   ============================================================ */
.tipp-btn, .bluffguess-btn {
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}
.tipp-btn:hover:not(:disabled), .bluffguess-btn:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.1);
    border-color: var(--accent-gold);
}
.tipp-btn .tipp-count, .bluffguess-btn .bluffguess-count {
    animation: popIn 0.3s ease;
}

/* ============================================================
   PUBLIKUMS-LIVE PANELS (Admin)
   ============================================================ */
.pub-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.pub-panel h4 {
    font-size: 0.85rem;
    color: var(--accent-gold-light);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Vote bar animation */
.vote-bar-fill {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .app-header-inner { padding: 0.625rem 0.75rem; }
    .app-title { font-size: 1.05rem; }
    .grid-auto { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .podium { gap: 0.5rem; }
    .podium-bar { width: 55px; }
    .podium-name { max-width: 70px; font-size: 0.75rem; }
    .sabotage-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .sabotage-card { padding: 0.875rem 0.5rem; font-size: 0.875rem; }
    .card { padding: 1rem; }
    .text-5xl { font-size: 2.25rem; }
    .toast { bottom: 1rem; right: 1rem; left: 1rem; }
}
