/* FLESHLIGHT BATTLE — Bator Games visual identity */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 68, 68, 0.06) 0%, transparent 50%),
        linear-gradient(135deg, #1a1a1a 0%, #092b36 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px;
}

.container {
    background: linear-gradient(135deg, #2a2a2a 0%, #0e4354 100%);
    border: 3px solid #0f0f0f;
    border-radius: 17px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    padding: 40px;
    max-width: 560px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #ffffff;
    margin-bottom: 25px;
    font-size: 2.4em;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: 2px;
}

/* Hero */
.hero-text {
    margin-bottom: 30px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(255, 107, 107, 0.08) 100%);
    border-radius: 15px;
    border: 3px solid rgba(0, 212, 255, 0.2);
}

.hero-text p {
    color: #5f9ab8;
    font-size: 1.05em;
    line-height: 1.4;
    margin-bottom: 8px;
    font-weight: 700;
}

.hero-text p:last-child { margin-bottom: 0; }
.hero-text .muted { font-size: 0.9em; }

/* Panels */
.panel {
    background: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
    border: 1px solid #5a5a5a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.panel h2 {
    color: #5f9ab8;
    font-size: 1.3em;
    font-weight: 400;
    margin-bottom: 12px;
}

.panel p {
    color: #ffffff;
    font-size: 1em;
    line-height: 1.45;
}

.muted { color: #aaaaaa !important; font-size: 0.85em !important; }
.tip { color: #8fb8cc !important; font-size: 0.8em !important; margin-top: 10px; }

/* Buttons */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, #00d4ff 0%, #2b7780 100%);
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.main-btn { font-size: 1.15em; padding: 14px 36px; margin: 10px 0; }

.small-btn { padding: 8px 18px; font-size: 0.85em; }

.back-btn {
    background: linear-gradient(135deg, #4a4a4a 0%, #5a5a5a 100%);
    border: 1px solid #6a6a6a;
    box-shadow: none;
    margin-top: 15px;
}

.back-btn:hover { border-color: #00d4ff; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.kosmi-btn {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.35);
}

/* Cam panel */
.cam-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.text-input {
    flex: 1;
    min-width: 180px;
    background: #222;
    border: 1px solid #5a5a5a;
    border-radius: 20px;
    color: #fff;
    padding: 9px 16px;
    font-size: 0.9em;
    outline: none;
}

.text-input:focus { border-color: #00d4ff; }

.cam-link-display {
    margin-top: 12px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    word-break: break-all;
}

#camLinkText { color: #00d4ff; font-size: 0.85em; text-align: left; }
.cam-link-actions { display: flex; gap: 8px; }

/* Player inputs */
#playerInputs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.player-row { display: flex; gap: 10px; align-items: center; }
.player-row .text-input { flex: 1; }

.remove-player {
    background: #444;
    border: none;
    color: #aaa;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    transition: all 0.2s;
}

.remove-player:hover { background: #a33; color: #fff; }

/* Battle screen */
.cam-bar {
    background: rgba(142, 45, 226, 0.15);
    border: 1px solid rgba(142, 45, 226, 0.4);
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 18px;
    font-size: 0.85em;
    color: #ccc;
}

.cam-bar a { color: #b98cf5; font-weight: 700; }

.round-badge {
    display: inline-block;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #00d4ff;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.step-title {
    color: #ffffff;
    font-size: 1.45em;
    margin-bottom: 18px;
    line-height: 1.3;
}

.instruction-panel { text-align: left; }
.instruction-panel p { margin-bottom: 8px; }
.instruction-panel p:last-child { margin-bottom: 0; }

/* Turn order chips */
.turn-order {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 18px 0;
}

.chip {
    background: #3a3a3a;
    border: 2px solid #5a5a5a;
    border-radius: 20px;
    padding: 8px 18px;
    color: #ddd;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s;
}

.chip.up-next {
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.25);
}

.chip.done {
    border-color: #3a7;
    color: #6c8;
    opacity: 0.6;
}

/* Duration + endings */
.duration-choice { display: flex; gap: 12px; justify-content: center; margin: 15px 0; }
.duration-btn { padding: 10px 26px; }

.ending-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 15px 0;
}

.ending-btn {
    background: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
    border: 2px solid #5a5a5a;
    border-radius: 12px;
    color: #fff;
    padding: 14px 12px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: left;
}

.ending-btn:hover:not(:disabled) { border-color: #00d4ff; transform: translateY(-2px); }
.ending-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ending-btn .ending-letter {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #cc4444);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 6px;
}

.ending-btn .ending-name { display: block; font-weight: 700; font-size: 0.9em; margin-bottom: 4px; }
.ending-btn .ending-desc { display: block; font-size: 0.72em; color: #bbb; line-height: 1.35; }

/* Timer */
.timer-section { margin: 18px 0; }

.current-player {
    color: #fff;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 6px;
}

.chosen-ending {
    color: #ff9b9b;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
}

.timer-display {
    font-size: 3.2em;
    font-weight: bold;
    color: #00d4ff;
    margin-bottom: 14px;
    background: rgba(0, 212, 255, 0.1);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    font-variant-numeric: tabular-nums;
}

.timer-controls { display: flex; gap: 10px; justify-content: center; }

.timer-btn { padding: 10px 24px; }

/* Complete screen */
.trophy { font-size: 3.5em; margin-bottom: 10px; }

.results-list { text-align: left; }
.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px;
    color: #fff;
    border-bottom: 1px solid #555;
    font-size: 0.95em;
}
.result-row:last-child { border-bottom: none; }
.result-row .result-ending { color: #ff9b9b; }

/* Utility */
.hidden { display: none !important; }
.screen { transition: all 0.4s ease; }

@media (max-width: 480px) {
    .container { padding: 24px; }
    h1 { font-size: 1.8em; }
    .ending-picker { grid-template-columns: 1fr; }
    .timer-display { font-size: 2.4em; }
}

/* ============ Video tiles ============ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.video-tile {
    position: relative;
    background: #111;
    border: 2px solid #0f0f0f;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tile-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.7em;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============ Media bar ============ */
.media-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 60;
}

.media-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.5);
    background: rgba(20, 30, 40, 0.9);
    font-size: 1.4em;
    cursor: pointer;
    transition: all 0.25s;
}

.media-btn:hover { border-color: #00d4ff; transform: translateY(-2px); }

.media-btn.media-off {
    border-color: #cc4444;
    background: rgba(80, 20, 20, 0.9);
    filter: grayscale(0.8);
}

/* ============ Home / invite ============ */
.name-input { width: 100%; text-align: center; font-size: 1.05em; }

.home-actions { display: flex; flex-direction: column; gap: 15px; align-items: center; }

.join-row { display: flex; gap: 10px; width: 100%; justify-content: center; }
.join-row .text-input { max-width: 130px; text-transform: lowercase; text-align: center; }

.share-panel .share-row {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    word-break: break-all;
}

.share-link { color: #00d4ff; font-size: 0.85em; }

.share-actions { display: flex; gap: 10px; }

/* ============ Chat ============ */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00d4ff 0%, #2b7780 100%);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
    font-size: 1.5em;
    cursor: pointer;
    z-index: 70;
    transition: transform 0.2s;
}

.chat-fab:hover { transform: scale(1.08); }

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: #fff;
    border-radius: 12px;
    font-size: 0.55em;
    font-weight: 700;
    padding: 3px 7px;
}

.chat-panel {
    position: fixed;
    bottom: 86px;
    right: 20px;
    width: 300px;
    max-width: calc(100vw - 40px);
    height: 380px;
    max-height: 60vh;
    background: linear-gradient(135deg, #222 0%, #0e3543 100%);
    border: 2px solid rgba(0, 212, 255, 0.35);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    z-index: 70;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    font-weight: 700;
    font-size: 0.9em;
}

.chat-close {
    background: none;
    border: none;
    color: #9adcf5;
    font-size: 1.2em;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.chat-msg {
    text-align: left;
    font-size: 0.82em;
    line-height: 1.35;
    color: #eee;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 7px 10px;
    word-break: break-word;
}

.chat-msg-name { color: #00d4ff; font-weight: 700; }

.chat-self {
    background: rgba(0, 212, 255, 0.12);
    align-self: flex-end;
}

.chat-self .chat-msg-name { color: #7fe3ff; }

.chat-system {
    background: none;
    color: #8fb8cc;
    font-style: italic;
    text-align: center;
    font-size: 0.75em;
}

.chat-input-row {
    display: flex;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

.chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    padding: 12px 14px;
    font-size: 0.85em;
    outline: none;
}

.chat-send {
    background: linear-gradient(135deg, #00d4ff, #2b7780);
    border: none;
    color: #fff;
    padding: 0 16px;
    cursor: pointer;
    font-size: 1em;
}

/* ============ DARE WHEEL ============ */
.home-actions .panel h2 { color: #5f9ab8; font-size: 1.1em; font-weight: 400; margin-bottom: 10px; }

.wheel-stage {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.wheel-container {
    width: 100%;
    aspect-ratio: 1 / 1;
}

/* Pointer is drawn at pointerAngle 0 = 3 o'clock, pointing inward */
.wheel-pointer {
    position: absolute;
    top: 50%;
    right: -4px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 26px solid #00d4ff;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.7));
    z-index: 5;
}

.spin-btn {
    display: block;
    margin: 18px auto 0;
    font-size: 1.2em;
    padding: 14px 44px;
    letter-spacing: 2px;
}

/* Result overlay */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
    padding: 20px;
}

.result-card {
    background: linear-gradient(135deg, #2a2a2a 0%, #0e4354 100%);
    border: 3px solid #00d4ff;
    border-radius: 17px;
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.35);
    padding: 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: popIn 0.35s ease-out;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.result-number {
    color: #00d4ff;
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.result-text {
    color: #ffffff;
    font-size: 1.15em;
    line-height: 1.5;
    margin-bottom: 18px;
}

.result-card .timer-display {
    font-size: 2.2em;
    margin-bottom: 12px;
}

.result-card .main-btn { margin-top: 14px; }
