/* Järjesta — looja + mängija stiilid (2a mockupi järgi; tume režiim teemamuutujatega) */

/* Rakenduse aktsendi pehme taust — kolmes kohas, sest tume teema
   tuleb nii käsitsi lülitist kui süsteemi eelistusest (vt DISAIN.md) */
:root { --jr-accent-soft: rgba(0, 209, 178, 0.12); }
[data-theme="dark"] { --jr-accent-soft: rgba(34, 211, 238, 0.14); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --jr-accent-soft: rgba(34, 211, 238, 0.14); }
}

.jr-container { max-width: 1040px; }

/* ---------- Ühised väikesed ehitusplokid ---------- */
.jr-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 13px;
    background: transparent;
    color: var(--text-secondary, #4a4a4a);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.jr-icon-btn:hover { background: var(--bg-hover, #f5f5f5); }
.jr-icon-btn.is-danger-hover:hover { color: #cc0f35; }
[data-theme="dark"] .jr-icon-btn.is-danger-hover:hover { color: #ff6685; }
.jr-icon-btn:disabled { opacity: 0.4; cursor: default; }
.jr-icon-btn:disabled:hover { background: transparent; }

.jr-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #eee);
    font-size: 13px;
    color: var(--text-primary, #363636);
    white-space: nowrap;
}
.jr-pill i { color: var(--text-muted, #999); font-size: 12px; }
.jr-pill b { font-variant-numeric: tabular-nums; font-weight: 600; }
.jr-pill-label { color: var(--text-muted, #999); font-size: 12px; }

/* ---------- Nimekirja vaade ---------- */
.jr-page-head { display: flex; align-items: center; gap: 16px; }
.jr-app-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.jr-app-badge.is-muted { background: var(--bg-hover, #f5f5f5); color: var(--text-muted, #999); }
.jr-h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2.6vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--text-primary, #363636);
}
.jr-page-sub { margin: 2px 0 0; font-size: 15px; color: var(--text-muted, #999); }

/* Valikukaardid: uue mängu loomine */
.jr-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 640px;
    margin-top: 24px;
}
.jr-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 14px 16px;
    background: var(--bg-card, #fff);
    border: 1.5px solid var(--border-color, #dbdbdb);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 150ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) {
    .jr-choice:hover {
        border-color: var(--accent-color, #00d1b2);
        box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    }
}
.jr-choice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.jr-choice-name { display: block; font-weight: 600; font-size: 15px; color: var(--text-primary, #363636); }
.jr-choice-desc { display: block; font-size: 12.5px; color: var(--text-muted, #999); margin-top: 1px; }

/* "Sinu mängud" päis + otsing */
.jr-list-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 32px 0 12px;
}
.jr-list-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary, #363636);
}
.jr-count { font-size: 13px; color: var(--text-muted, #999); margin-right: auto; }
.jr-search { position: relative; width: 260px; max-width: 100%; }
.jr-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted, #999);
    pointer-events: none;
}
.jr-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--border-color, #dbdbdb);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #363636);
    font-size: 14px;
    font-family: inherit;
}
.jr-search input:focus { outline: 2px solid var(--accent-color, #00d1b2); outline-offset: 1px; border-color: transparent; }

/* Mängukaardid: kaks tulpa kui ruumi, vahe grid'i gap'ist */
#jrGamesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr));
    gap: 12px;
    align-items: stretch;
}
#jrGamesList > .jr-empty,
#jrGamesList > p { grid-column: 1 / -1; }
.jr-game-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 14px 18px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #eee);
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    transition: box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
@media (hover: hover) {
    .jr-game-card:hover {
        box-shadow: var(--shadow-hover, 0 4px 12px rgba(0, 0, 0, 0.12));
        transform: translateY(-1px);
    }
}
.jr-game-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
    min-width: 0;
}
.jr-type-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.jr-type-badge.is-muted { background: var(--bg-hover, #f5f5f5); color: var(--text-muted, #999); }
.jr-game-main { min-width: 0; flex: 1 1 240px; }
.jr-game-title { margin: 0; font-weight: 600; font-size: 16px; color: var(--text-primary, #363636); word-break: break-word; }
.jr-game-meta { margin: 2px 0 0; font-size: 13px; color: var(--text-muted, #999); }
.jr-game-note { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted, #999); }
.jr-join-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    flex-shrink: 0;
    white-space: nowrap;
}
.jr-join-pill i { font-size: 10px; }
.jr-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted, #999);
    background: transparent;
    border: none;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.jr-link-btn i { font-size: 12px; }
.jr-link-btn:hover { color: var(--accent-color, #00d1b2); background: var(--bg-hover, #f5f5f5); }

/* Tühi olek */
.jr-empty {
    background: var(--bg-card, #fff);
    border: 1px dashed var(--border-color, #dbdbdb);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
}
.jr-empty-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 0.5rem;
}
.jr-empty-text { color: var(--text-secondary, #4a4a4a); }

/* ---------- Redaktor ---------- */
body.jr-editor-open .navbar { display: none; }
body.jr-editor-open #jrListSection { display: none; }

.jr-editor-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border-light, #eee);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}
.jr-ebar-badge {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.jr-ebar-mid { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
#jrTitleInput {
    min-width: 0;
    flex: 0 1 300px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #363636);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-family: inherit;
}
#jrTitleInput:hover, #jrTitleInput:focus { border-color: var(--border-color, #dbdbdb); outline: none; }
.jr-save-status {
    font-size: 13px;
    color: var(--text-muted, #999);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.jr-save-status i { font-size: 11px; }
.jr-save-status .fa-check { color: var(--accent-color, #00d1b2); }
.jr-save-status.is-warn { color: #946c00; }
[data-theme="dark"] .jr-save-status.is-warn { color: #ffe08a; }

/* Versioonikonflikt (audit 2026-10-04 S10-01): täislaiuses rida kleepuva redaktoririba sees,
   et jääks kerimisel nähtavaks; kitsal ekraanil murduvad nupud teksti alla */
.jr-conflict-bar {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e0a800;
    background: #fff8e1;
    color: #4a3700;
    font-size: 14px;
    line-height: 1.35;
}
.jr-conflict-bar > span:first-of-type { flex: 1 1 220px; }
[data-theme="dark"] .jr-conflict-bar { background: #3a2f0b; border-color: #b38600; color: #fde68a; }

.jr-editor-body { display: flex; align-items: stretch; min-height: calc(100vh - 56px); }
.jr-editor-main { flex: 1; min-width: 0; padding: 24px 20px 48px; }
.jr-editor-side {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-card, #fff);
    border-left: 1px solid var(--border-light, #eee);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-self: stretch;
}
.jr-side-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary, #363636); }
.jr-side-group {
    margin: 6px 0 0;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted, #999);
}
.jr-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}
.jr-setting-row > span:first-child { font-size: 13.5px; color: var(--text-primary, #363636); line-height: 1.35; }
.jr-setting-row.is-disabled { opacity: 0.5; cursor: default; }
.jr-side-hint {
    background: var(--jr-accent-soft);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary, #4a4a4a);
}
.jr-side-hint i { color: var(--accent-color, #00d1b2); margin-right: 5px; }

/* Lüliti (switch) — sisemiselt tavaline checkbox */
.jr-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.jr-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.jr-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color, #dbdbdb);
    border-radius: 999px;
    transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.jr-slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.jr-switch input:checked + .jr-slider { background: var(--accent-color, #00d1b2); }
.jr-switch input:checked + .jr-slider::before { transform: translateX(20px); }
.jr-switch input:focus-visible + .jr-slider { outline: 2px solid var(--accent-color, #00d1b2); outline-offset: 2px; }

/* Kategooriad — grid */
#jrCatsWrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 12px;
    align-items: start;
    max-width: 1040px;
    margin: 0 auto;
}
.jr-cat-box {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #eee);
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.jr-cat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--jr-accent-soft);
    border-bottom: 1px solid var(--border-light, #eee);
}
.jr-cat-name {
    flex: 1;
    min-width: 0;
    height: 30px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #363636);
    font-size: 14.5px;
    font-weight: 700;
    font-family: inherit;
}
.jr-cat-name:hover, .jr-cat-name:focus { border-color: var(--border-color, #dbdbdb); background: var(--bg-card, #fff); outline: none; }
.jr-cat-count {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent-color, #00d1b2);
    background: var(--bg-card, #fff);
    border-radius: 999px;
    padding: 2px 8px;
    flex-shrink: 0;
    white-space: nowrap;
}
.jr-cat-items { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 0; min-height: 2rem; }
.jr-cat-box > .jr-add-el { margin: 6px 10px 10px; }
.jr-add-el {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    font-size: 13px;
    background: transparent;
    color: var(--text-muted, #999);
    border: 1px dashed var(--border-color, #dbdbdb);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}
.jr-add-el:hover { border-color: var(--accent-color, #00d1b2); color: var(--accent-color, #00d1b2); }
.jr-add-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 140px;
    font-size: 14px;
    background: transparent;
    color: var(--text-muted, #999);
    border: 1.5px dashed var(--border-color, #dbdbdb);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
}
.jr-add-tile i { font-size: 18px; }
.jr-add-tile:hover { border-color: var(--accent-color, #00d1b2); color: var(--accent-color, #00d1b2); }

/* Järjestusredaktor */
.jr-order-editor-wrap { max-width: 680px; margin: 0 auto; }
.jr-info-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--jr-accent-soft);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.jr-info-banner i { color: var(--accent-color, #00d1b2); font-size: 13px; flex-shrink: 0; }
.jr-info-banner p { margin: 0; font-size: 13px; color: var(--text-secondary, #4a4a4a); }
.jr-editor-list { display: flex; flex-direction: column; gap: 8px; }

/* Elemendi rida (mõlemad redaktorid) */
.jr-edit-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #dbdbdb);
    border-radius: 10px;
    padding: 7px 9px;
}
.jr-edit-wrap:hover { border-color: var(--text-muted, #999); }
.jr-edit-item { display: flex; align-items: center; gap: 8px; }
.jr-edit-item .jr-item-text {
    flex: 1 1 auto;
    min-width: 0;
    height: 30px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary, #363636);
    font-size: 14px;
    font-family: inherit;
    box-shadow: none;
}
.jr-edit-item .jr-item-text:hover, .jr-edit-item .jr-item-text:focus { border-color: var(--border-color, #dbdbdb); outline: none; }
.jr-grip {
    cursor: move;
    color: var(--text-muted, #999);
    padding: 0.25rem 0.15rem;
    touch-action: none;
    flex-shrink: 0;
    font-size: 12px;
}
[data-theme="dark"] .jr-grip { cursor: grab; }
.jr-order-num {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.jr-thumb-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.jr-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-light, #eee);
}
.jr-thumb-x {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    line-height: 15px;
    border-radius: 50%;
    border: none;
    background: #f14668;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.jr-img-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 13px;
    background: var(--bg-primary, #f4f4f4);
    color: var(--text-muted, #999);
    border: 1px dashed var(--border-color, #dbdbdb);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.jr-img-btn:hover { border-color: var(--accent-color, #00d1b2); color: var(--accent-color, #00d1b2); }
.jr-exp-btn, .jr-del-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 12px;
    background: transparent;
    color: var(--text-muted, #999);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.jr-exp-btn:hover, .jr-del-btn:hover { background: var(--bg-hover, #f5f5f5); }
.jr-del-btn:hover { color: #cc0f35; }
.jr-exp-btn.is-on { color: var(--accent-color, #00d1b2); }
.jr-explain-row { display: flex; align-items: center; gap: 6px; padding-left: 20px; }
.jr-explain-row > i { font-size: 11px; color: var(--text-muted, #999); flex-shrink: 0; }
.jr-explain-row input {
    flex: 1;
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border-light, #eee);
    border-radius: 6px;
    background: var(--bg-primary, #f4f4f4);
    color: var(--text-secondary, #4a4a4a);
    font-size: 12.5px;
    font-family: inherit;
}

/* ---------- Mängija: fookusrežiim ---------- */
.jr-play-body { background: var(--bg-primary, #f4f4f4); }
.jr-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 12px 24px;
    background: var(--bg-card, #fff);
    border-bottom: 1px solid var(--border-light, #eee);
}
.jr-brand { font-size: 14px; font-weight: 700; color: var(--accent-color, #00d1b2); text-decoration: none; flex-shrink: 0; }
.jr-topbar-sep { width: 1px; height: 18px; background: var(--border-color, #dbdbdb); flex-shrink: 0; }
.jr-topbar-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #363636);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.jr-play-wrap {
    max-width: 1040px;
    margin: 0 auto;
    padding: 20px 24px 48px;
    min-height: calc(100vh - 56px);
    min-height: calc(100svh - 56px);
    display: flex;
    flex-direction: column;
}
.jr-play-wrap > #jrNameScreen, .jr-play-wrap > .jr-panel-center { margin: auto; }

/* Paneel (algus/lõpp) */
.jr-panel {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #eee);
    border-radius: 16px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    padding: 32px 36px;
    text-align: center;
}
.jr-panel .jr-app-badge { margin: 0 auto 14px; }
.jr-panel h1 {
    margin: 0 0 4px;
    font-size: clamp(1.3rem, 2.4vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary, #363636);
}
.jr-panel-sub { margin: 0 0 20px; font-size: 14.5px; color: var(--text-muted, #999); }

/* Kategooriakastid */
.jr-buckets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.jr-bucket {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #dbdbdb);
    border-radius: 12px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.jr-bucket-name {
    font-weight: 700;
    text-align: center;
    padding: 10px 12px;
    background: var(--jr-accent-soft);
    border-bottom: 1px solid var(--border-light, #eee);
    color: var(--accent-color, #00d1b2);
    word-break: break-word;
}
.jr-bucket-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    min-height: 96px;
    flex: 1;
    align-content: flex-start;
}

/* Alumine dokk: hunnik + kontrolli nupp */
.jr-dock {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #eee);
    border-radius: 14px;
    box-shadow: var(--shadow-card, 0 2px 4px rgba(0, 0, 0, 0.06));
    padding: 12px 16px;
}
.jr-dock-main { flex: 1 1 320px; min-width: 0; }
.jr-dock-label { margin: 0 0 8px; font-size: 12.5px; color: var(--text-muted, #999); }
.jr-dock-label b { color: var(--text-primary, #363636); }
.jr-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    min-height: 56px;
}
.jr-check-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin: 0 auto;
}
.jr-dock .jr-check-wrap { margin: 0; }
.jr-check-hint { margin: 0; font-size: 11.5px; color: var(--text-muted, #999); min-height: 1em; }
#jrOrderBoard .jr-check-wrap { margin-top: 20px; }

/* Kaardid */
.jr-card {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    background: var(--bg-card, #fff);
    border: 2px solid var(--border-color, #dbdbdb);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: move; /* Chrome'i valge grab-käsi ei paista heledalt taustalt */
    user-select: none;
    -webkit-user-select: none;
    word-break: break-word;
    color: var(--text-primary, #363636);
}
[data-theme="dark"] .jr-card { cursor: grab; }
[data-theme="dark"] .jr-card:active { cursor: grabbing; }
.jr-card img {
    height: 52px;
    max-width: 96px;
    object-fit: contain;
    border-radius: 4px;
    pointer-events: none;
}
.jr-card.is-ok { border-color: #48c78e; }
.jr-card.is-wrong { border-color: #f14668; }
.jr-card.is-revealed { border-style: dashed; }
.jr-card.is-selected {
    border-color: var(--accent-color, #00d1b2);
    box-shadow: 0 0 0 3px var(--jr-accent-soft);
}
.jr-card:focus-visible,
.jr-bucket:focus-visible {
    outline: 2px solid var(--accent-color, #00d1b2);
    outline-offset: 2px;
}
.jr-card.is-locked { cursor: default; }
.jr-explain {
    order: 5;
    flex-basis: 100%;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary, #4a4a4a);
    border-top: 1px dashed var(--border-light, #eee);
    margin-top: 0.3rem;
    padding-top: 0.25rem;
}
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }

/* Õige/vale märgid (värvipimedate tugi) */
.jr-card.is-ok::after,
.jr-card.is-wrong::after {
    font-weight: 700;
    margin-left: 0.35rem;
    line-height: 1;
    flex-shrink: 0;
}
.jr-card.is-ok::after { content: "\2713"; color: #48c78e; }
.jr-card.is-wrong::after { content: "\2717"; color: #f14668; }
.jr-order-list .jr-card.is-ok::after,
.jr-order-list .jr-card.is-wrong::after { margin-left: auto; }

/* Järjestamise loend */
.jr-order-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 640px;
    margin: 0 auto;
    counter-reset: jr;
}
#jrOrderBoard .jr-dock-label { max-width: 640px; margin: 0 auto 8px; }
.jr-order-list .jr-card { counter-increment: jr; width: 100%; }
.jr-order-list .jr-card::before {
    content: counter(jr);
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--bg-hover, #f5f5f5);
    color: var(--text-secondary, #4a4a4a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Tulemus */
.jr-result-greeting { margin: 0 0 2px; font-size: 14.5px; font-weight: 600; color: var(--text-muted, #999); }
.jr-result-greeting.is-perfect { color: #48c78e; }
.jr-result-title {
    margin: 0 0 14px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary, #363636);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.jr-pill-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.jr-praise {
    font-size: 2.2rem;
    line-height: 1;
    animation: jr-pop 0.45s ease-out;
}
@keyframes jr-pop {
    0% { transform: scale(0.3); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Modaalid ---------- */
.jr-modal-card {
    position: relative;
    width: 660px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--bg-card, #fff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
}
.jr-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light, #eee);
}
.jr-modal-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jr-modal-badge {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--jr-accent-soft);
    color: var(--accent-color, #00d1b2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.jr-modal-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-primary, #363636); }
.jr-modal-sub { margin: 0; font-size: 12.5px; color: var(--text-muted, #999); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-light, #eee);
    background: var(--bg-primary, #f4f4f4);
    border-radius: 0 0 16px 16px;
}
.jr-danger-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    font-size: 12.5px;
    background: transparent;
    color: #cc0f35;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.jr-danger-text-btn:hover { background: rgba(204, 15, 53, 0.1); }
[data-theme="dark"] .jr-danger-text-btn { color: #ff6685; }

/* Jagamise modaal: kaks veergu */
.jr-share-grid { display: grid; grid-template-columns: 1fr 1px 1fr; }
.jr-share-col { padding: 22px 24px; min-width: 0; }
.jr-share-divider { background: var(--border-light, #eee); }
.jr-share-h { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--text-primary, #363636); }
.jr-share-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--text-muted, #999); }
.jr-code-box {
    background: var(--jr-accent-soft);
    border-radius: 12px;
    padding: 18px 16px;
    text-align: center;
}
.jr-join-code {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--text-primary, #363636);
    font-variant-numeric: tabular-nums;
}
.jr-code-under { margin: 6px 0 0; font-size: 13.5px; color: var(--text-secondary, #4a4a4a); }
.jr-copy-row { display: flex; margin-bottom: 14px; }
.jr-copy-row input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border-color, #dbdbdb);
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: var(--bg-primary, #f4f4f4);
    color: var(--text-secondary, #4a4a4a);
    font-size: 12.5px;
    font-family: inherit;
}
.jr-copy-row button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--accent-color, #00d1b2);
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}
.jr-copy-row button:hover { background: var(--accent-hover, #00c4a7); }
[data-theme="dark"] .jr-copy-row button { color: #1a1a2e; }
.jr-qr-wrap { display: flex; justify-content: center; }
.jr-qr-wrap > div {
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    line-height: 0;
    border: 1px solid var(--border-light, #eee);
}

/* Tulemuste tabel */
.jr-results-body { padding: 16px 24px 20px; }
.jr-results-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--text-primary, #363636); }
.jr-results-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color, #dbdbdb);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, #999);
    white-space: nowrap;
}
.jr-results-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-light, #eee);
    font-variant-numeric: tabular-nums;
}
.jr-results-table td:first-child { font-weight: 600; }
.jr-results-table td:last-child { color: var(--text-muted, #999); }

/* ---------- Ligipääsetavus ---------- */
@media (prefers-reduced-motion: reduce) {
    .jr-praise { animation: none; }
    .jr-game-card, .jr-choice, .jr-slider, .jr-slider::before { transition: none; }
}

/* ---------- Mobiil ---------- */
@media (max-width: 768px) {
    .jr-editor-body { flex-direction: column; }
    .jr-editor-side { width: 100%; border-left: none; border-top: 1px solid var(--border-light, #eee); }
    .jr-share-grid { grid-template-columns: 1fr; }
    .jr-share-divider { display: none; }
    .jr-share-col + .jr-share-col { border-top: 1px solid var(--border-light, #eee); }
}
@media (max-width: 520px) {
    .jr-choice-grid { grid-template-columns: 1fr; }
    .jr-search { width: 100%; }
    .jr-count { margin-right: 0; }
    .jr-buckets { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
    .jr-bucket-items { min-height: 72px; padding: 8px; gap: 8px; }
    .jr-card { padding: 0.35rem 0.55rem; font-size: 0.9rem; }
    .jr-card img { height: 44px; max-width: 80px; }
    .jr-panel { padding: 24px 20px; }
    .jr-play-wrap { padding: 14px 12px 32px; }
    .jr-topbar { padding: 10px 12px; }
    /* Kitsal ekraanil pealkiri oma reale — pillid ei litsu seda kokku */
    .jr-topbar-title { flex-basis: 100%; order: 5; white-space: normal; }
    .jr-topbar-sep { display: none; }
    .jr-editor-bar { padding: 8px 10px; }
    #jrTitleInput { font-size: 15px; flex: 1 1 140px; }
    .jr-dock { padding: 10px 12px; }
    .jr-dock .jr-check-wrap { margin: 0 auto; }
    .jr-game-card { padding: 12px 14px; }
}
