/* Tonkla Jeopardy — All rules scoped under #tj-app to prevent conflicts */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700;800&display=swap');

#tj-app {
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.6;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}
#tj-app *, #tj-app *::before, #tj-app *::after { box-sizing: border-box; }

/* ── Spinner ── */
#tj-app .tj-spinner {
    display: inline-block;
    width: 22px; height: 22px;
    border: 3px solid #e2e8f0;
    border-top-color: #2F7251;
    border-radius: 50%;
    animation: tjSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes tjSpin { to { transform: rotate(360deg); } }
#tj-app .tj-loading { text-align: center; padding: 60px 20px; color: #64748b; font-weight: 600; }

/* ── Buttons ── */
#tj-app .tj-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 22px; border: none; border-radius: 12px;
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: all 0.2s; text-decoration: none;
}
#tj-app .tj-btn:hover {  }
#tj-app .tj-btn:active {  }
#tj-app .tj-btn-primary { background: #2F7251; color: #fff; ; }
#tj-app .tj-btn-primary:hover { ; }
#tj-app .tj-btn-danger { background: #EF4444; color: #fff; box-shadow: 0 3px 10px rgba(239,68,68,0.25); }
#tj-app .tj-btn-secondary { background: #6B4C8A; color: #fff; ; }
#tj-app .tj-btn-outline { background: transparent; border: 2px solid #2F7251; color: #2F7251; }
#tj-app .tj-btn-outline:hover { background: #2F7251; color: #fff; }
#tj-app .tj-btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 4px; }
#tj-app .tj-btn-ghost { background: transparent; color: #64748b; padding: 8px 14px; }
#tj-app .tj-btn-ghost:hover { background: rgba(47,114,81,0.08); color: #2F7251; }
#tj-app .tj-btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Inputs ── */
#tj-app .tj-input,
#tj-app .tj-select {
    width: 100%; height: 44px; padding: 0 16px;
    border: 2px solid #e2e8f0; border-radius: 12px;
    font-family: inherit; font-size: 14px; font-weight: 500;
    color: #1e293b; background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
#tj-app .tj-input:focus,
#tj-app .tj-select:focus { outline: none; border-color: #2F7251; box-shadow: 0 0 0 4px rgba(47,114,81,0.18); }
#tj-app .tj-select { appearance: none; cursor: pointer; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%232F7251' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
#tj-app .tj-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }

/* ── Cards & Panels ── */
#tj-app .tj-card {
    background: #fff; border-radius: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px; border: 1px solid #d5d5c8; transition: all 0.2s;
}
#tj-app .tj-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

#tj-app .tj-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
#tj-app .tj-header h2 { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 24px; font-weight: 700; color: #1E5038; margin: 0; }

/* ── Games List ── */
#tj-app .tj-game-list { display: flex; flex-direction: column; gap: 8px; }
#tj-app .tj-game-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 20px; background: #fff; border: 2px solid #f1f5f9;
    border-radius: 4px; transition: all 0.2s;
}
#tj-app .tj-game-item:hover { border-color: rgba(47,114,81,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
#tj-app .tj-game-info { flex: 1; min-width: 0; }
#tj-app .tj-game-info h4 { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
#tj-app .tj-game-info p { font-size: 12px; color: #64748b; margin: 0; }
#tj-app .tj-game-actions { display: flex; gap: 6px; flex-shrink: 0; }
#tj-app .tj-badge { display: inline-flex; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
#tj-app .tj-badge-ready { background: rgba(54,168,112,0.12); color: #2A8A5A; }
#tj-app .tj-badge-draft { background: rgba(212,160,60,0.12); color: #9A7209; }
#tj-app .tj-badge-done { background: rgba(100,116,139,0.12); color: #475569; }
#tj-app .tj-empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
#tj-app .tj-empty h3 { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 20px; color: #64748b; margin-bottom: 8px; }

/* ── Setup Form ── */
#tj-app .tj-setup { max-width: 800px; }
#tj-app .tj-form-group { margin-bottom: 18px; }
#tj-app .tj-form-row { display: flex; gap: 16px; flex-wrap: wrap; }
#tj-app .tj-form-row > * { flex: 1; min-width: 200px; }

#tj-app .tj-upload-zone {
    border: 2px dashed rgba(47,114,81,0.3); border-radius: 4px;
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: rgba(47,114,81,0.02);
}
#tj-app .tj-upload-zone:hover { border-color: #2F7251; background: rgba(47,114,81,0.05); }
#tj-app .tj-upload-zone.dragging { border-color: #2F7251; background: rgba(47,114,81,0.08); }
#tj-app .tj-upload-zone p { margin: 8px 0 0; color: #64748b; font-size: 14px; }
#tj-app .tj-upload-zone .tj-upload-icon { font-size: 36px; opacity: 0.5; }

#tj-app .tj-generating { text-align: center; padding: 30px; }
#tj-app .tj-generating p { margin-top: 12px; color: #64748b; font-weight: 600; }

/* ── Learner Checklist ── */
#tj-app .tj-learner-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; padding: 12px; border: 2px solid #f1f5f9; border-radius: 12px; }
#tj-app .tj-learner-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; }
#tj-app .tj-learner-item:hover { background: rgba(47,114,81,0.05); }
#tj-app .tj-learner-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2F7251; }
#tj-app .tj-learner-item { justify-content: space-between; }
#tj-app .tj-learner-name { display: flex; align-items: center; gap: 10px; cursor: pointer; }
#tj-app .tj-presenter-pick { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #64748b; cursor: pointer; }
#tj-app .tj-presenter-pick input[type="checkbox"] { accent-color: #6B4C8A; }
#tj-app .tj-learner-item.is-presenter { background: rgba(107,76,138,0.08); }
#tj-app .tj-learner-item.is-presenter .tj-presenter-pick { color: #6B4C8A; }
#tj-app .tj-hint { font-size: 13px; color: #64748b; margin: -2px 0 8px; }
#tj-app .tj-learner-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── Team Assignment ── */
#tj-app .tj-teams-config { margin-top: 18px; }
#tj-app .tj-teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
#tj-app .tj-team-box {
    border: 2px solid #f1f5f9; border-radius: 4px; padding: 14px;
    background: #F8FAF9; min-height: 100px;
}
#tj-app .tj-team-box h5 {
    font-size: 14px; font-weight: 700; color: #1E5038; margin: 0 0 10px;
    padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
#tj-app .tj-team-box h5 input {
    border: none; background: transparent; font: inherit; color: inherit;
    width: 100%; outline: none; padding: 0;
}
#tj-app .tj-team-box h5 input:focus { border-bottom: 1px solid #2F7251; }
#tj-app .tj-team-member {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 8px; font-size: 13px; border-radius: 6px;
    margin-bottom: 2px;
}
#tj-app .tj-team-member:hover { background: rgba(47,114,81,0.06); }
#tj-app .tj-team-member button { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 14px; padding: 2px 4px; }
#tj-app .tj-unassigned { margin-top: 14px; padding: 14px; border: 2px dashed #e2e8f0; border-radius: 12px; }
#tj-app .tj-unassigned h5 { font-size: 13px; font-weight: 700; color: #64748b; margin: 0 0 8px; }
#tj-app .tj-unassigned-list { display: flex; flex-wrap: wrap; gap: 6px; }
#tj-app .tj-assign-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px; background: #fff; border: 2px solid #e2e8f0;
    border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all 0.15s;
}
#tj-app .tj-assign-chip:hover { border-color: #2F7251; background: rgba(47,114,81,0.06); }
#tj-app .tj-assign-chip.in-team { opacity: 0.4; cursor: default; }

/* ── Board Preview in Setup ── */
#tj-app .tj-board-preview { margin-top: 18px; }
#tj-app .tj-board-preview h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
#tj-app .tj-board-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: 11px; }
#tj-app .tj-board-mini-cat { background: #1E5038; color: #fff; padding: 6px 4px; text-align: center; border-radius: 6px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tj-app .tj-board-mini-cell { background: #3D9B6D; color: #fff; padding: 4px; text-align: center; border-radius: 4px; font-weight: 700; }

/* ══════════════════════════════════
   JEOPARDY GAME BOARD
   ══════════════════════════════════ */
#tj-app .tj-game-layout { display: flex; gap: 16px; align-items: flex-start; }
#tj-app .tj-board-side { flex: 1; min-width: 0; }
#tj-app .tj-score-side { width: 210px; flex-shrink: 0; }

/* Board Grid */
#tj-app .tj-board {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
    background: rgba(47,114,81,0.04); border-radius: 18px; padding: 10px;
    border: 2px solid rgba(47,114,81,0.08);
}
#tj-app .tj-board-cat {
    background: #1E5038; color: #fff;
    padding: 14px 8px; text-align: center; border-radius: 12px;
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 13px; font-weight: 700;
    line-height: 1.3; min-height: 56px; display: flex; align-items: center; justify-content: center;
    letter-spacing: 0.01em; text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Point cells — Tonkla teal palette with difficulty gradient */
#tj-app .tj-board-cell {
    background: #2F7251; color: #fff;
    padding: 20px 8px; text-align: center; border-radius: 12px;
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 26px; font-weight: 800;
    cursor: pointer; transition: all 0.25s ease;
    min-height: 100px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(47,114,81,0.2);
    position: relative; overflow: hidden;
    text-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
#tj-app .tj-board-cell::before {
    content: ''; position: absolute; inset: 0;
    background: none;
    pointer-events: none; border-radius: 12px;
}
#tj-app .tj-board-cell:hover {
    ;
    box-shadow: 0 8px 24px rgba(47,114,81,0.3);
}
#tj-app .tj-board-cell.answered {
    background: #f1f5f9; color: #cbd5e1; cursor: default;
    transform: none !important; box-shadow: none; font-size: 16px;
    text-shadow: none; border: 2px solid #e2e8f0;
}
#tj-app .tj-board-cell.answered::before { display: none; }

/* Row-based difficulty tinting — 2nd row violet hint, 3rd sky, 4th coral, 5th amber */
#tj-app .tj-board-cell:nth-child(n+11):nth-child(-n+15) { background: #2E75B6; box-shadow: 0 2px 8px rgba(74,143,231,0.2); }
#tj-app .tj-board-cell:nth-child(n+16):nth-child(-n+20) { background: #6B4C8A; box-shadow: 0 2px 8px rgba(107,76,138,0.2); }
#tj-app .tj-board-cell:nth-child(n+21):nth-child(-n+25) { background: #6B4C8A; box-shadow: 0 2px 8px rgba(107,76,138,0.25); }
#tj-app .tj-board-cell:nth-child(n+26):nth-child(-n+30) { background: #C0392B; box-shadow: 0 2px 8px rgba(224,122,95,0.25); }

/* Question Modal */
#tj-app .tj-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.65); backdrop-filter: blur(8px);
    z-index: 99999; display: flex; align-items: center; justify-content: center;
    animation: tjFadeIn 0.2s ease;
}
@keyframes tjFadeIn { from { opacity: 0; } to { opacity: 1; } }

#tj-app .tj-modal {
    background: #fff; border-radius: 20px; width: 90%; max-width: 600px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    animation: tjModalIn 0.3s ease;
    overflow: hidden;
}
@keyframes tjModalIn { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

#tj-app .tj-modal-header {
    padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
    background: #1E5038; color: #fff;
}
#tj-app .tj-modal-header h3 { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 20px; font-weight: 700; margin: 0; }
#tj-app .tj-modal-header .tj-points { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 28px; font-weight: 800; color: #fff; opacity: 0.9; }
#tj-app .tj-modal-close { background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; opacity: 0.7; }
#tj-app .tj-modal-close:hover { opacity: 1; }

#tj-app .tj-modal-body { padding: 28px 24px; }
#tj-app .tj-question-text { font-size: 20px; font-weight: 700; text-align: center; line-height: 1.5; margin-bottom: 24px; color: #1e293b; }
#tj-app .tj-answer-text { font-size: 16px; text-align: center; color: #1E5038; font-weight: 700; padding: 14px; background: rgba(47,114,81,0.06); border-radius: 12px; margin-bottom: 20px; }
#tj-app .tj-answer-text.hidden { display: none; }

#tj-app .tj-modal-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#tj-app .tj-modal-actions .tj-btn { min-width: 200px; justify-content: center; }
#tj-app .tj-team-turn { font-size: 14px; font-weight: 700; color: #6B4C8A; margin-bottom: 12px; text-align: center; }

/* Pass to another team */
#tj-app .tj-pass-options { margin-top: 12px; }
#tj-app .tj-pass-options h4 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
#tj-app .tj-pass-team-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#tj-app .tj-pass-team-btn {
    padding: 8px 18px; border: 2px solid #e2e8f0; border-radius: 20px;
    background: #fff; font-family: inherit; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
}
#tj-app .tj-pass-team-btn:hover { border-color: #6B4C8A; background: rgba(107,76,138,0.08); color: #6B4C8A; }

/* ── Scoreboard ── */
#tj-app .tj-scoreboard { position: sticky; top: 20px; overflow: hidden; }
#tj-app .tj-scoreboard h3 { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 16px; color: #1E5038; margin: 0 0 10px; }
#tj-app .tj-score-list { display: flex; flex-direction: column; gap: 6px; }
#tj-app .tj-score-item {
    padding: 10px 12px; border-radius: 4px; border: 2px solid #f1f5f9;
    background: #fff; transition: all 0.2s; overflow: hidden;
}
#tj-app .tj-score-item.active-team { border-color: #2F7251; background: rgba(47,114,81,0.04); box-shadow: 0 2px 8px rgba(47,114,81,0.12); }
#tj-app .tj-score-top-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#tj-app .tj-score-team-name { font-size: 13px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tj-app .tj-score-team-name small { display: none; }
#tj-app .tj-score-points { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 20px; font-weight: 800; color: #2F7251; flex-shrink: 0; }
#tj-app .tj-score-controls { display: flex; gap: 4px; margin-top: 6px; justify-content: center; }
#tj-app .tj-score-adj {
    width: 26px; height: 26px; border: 2px solid #e2e8f0; border-radius: 6px;
    background: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; color: #64748b; flex-shrink: 0;
}
#tj-app .tj-score-adj:hover { border-color: #2F7251; color: #2F7251; background: rgba(47,114,81,0.06); }
#tj-app .tj-score-adj.minus:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.06); }

/* Turn indicator */
#tj-app .tj-turn-bar {
    padding: 10px 16px; margin-bottom: 14px; border-radius: 12px;
    background: rgba(47,114,81,0.06);
    border: 2px solid rgba(47,114,81,0.15); font-size: 14px; font-weight: 700;
    color: #1E5038; text-align: center;
}

/* ── Board Mode Toggle ── */
#tj-app .tj-mode-toggle { display: flex; gap: 8px; margin-bottom: 4px; }

/* ── Fullscreen Mode ── */
#tj-app.tj-fullscreen {
    position: fixed !important; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99990; background: #000; overflow: hidden;
    padding: 16px 24px !important; max-width: none !important;
    margin: 0 !important; box-sizing: border-box !important;
    display: flex; flex-direction: column;
}
#tj-app.tj-fullscreen .tj-header { flex-shrink: 0; margin-bottom: 8px; }
#tj-app.tj-fullscreen .tj-turn-bar { flex-shrink: 0; margin-bottom: 8px; }
#tj-app.tj-fullscreen .tj-game-layout { flex: 1; min-height: 0; }
#tj-app.tj-fullscreen .tj-board-side { overflow: hidden; display: flex; flex-direction: column; }
#tj-app.tj-fullscreen .tj-board { height: 100%; grid-template-rows: auto repeat(5, 1fr); }
#tj-app.tj-fullscreen .tj-header h2 { color: #fff; }
#tj-app.tj-fullscreen .tj-btn-fullscreen { border-color: #444; color: #ccc; }
#tj-app.tj-fullscreen .tj-btn-fullscreen:hover { border-color: #2F7251; color: #2F7251; }
#tj-app.tj-fullscreen .tj-btn-ghost { color: #94a3b8; }
#tj-app.tj-fullscreen .tj-btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; }
#tj-app.tj-fullscreen .tj-turn-bar { background: rgba(47,114,81,0.15); border-color: rgba(47,114,81,0.25); color: #5BBD8A; }
#tj-app.tj-fullscreen .tj-board { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
#tj-app.tj-fullscreen .tj-board-cell { font-size: 28px; }
#tj-app.tj-fullscreen .tj-board-cell.answered { background: #1a1a1a; border-color: #333; color: #555; }
#tj-app.tj-fullscreen .tj-board-cat { font-size: 15px; }
#tj-app.tj-fullscreen .tj-scoreboard.tj-card { background: #111; border-color: #333; }
#tj-app.tj-fullscreen .tj-scoreboard h3 { color: #5BBD8A; }
#tj-app.tj-fullscreen .tj-score-item { background: #1a1a1a; border-color: #333; }
#tj-app.tj-fullscreen .tj-score-item.active-team { background: rgba(47,114,81,0.1); border-color: #2F7251; }
#tj-app.tj-fullscreen .tj-score-team-name { color: #e2e8f0; }
#tj-app.tj-fullscreen .tj-score-points { color: #5BBD8A; }
#tj-app.tj-fullscreen .tj-score-adj { background: #222; border-color: #444; color: #94a3b8; }
#tj-app.tj-fullscreen .tj-score-adj:hover { border-color: #2F7251; color: #2F7251; background: rgba(47,114,81,0.1); }
#tj-app.tj-fullscreen .tj-score-adj.minus:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }
#tj-app .tj-btn-fullscreen {
    background: transparent; border: 2px solid #e2e8f0; color: #64748b;
    padding: 7px 12px; border-radius: 4px; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 4px;
}
#tj-app .tj-btn-fullscreen:hover { border-color: #2F7251; color: #2F7251; background: rgba(47,114,81,0.06); }

/* ── Scoreboard Card Override ── */
#tj-app .tj-score-side .tj-card { padding: 14px; }

/* ── Playing Badge ── */
#tj-app .tj-badge-playing { background: rgba(59,130,246,0.12); color: #2563eb; }

/* ══════════════════════════════════
   WINNER MODAL
   ══════════════════════════════════ */
#tj-app .tj-winner-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.85); backdrop-filter: blur(6px);
    z-index: 100000; display: flex; align-items: center; justify-content: center;
    animation: tjFadeIn 0.3s ease;
}
#tj-app .tj-winner-modal {
    position: relative; width: 90%; max-width: 520px;
    background: #1E5038;
    border-radius: 24px; overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    animation: tjWinnerIn 0.6s ease;
}
@keyframes tjWinnerIn {
    from { transform: scale(0.5) translateY(40px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
#tj-app .tj-winner-content {
    position: relative; z-index: 2; padding: 40px 32px 32px; text-align: center;
}
#tj-app .tj-winner-trophy {
    font-size: 72px; margin-bottom: 8px;
    animation: tjTrophyBounce 1s ease infinite;
}
@keyframes tjTrophyBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.08); }
}
#tj-app .tj-winner-title {
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 32px; font-weight: 800;
    color: #fff; margin: 0 0 12px;
    text-shadow: 0 2px 10px rgba(255,255,255,0.2);
}
#tj-app .tj-winner-names { margin-bottom: 8px; }
#tj-app .tj-winner-name {
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 24px; font-weight: 700;
    color: #fff; line-height: 1.4;
}
#tj-app .tj-winner-score {
    font-size: 16px; font-weight: 600; color: #a7f3d0; margin-bottom: 24px;
}
#tj-app .tj-final-standings {
    background: rgba(255,255,255,0.06); border-radius: 4px; padding: 14px 18px;
    margin-bottom: 24px; text-align: left;
}
#tj-app .tj-standing-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; font-size: 14px; font-weight: 600; color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
#tj-app .tj-standing-row:last-child { border-bottom: none; }
#tj-app .tj-winner-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#tj-app .tj-winner-actions .tj-btn { min-width: 160px; justify-content: center; }

/* ── Confetti ── */
#tj-app .tj-winner-confetti {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden; pointer-events: none; z-index: 1;
}
#tj-app .tj-confetti-piece {
    position: absolute; top: -10px; width: 8px; height: 12px;
    border-radius: 2px; opacity: 0.85;
    animation: tjConfettiFall 3s ease-in-out infinite;
}
@keyframes tjConfettiFall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 0.9; }
    100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

/* ── Manual Name Entry ── */
#tj-app .tj-manual-names-entry { display: flex; flex-direction: column; }
#tj-app .tj-manual-names-textarea { height: auto !important; min-height: 130px; font-family: inherit; line-height: 1.6; }

/* ── Manual Board Builder ── */
#tj-app .tj-manual-builder { display: flex; flex-direction: column; gap: 18px; }
#tj-app .tj-manual-cat { background: #f8fafc; border: 2px solid #f1f5f9; border-radius: 4px; padding: 16px; }
#tj-app .tj-manual-cat .tj-form-group { margin-bottom: 12px; }
#tj-app .tj-manual-q-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#tj-app .tj-manual-q-row .tj-input { height: 38px; font-size: 13px; }
#tj-app .tj-manual-q-row .tj-input:first-of-type { flex: 2; }
#tj-app .tj-manual-q-row .tj-input:last-of-type { flex: 1; }
#tj-app .tj-manual-pts { font-family: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif; font-size: 14px; font-weight: 700; color: #1E5038; min-width: 54px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
    #tj-app .tj-game-layout { flex-direction: column; }
    #tj-app .tj-score-side { width: 100%; }
    #tj-app .tj-scoreboard { position: static; }
    #tj-app .tj-score-list { flex-direction: row; flex-wrap: wrap; }
    #tj-app .tj-score-item { flex: 1; min-width: 140px; }
    #tj-app .tj-score-team-name small { display: block; font-size: 10px; font-weight: 500; color: #94a3b8; white-space: normal; }
    #tj-app .tj-board-cell { font-size: 20px; padding: 14px 4px; min-height: 75px; }
    #tj-app .tj-board-cat { font-size: 12px; padding: 10px 4px; min-height: 50px; }
}
@media (max-width: 600px) {
    #tj-app { padding: 10px; }
    #tj-app .tj-board { gap: 3px; }
    #tj-app .tj-board-cell { font-size: 14px; padding: 8px 2px; min-height: 44px; border-radius: 6px; }
    #tj-app .tj-board-cat { font-size: 10px; padding: 6px 2px; min-height: 40px; border-radius: 6px; }
    #tj-app .tj-teams-grid { grid-template-columns: 1fr; }
    #tj-app .tj-manual-q-row { flex-direction: column; }
    #tj-app .tj-manual-q-row .tj-input { width: 100%; }
    #tj-app .tj-manual-pts { text-align: left; }
}

/* ══════════════════════════════════
   LIVE PLAY — main screen
   ══════════════════════════════════ */
#tj-app .tj-join-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
#tj-app .tj-join-code strong { font-size: 22px; letter-spacing: 0.12em; color: #1E5038; margin-left: 6px; }
#tj-app.tj-fullscreen .tj-join-code strong { color: #fff; }
#tj-app .tj-sound-bar { text-align: center; margin-bottom: 12px; }

/* Mini Games column */
#tj-app .tj-board-cell small { display: block; font-size: 12px; font-weight: 700; opacity: 0.85; margin-top: 2px; }
#tj-app .tj-game-cell { flex-direction: column; }
#tj-app .tj-board-cell.tj-soon {
    background: #f8fafc !important; color: #94a3b8; font-size: 13px; font-weight: 700; cursor: default;
    box-shadow: none !important; border: 2px dashed #e2e8f0; text-shadow: none;
}
#tj-app.tj-fullscreen .tj-board-cell.tj-soon { background: #151515 !important; border-color: #333; color: #555; }
#tj-app .tj-board-cell.in-play { outline: 4px solid #D4A03C; outline-offset: -4px; cursor: default; }
#tj-app .tj-board-mini-games { background: #64748b; }

#tj-app .tj-joined { display: block; font-size: 11px; font-weight: 600; color: #94a3b8; }
#tj-app .tj-joined.yes { color: #2F7251; }

/* Question / letters overlays */
#tj-app .tj-modal-wide { max-width: 760px; }
#tj-app .tj-timer { text-align: center; margin: -8px 0 16px; }
#tj-app .tj-timer span { display: block; font-size: 44px; font-weight: 800; color: #1E5038; line-height: 1.1; }
#tj-app .tj-timer small { font-size: 12px; color: #64748b; font-weight: 600; }
#tj-app .tj-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
#tj-app .tj-chip { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 20px; background: #f1f5f9; color: #475569; }
#tj-app .tj-chip-correct { background: rgba(47,114,81,0.1); color: #1E5038; }
#tj-app .tj-chip-wrong { background: rgba(239,68,68,0.08); color: #b91c1c; }
#tj-app .tj-result-line { text-align: center; font-size: 18px; font-weight: 700; color: #475569; }
#tj-app .tj-result-line.win { color: #1E5038; }

/* Letter tiles */
#tj-app .tj-tiles { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; margin: 4px 0 14px; }
#tj-app .tj-tile {
    aspect-ratio: 1 / 1; border-radius: 8px; border: 2px dashed #d5d5c8; background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(18px, 4vw, 34px); font-weight: 800; color: #fff;
}
#tj-app .tj-tile.filled { background: #2E75B6; border: 2px solid #2E75B6; animation: tjModalIn 0.25s ease; }
#tj-app .tj-letters-rule { text-align: center; font-size: 13px; color: #64748b; font-weight: 600; margin: 0 0 12px; }
#tj-app .tj-host-pick { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 13px; color: #94a3b8; }
#tj-app .tj-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Clock */
#tj-app .tj-clock { position: relative; width: min(240px, 60vw); margin: 0 auto 12px; }
#tj-app .tj-clock svg { display: block; width: 100%; height: auto; shape-rendering: geometricPrecision; }
#tj-app .tj-clock-rim { fill: #1E5038; }
#tj-app .tj-clock-face { fill: #fff; }
#tj-app .tj-clock-sweep { fill: rgba(47,114,81,0.22); }
#tj-app .tj-clock-tick { stroke: #1E5038; stroke-width: 3; stroke-linecap: round; }
#tj-app .tj-clock-hand { stroke: #C0392B; stroke-width: 4; stroke-linecap: round; }
#tj-app .tj-clock-pin { fill: #1E5038; }
#tj-app .tj-clock-label {
    position: absolute; left: 0; right: 0; bottom: 26%; text-align: center;
    font-size: 22px; font-weight: 800; color: #1E5038;
}

/* Letters result table */
#tj-app .tj-word-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 15px; }
#tj-app .tj-word-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
#tj-app .tj-word-table tr.won td { background: rgba(47,114,81,0.08); font-weight: 700; color: #1E5038; }
#tj-app .tj-word-table .tj-word { font-weight: 800; letter-spacing: 0.08em; }
#tj-app .tj-invalid { color: #b91c1c; font-size: 13px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    #tj-app .tj-tile.filled { animation: none; }
}

/* ══════════════════════════════════
   PHONE VIEW
   ══════════════════════════════════ */
#tj-app.tj-player { max-width: 520px; padding: 16px 12px; }
#tj-app .tjp-screen { display: flex; flex-direction: column; gap: 12px; }
#tj-app .tjp-center { text-align: center; align-items: stretch; }
#tj-app .tjp-title { font-size: 24px; font-weight: 800; color: #1E5038; margin: 8px 0 0; }
#tj-app .tjp-sub { font-size: 14px; color: #64748b; margin: 0; }
#tj-app .tjp-wide { width: 100%; justify-content: center; padding: 14px 22px; font-size: 16px; }
#tj-app .tjp-code-input { font-size: 28px; font-weight: 800; text-align: center; letter-spacing: 0.2em; text-transform: uppercase; height: auto; padding: 12px; }
#tj-app .tjp-msg { padding: 10px 14px; border-radius: 10px; background: rgba(239,68,68,0.08); color: #b91c1c; font-size: 14px; font-weight: 600; }

#tj-app .tjp-team-list { display: flex; flex-direction: column; gap: 8px; }
#tj-app .tjp-team-btn {
    text-align: left; padding: 16px; border-radius: 12px; border: 2px solid #e2e8f0; background: #fff;
    font-family: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
#tj-app .tjp-team-btn:active, #tj-app .tjp-team-btn:focus-visible { border-color: #2F7251; }
#tj-app .tjp-team-name { font-size: 18px; font-weight: 800; color: #1e293b; }
#tj-app .tjp-team-members { font-size: 13px; color: #64748b; }
#tj-app .tjp-team-taken { font-size: 12px; color: #b45309; font-weight: 600; }

#tj-app .tjp-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; border-bottom: 2px solid #f1f5f9; }
#tj-app .tjp-me { font-size: 20px; font-weight: 800; color: #1E5038; }
#tj-app .tjp-code-small { font-size: 12px; color: #94a3b8; }
#tj-app .tjp-code-small a { color: #64748b; }
#tj-app .tjp-score { font-size: 28px; font-weight: 800; color: #2F7251; text-align: right; line-height: 1; }
#tj-app .tjp-score small { display: block; font-size: 11px; color: #94a3b8; font-weight: 600; }

#tj-app .tjp-banner { padding: 12px; border-radius: 12px; background: #f1f5f9; color: #475569; font-weight: 700; text-align: center; }
#tj-app .tjp-banner-go { background: #2F7251; color: #fff; }

#tj-app .tjp-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
#tj-app .tjp-cat {
    background: #1E5038; color: #fff; font-size: 10px; font-weight: 700; line-height: 1.2;
    padding: 6px 2px; border-radius: 6px; text-align: center; min-height: 40px;
    display: flex; align-items: center; justify-content: center; overflow: hidden; word-break: break-word;
}
#tj-app .tjp-cat-games { background: #64748b; }
#tj-app .tjp-cell {
    background: #2F7251; color: #fff; border: none; border-radius: 6px; min-height: 52px;
    font-family: inherit; font-size: 16px; font-weight: 800; cursor: pointer; padding: 4px 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#tj-app .tjp-cell small { font-size: 9px; font-weight: 700; opacity: 0.85; }
#tj-app .tjp-cell:disabled { cursor: default; }
#tj-app .tjp-cell.done { background: #f1f5f9; }
#tj-app .tjp-cell.soon { background: #f8fafc; color: #cbd5e1; font-size: 10px; border: 1px dashed #e2e8f0; }
#tj-app .tjp-board:not(:has(.tjp-cell:enabled)) .tjp-cell:not(.done):not(.soon) { opacity: 0.55; }

#tj-app .tjp-scores { display: flex; flex-direction: column; gap: 4px; }
#tj-app .tjp-score-row { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: #f8fafc; font-size: 14px; }
#tj-app .tjp-score-row.me { background: rgba(47,114,81,0.08); font-weight: 700; }

#tj-app .tjp-card { background: #fff; border-radius: 16px; border: 1px solid #d5d5c8; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
#tj-app .tjp-q-head { display: flex; justify-content: space-between; font-weight: 700; color: #1E5038; }
#tj-app .tjp-q-head strong { font-size: 20px; }
#tj-app .tjp-question { font-size: 19px; font-weight: 700; line-height: 1.45; }
#tj-app .tjp-timer { text-align: center; }
#tj-app .tjp-timer span { display: block; font-size: 40px; font-weight: 800; color: #1E5038; line-height: 1.1; }
#tj-app .tjp-timer small { font-size: 12px; color: #64748b; }
#tj-app .tjp-answer, #tj-app .tjp-word { font-size: 18px; height: auto; padding: 12px 14px; }
#tj-app .tjp-word { text-transform: uppercase; letter-spacing: 0.15em; font-weight: 800; text-align: center; }
#tj-app .tjp-saved { text-align: center; font-size: 14px; color: #2F7251; font-weight: 700; min-height: 20px; }
#tj-app .tjp-status { text-align: center; font-weight: 700; color: #475569; padding: 10px; border-radius: 10px; background: #f8fafc; }
#tj-app .tjp-status.good { background: rgba(47,114,81,0.1); color: #1E5038; }
#tj-app .tjp-status.bad { background: rgba(239,68,68,0.08); color: #b91c1c; }
#tj-app .tjp-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#tj-app .tjp-pick .tj-btn { justify-content: center; padding: 16px; font-size: 17px; }
#tj-app .tjp-tiles { gap: 4px; margin: 0; }
#tj-app .tjp-tiles .tj-tile { font-size: 18px; border-radius: 6px; min-width: 0; }
#tj-app .tjp-word-row > span:last-child { text-align: right; font-size: 13px; }
#tj-app .tjp-words { display: flex; flex-direction: column; gap: 4px; }
#tj-app .tjp-word-row { display: grid; grid-template-columns: minmax(70px, 1fr) auto minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: #f8fafc; font-size: 14px; }
#tj-app .tjp-word-row.me { outline: 2px solid rgba(47,114,81,0.3); }
#tj-app .tjp-word-row.won { background: rgba(47,114,81,0.1); font-weight: 700; }
#tj-app .tjp-word-val { font-weight: 800; letter-spacing: 0.08em; }
#tj-app .tjp-trophy { font-size: 48px; }

/* Presenter status + main screen backup controls */
#tj-app .tj-presenter-status { font-size: 14px; }
#tj-app .tj-presenter-status .tj-joined { display: inline; margin-left: 4px; }
#tj-app .tj-backup { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px dashed #e2e8f0; font-size: 12px; color: #94a3b8; }

/* ── Phone: buzzer + presenter ── */
#tj-app .tjp-buzzer {
    width: min(240px, 70vw); aspect-ratio: 1 / 1; margin: 8px auto; border-radius: 50%;
    border: none; background: #C0392B; color: #fff; font-family: inherit; font-size: 34px; font-weight: 800;
    letter-spacing: 0.08em; cursor: pointer; box-shadow: 0 8px 0 #8e2a20, 0 12px 24px rgba(192,57,43,0.35);
    -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
}
#tj-app .tjp-buzzer:active, #tj-app .tjp-buzzer.pressed { transform: translateY(6px); box-shadow: 0 2px 0 #8e2a20, 0 4px 10px rgba(192,57,43,0.3); }
#tj-app .tjp-buzzer:disabled { opacity: 1; }
#tj-app .tjp-presenter-btn { border-color: rgba(107,76,138,0.35); background: rgba(107,76,138,0.05); }
#tj-app .tjp-is-presenter .tjp-me { color: #6B4C8A; }
#tj-app .tjp-answer-box { padding: 12px 14px; border-radius: 10px; background: rgba(47,114,81,0.08); color: #1E5038; font-size: 18px; font-weight: 800; }
#tj-app .tjp-answer-box small { display: block; font-size: 11px; font-weight: 700; color: #64748b; }
#tj-app .tjp-judge { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#tj-app .tjp-judge .tj-btn { justify-content: center; padding: 16px; font-size: 17px; }
#tj-app .tjp-score-row.turn { outline: 2px solid rgba(47,114,81,0.35); }
#tj-app .tjp-not-joined { font-size: 11px; color: #b45309; font-weight: 600; }
#tj-app .tjp-word-row.valid { background: rgba(47,114,81,0.08); }
#tj-app .tjp-game .tjp-center { text-align: center; }

/* Catchphrase animation */
#tj-app .tj-modal-cp { max-width: min(1100px, 94vw, calc((100vh - 250px) * 1.7778 + 48px)); }
#tj-app .tj-cp-slot { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #0b1220; margin-bottom: 12px; }
#tj-app .tj-cp-canvas { display: block; width: 100%; height: 100%; }
#tj-app.tj-fullscreen .tj-modal-cp { max-width: min(1500px, 96vw, calc((100vh - 230px) * 1.7778 + 40px)); }
#tj-app.tj-fullscreen .tj-modal-cp .tj-modal-body { padding: 16px 20px; }

/* Music round */
#tj-app .tj-music { display: flex; align-items: center; gap: 28px; justify-content: center; margin: 4px 0 18px; flex-wrap: wrap; }
#tj-app .tj-vinyl {
    width: 190px; height: 190px; border-radius: 50%; position: relative; flex-shrink: 0;
    background: repeating-radial-gradient(circle at 50% 50%, #111827 0 3px, #1f2937 3px 6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 0 0 4px #0b0f17;
}
#tj-app .tj-vinyl::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 45%); }
#tj-app .tj-vinyl-label {
    position: absolute; left: 50%; top: 50%; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%;
    background: conic-gradient(#2F7251 0 25%, #D4A03C 0 50%, #2F7251 0 75%, #D4A03C 0); border: 3px solid #0b0f17;
}
#tj-app .tj-vinyl-label::after { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #f8fafc; }
#tj-app .tj-vinyl.spinning { animation: tjSpinBack 1.8s linear infinite; }
@keyframes tjSpinBack { to { transform: rotate(-360deg); } }
#tj-app .tj-music-info { max-width: 300px; text-align: left; }
#tj-app .tj-music-state { font-size: 22px; font-weight: 800; color: #1E5038; }
#tj-app .tj-music-info p { margin: 6px 0 0; color: #475569; font-size: 15px; }
#tj-app .tj-song-line { text-align: center; font-size: 16px; font-weight: 700; color: #475569; margin: -8px 0 14px; }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-vinyl.spinning { animation-duration: 6s; } }
#tj-app .tjp-song { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-top: 4px; }

/* "Where is it?" map round */
#tj-app .tj-map { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #a9d5ea; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#tj-app .tj-map img { display: block; width: 100%; height: 100%; pointer-events: none; }
#tj-app .tj-map.tappable { cursor: crosshair; outline: 3px solid rgba(47,114,81,0.35); }
#tj-app .tj-pin {
    position: absolute; width: 28px; height: 28px; margin: -28px 0 0 -14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: var(--pin, #e11d48); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.35); pointer-events: none;
}
#tj-app .tj-pin b { display: block; transform: rotate(45deg); color: #fff; font-size: 12px; font-weight: 800; text-align: center; line-height: 24px; }
#tj-app .tj-pin-answer {
    position: absolute; transform: translate(-50%, -50%); font-size: 34px; line-height: 1; color: #facc15; pointer-events: none;
    text-shadow: 0 0 3px #1f2937, 0 0 8px rgba(0,0,0,0.5); animation: tjStarIn 0.5s ease;
}
@keyframes tjStarIn { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
#tj-app .tj-map-question { font-size: 20px; font-weight: 800; text-align: center; color: #1e293b; margin-bottom: 8px; }
#tj-app .tj-map-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
#tj-app .tj-map-bar .tj-team-turn { margin: 0; }
#tj-app .tj-map-timer { font-size: 26px; font-weight: 800; color: #1E5038; }
#tj-app .tj-modal-cp .tj-map { max-height: calc(100vh - 330px); max-width: calc((100vh - 330px) * 1.3333); margin: 0 auto; }
#tj-app .tj-map-key { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
#tj-app .tj-map-key-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 20px; background: #f1f5f9; font-size: 14px; font-weight: 700; color: #334155; }
#tj-app .tj-map-key-item.won { background: rgba(47,114,81,0.14); color: #1E5038; }
#tj-app .tj-map-key-item i { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-style: normal; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-pin-answer { animation: none; } }
#tj-app .tjp-dot { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-style: normal; font-size: 11px; font-weight: 800; margin-right: 6px; vertical-align: middle; }
#tj-app .tjp-pick-row { width: 100%; border: 2px solid transparent; font-family: inherit; cursor: pointer; text-align: left; }
#tj-app .tjp-pick-row.won { border-color: #2F7251; }

/* Paper planes task */
#tj-app .tj-task { text-align: center; }
#tj-app .tj-plane { width: 200px; margin: 0 auto 8px; animation: tjFloat 3s ease-in-out infinite; }
#tj-app .tj-plane svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.15)); }
#tj-app .tj-plane.flying { animation: tjFly 2.4s ease-in-out infinite; }
@keyframes tjFloat { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes tjFly { 0% { transform: translate(-140px, 30px) rotate(6deg); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(160px, -30px) rotate(-8deg); opacity: 0; } }
#tj-app .tj-task-text { font-size: 18px; font-weight: 600; color: #334155; max-width: 560px; margin: 0 auto 16px; }
#tj-app .tj-task-timer span { display: block; font-size: 96px; font-weight: 800; color: #1E5038; line-height: 1; }
#tj-app .tj-task-timer small { font-size: 14px; color: #64748b; font-weight: 700; }
#tj-app .tj-task-throw { font-size: 30px; font-weight: 800; color: #C0392B; margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-plane, #tj-app .tj-plane.flying { animation: none; } }

/* AI from categories */
#tj-app .tj-ai-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: rgba(107,76,138,0.07); margin-bottom: 14px; }
#tj-app .tj-ai-intro p { margin: 0; font-size: 14px; color: #475569; max-width: 560px; }
#tj-app .tj-cat-row { display: flex; gap: 8px; align-items: center; }
#tj-app .tj-cat-row .tj-input { flex: 1; }
#tj-app .tj-cat-row .tj-btn { white-space: nowrap; }
#tj-app .tj-ai-regen {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 8px; border: 2px solid #e2e8f0; background: #fff;
    font-size: 18px; font-weight: 800; color: #6B4C8A; cursor: pointer;
}
#tj-app .tj-ai-regen:hover { border-color: #6B4C8A; background: rgba(107,76,138,0.06); }
#tj-app .tj-ai-regen:disabled { opacity: 0.5; cursor: wait; }
#tj-app .tj-manual-q-row.tj-ai-loading .tj-input { background: repeating-linear-gradient(90deg, #f8fafc 0 20px, #eef2f7 20px 40px); background-size: 200% 100%; animation: tjShimmer 1s linear infinite; color: #94a3b8; }
@keyframes tjShimmer { to { background-position: -40px 0; } }
#tj-app .tj-manual-q-row.tj-ai-fresh .tj-input { box-shadow: 0 0 0 3px rgba(47,114,81,0.25); transition: box-shadow 0.3s; }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-manual-q-row.tj-ai-loading .tj-input { animation: none; } }

/* Wheel of Fortune */
#tj-app .tj-board-cat-wheel { background: #7a4f9a; }
#tj-app .tj-wheel-cell { flex-direction: column; font-size: 30px; }
#tj-app .tj-modal-wheel { max-width: min(1240px, 96vw); }
#tj-app .tj-wheel-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 20px; align-items: center; }
#tj-app .tj-wheel-slot { width: 100%; max-width: min(420px, calc(100vh - 300px)); margin: 0 auto; aspect-ratio: 1 / 1; }
#tj-app .tj-wheel-canvas { display: block; width: 100%; height: 100%; }
#tj-app .tj-wboard { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; padding: 10px; border-radius: 12px; background: #1E5038; }
#tj-app .tj-wt { aspect-ratio: 3 / 4; border-radius: 4px; background: #ffffff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: clamp(12px, 2vw, 28px); color: #111827; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12); }
#tj-app .tj-wt.off { background: #2F7251; box-shadow: none; }
#tj-app .tj-wt.on { animation: tjTileIn 0.4s ease; }
#tj-app .tj-wt.punct { color: #475569; }
#tj-app .tj-wboard.small { gap: 2px; padding: 6px; }
#tj-app .tj-wboard.small .tj-wt { font-size: 13px; border-radius: 2px; }
@keyframes tjTileIn { from { background: #fde047; } to { background: #ffffff; } }
#tj-app .tj-wheel-log { margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: 20px; font-weight: 800; text-align: center; background: #f1f5f9; color: #334155; }
#tj-app .tj-wheel-log.log-good { background: rgba(47,114,81,0.12); color: #1E5038; }
#tj-app .tj-wheel-log.log-bad { background: rgba(239,68,68,0.1); color: #b91c1c; }
#tj-app .tj-wheel-now { text-align: center; margin-top: 8px; font-size: 16px; color: #334155; }
#tj-app .tj-wheel-clock { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 20px; background: #1E5038; color: #fff; font-weight: 800; }
#tj-app .tj-wletters { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 12px; }
#tj-app .tj-wletters span { width: 26px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: #e2e8f0; font-weight: 800; font-size: 14px; color: #1f2937; }
#tj-app .tj-wletters span.vowel { background: #fde68a; }
#tj-app .tj-wletters span.used { background: #f8fafc; color: #cbd5e1; text-decoration: line-through; }
#tj-app .tj-wheel-banks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
#tj-app .tj-wheel-banks span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: #f1f5f9; font-weight: 700; font-size: 14px; }
#tj-app .tj-wheel-banks span b { font-size: 18px; color: #1E5038; }
#tj-app .tj-wheel-banks span.active { background: #1E5038; color: #fff; }
#tj-app .tj-wheel-banks span.active b { color: #fde68a; }
@media (max-width: 900px) { #tj-app .tj-wheel-layout { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-wt.on { animation: none; } }
#tj-app .tjp-cat-wheel { background: #7a4f9a; }
#tj-app .tjp-wheel-cell { font-size: 18px; }
#tj-app .tjp-wlog { text-align: center; font-weight: 800; padding: 8px; border-radius: 8px; background: #f1f5f9; color: #334155; }
#tj-app .tjp-wlog.log-good { background: rgba(47,114,81,0.12); color: #1E5038; }
#tj-app .tjp-wlog.log-bad { background: rgba(239,68,68,0.1); color: #b91c1c; }
#tj-app .tjp-wheel-actions { display: grid; gap: 10px; }
#tj-app .tjp-wheel-actions .tj-btn { justify-content: center; padding: 15px; font-size: 17px; }
#tj-app .tjp-letter-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
#tj-app .tjp-letter { padding: 12px 0; border-radius: 8px; border: 2px solid #e2e8f0; background: #fff; font-family: inherit; font-size: 18px; font-weight: 800; color: #1f2937; cursor: pointer; }
#tj-app .tjp-letter:active { background: #1E5038; color: #fff; }
#tj-app .tjp-letter.used { color: #cbd5e1; text-decoration: line-through; background: #f8fafc; }
#tj-app .tjp-q-head strong small { font-size: 11px; color: #64748b; font-weight: 700; }
#tj-app .tj-board-mini-wheel { background: #7a4f9a; }
#tj-app .tj-puzzle-row .tj-input.tj-puzzle-cat { flex: 0 0 140px; height: 38px; font-size: 13px; }
#tj-app .tj-puzzle-row .tj-input.tj-puzzle-text { flex: 2; text-transform: uppercase; }
#tj-app .tj-puzzle-fit { flex: 0 0 150px; font-size: 12px; font-weight: 700; color: #2F7251; }
#tj-app .tj-puzzle-fit.bad { color: #b91c1c; }
#tj-app .tj-prompt-box { margin: -4px 0 16px; padding: 12px 14px; border: 2px dashed rgba(107,76,138,0.3); border-radius: 12px; }
#tj-app .tj-prompt-note { font-weight: 500; color: #64748b; margin-left: 4px; }
#tj-app .tj-prompt-text { height: auto; min-height: 150px; padding: 10px 12px; font-size: 13px; line-height: 1.5; resize: vertical; font-family: inherit; }
#tj-app .tj-prompt-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; font-size: 12px; color: #64748b; }
#tj-app .tj-prompt-foot .tj-btn { white-space: nowrap; flex-shrink: 0; }
#tj-app .tj-backup-letter { min-width: 32px; padding: 4px 6px; justify-content: center; }

/* Random pop-ups */
#tj-app .tj-popup .tj-modal-header { background: #C0392B; }
#tj-app .tj-popup { animation: tjPopIn 0.45s cubic-bezier(.34,1.56,.64,1); }
@keyframes tjPopIn { from { transform: scale(0.6) rotate(-3deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
#tj-app .tj-popup-text { font-size: 28px; font-weight: 800; line-height: 1.35; text-align: center; color: #1e293b; margin: 6px 0 18px; }
#tj-app .tj-popup-text.small { font-size: 20px; }
#tj-app .tj-popup-rule { text-align: center; font-size: 14px; font-weight: 700; color: #64748b; margin: 12px 0 0; }
@media (prefers-reduced-motion: reduce) { #tj-app .tj-popup { animation: none; } }
#tj-app .tjp-popup { border: 3px solid #C0392B; animation: tjPopIn 0.45s cubic-bezier(.34,1.56,.64,1); }
#tj-app .tjp-popup-head { color: #C0392B; }
#tj-app .tjp-pick-row:disabled { opacity: 0.45; cursor: not-allowed; }
/* Pop-up editor */
#tj-app .tj-popup-edit { padding: 12px; border: 2px solid #f1f5f9; border-radius: 10px; margin-bottom: 10px; background: #fff; }
#tj-app .tj-popup-edit-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 14px; }
#tj-app .tj-pop-text { height: auto; padding: 8px 12px; font-size: 14px; resize: vertical; font-family: inherit; }
#tj-app .tj-popup-fields { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 8px; font-size: 13px; font-weight: 600; color: #334155; }
#tj-app .tj-popup-fields label { display: inline-flex; align-items: center; gap: 6px; }
#tj-app .tj-popup-fields .tj-input { height: 34px; padding: 0 8px; font-size: 13px; width: auto; }
#tj-app .tj-popup-fields input[type="number"] { width: 80px; }
#tj-app .tj-popup-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#tj-app .tj-pop-status { font-size: 13px; font-weight: 700; color: #2F7251; }

/* Buzz: fastest name flashes on the main screen */
#tj-app .tj-buzz-flash {
    position: fixed; inset: 0; z-index: 100001; display: flex; align-items: center; justify-content: center;
    background: rgba(15,23,42,0.55); pointer-events: none; animation: tjFadeIn 0.15s ease;
}
#tj-app .tj-buzz-card {
    text-align: center; padding: 28px 56px 32px; border-radius: 28px; background: #C0392B; color: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45); max-width: 92vw;
    animation: tjBuzzIn 0.35s cubic-bezier(.34,1.56,.64,1), tjBuzzPulse 0.5s ease-in-out 0.35s 5 alternate;
}
#tj-app .tj-buzz-bell { font-size: 64px; line-height: 1; animation: tjRing 0.25s ease-in-out 6 alternate; }
#tj-app .tj-buzz-name { font-size: clamp(56px, 11vw, 150px); font-weight: 900; line-height: 1.05; letter-spacing: 0.01em; text-transform: uppercase; word-break: break-word; text-shadow: 0 4px 0 rgba(0,0,0,0.2); }
#tj-app .tj-buzz-members { font-size: clamp(18px, 2.4vw, 30px); font-weight: 700; opacity: 0.9; margin-top: 4px; }
#tj-app .tj-buzz-sub { font-size: clamp(22px, 3vw, 40px); font-weight: 800; color: #fde68a; margin-top: 6px; }
@keyframes tjBuzzIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 2 pulses a second — under the 3-flashes-a-second safety limit */
@keyframes tjBuzzPulse { from { background: #C0392B; transform: scale(1); } to { background: #e11d48; transform: scale(1.04); } }
@keyframes tjRing { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) {
    #tj-app .tj-buzz-card, #tj-app .tj-buzz-bell, #tj-app .tj-buzz-flash { animation: none; }
}

/* Phone view: fill the whole screen once joined (works on iPhone too) */
html.tjp-lock, html.tjp-lock body { overflow: hidden !important; height: 100% !important; overscroll-behavior: none; }
#tj-app.tj-player.tjp-full {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 2147483000; box-sizing: border-box;
    width: 100%; max-width: none; height: 100vh; height: 100dvh; margin: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    background: #fafaf7;
    padding: calc(12px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px))
             calc(18px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
}
#tj-app.tj-player.tjp-full > * { max-width: 520px; margin-left: auto; margin-right: auto; }

/* Game intro (name + instructions before it starts) */
#tj-app .tj-intro .tj-modal-body { text-align: center; }
#tj-app .tj-intro-icon { font-size: 72px; line-height: 1; }
#tj-app .tj-intro-title { font-size: 44px; font-weight: 900; color: #1E5038; margin: 6px 0 4px; }
#tj-app .tj-intro-cat { font-size: 20px; color: #6B4C8A; margin-bottom: 6px; }
#tj-app .tj-intro-text { font-size: 21px; line-height: 1.5; color: #1e293b; max-width: 680px; margin: 10px auto 18px; font-weight: 600; }
#tj-app .tjp-intro { text-align: left; }
#tj-app .tjp-intro-icon { font-size: 54px; text-align: center; line-height: 1; }
#tj-app .tjp-intro-text { font-size: 16px; line-height: 1.5; color: #1e293b; margin: 0; }

/* Teams / individuals */
#tj-app .tj-mode-pick { display: flex; gap: 8px; }
#tj-app .tj-solo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#tj-app .tj-solo-chip { padding: 6px 12px; border-radius: 20px; background: rgba(47,114,81,0.1); color: #1E5038; font-weight: 700; font-size: 14px; }
#tj-app .tj-score-members { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.35; }
