/* הקטגוריה - עיצוב */

:root {
    --bg: #ffffff;
    --text: #1c1c1c;
    --muted: #6b7280;
    --line: #e8e8e8;
    --accent: #0f766e;        /* טורקיז עמוק */
    --accent-soft: #ecfdf5;
    --accent-line: #99e6d6;
    --wrong: #b91c1c;
    --wrong-soft: #fef2f2;
    --gold: #b45309;
    --radius: 14px;
}

* { box-sizing: border-box; }

/* תיקון קריטי: המאפיין hidden חייב לגבור על כל חוקי display
   (אחרת חלונות עם display: flex מוצגים תמיד) */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Heebo', -apple-system, 'Segoe UI', Arial, sans-serif;
}

/* ---------- כותרת עליונה ---------- */

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 560px;
    margin: 0 auto;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--line);
}

.logo {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 0.5px;
    margin: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 18px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- גוף המשחק ---------- */

.game {
    max-width: 560px;
    margin: 0 auto;
    padding: 22px 20px 60px;
}

.subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 4px;
    font-size: 16px;
}

.puzzle-number {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 22px;
}

/* ---------- מילות הרמז ---------- */

.chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
}

.chip {
    padding: 12px 22px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: #fff;
    font-size: 19px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.chip.found {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
    animation: pop .35s ease;
}

@keyframes pop {
    0%   { transform: scale(.6); opacity: 0; }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .chip.found { animation: none; }
}

/* ---------- קלט וכפתורים ---------- */

.inputs { margin-top: 28px; }

.guess-box {
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
}

/* אזור ניחוש הקטגוריה מודגש - זו הפעולה המנצחת */
.guess-box-category {
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.guess-box label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 9px;
}

.guess-row {
    display: flex;
    gap: 8px;
}

.guess-row input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 17px;
    font-family: inherit;
    border: 1.5px solid #d4d4d4;
    border-radius: 10px;
    outline: none;
    background: #fff;
    transition: border-color .15s;
}
.guess-row input:focus { border-color: var(--accent); }

.btn {
    flex: 0 0 auto;
    padding: 0 22px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    border-radius: 10px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: opacity .15s, background .15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #0d685f; }

.btn-secondary {
    background: #fff;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-secondary:hover { background: var(--accent-soft); }

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.counter {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.message {
    text-align: center;
    min-height: 24px;
    margin: 14px 0 0;
    font-size: 16px;
    font-weight: 500;
}
.message.good { color: var(--accent); }
.message.bad  { color: var(--wrong); }
.message.info { color: var(--muted); }

/* ---------- היסטוריית ניחושים ---------- */

.history {
    display: flex;
    gap: 16px;
    margin-top: 26px;
}

.history-col { flex: 1; }

.history-col h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    margin: 0 0 8px;
    text-transform: uppercase;
}

.history-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-col li {
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 15px;
    background: var(--wrong-soft);
    color: var(--wrong);
    text-decoration: line-through;
}

#cat-guesses li.won {
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

/* ---------- תוצאה ---------- */

.result {
    margin-top: 34px;
    text-align: center;
    padding: 26px 20px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fcfcfc;
}

.result h2 { margin: 0 0 6px; font-size: 24px; }
.result p  { margin: 0 0 18px; color: var(--muted); font-size: 17px; }
.result p strong { color: var(--text); }
.result .btn { width: 100%; max-width: 260px; margin: 0 auto; }

.share-copied {
    margin-top: 12px !important;
    color: var(--accent) !important;
    font-weight: 600;
}

/* ---------- עמוד ריק ---------- */

.empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--muted);
}
.empty h2 { color: var(--text); }

/* ---------- חלונות קופצים ---------- */

.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 16px;
    z-index: 50;
}

.modal {
    position: relative;
    background: #fff;
    border-radius: var(--radius);
    max-width: 440px;
    width: 100%;
    padding: 28px 26px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
}

.modal h2 { margin: 0 0 16px; font-size: 20px; }

.modal-close {
    position: absolute;
    top: 12px;
    left: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    background: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
}

.help-list {
    padding-right: 20px;
    margin: 0;
    line-height: 1.8;
    font-size: 15px;
}
.help-list li { margin-bottom: 8px; }

.help-note {
    margin: 16px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 900;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 420px) {
    .logo { font-size: 22px; }
    .chip { font-size: 17px; padding: 10px 18px; }
}
