/* ===== VARIABLES & BASE ===== */
:root {
    --bg: #f0ede8;
    --surface: #ffffff;
    --surface2: #faf9f7;
    --border: #e0dbd2;
    --text-primary: #1a1713;
    --text-secondary: #6b6560;
    --text-muted: #a09a94;
    --accent: #2d6a4f;
    --accent-light: #52b788;
    --accent-dark: #1b4332;
    --danger: #e63946;
    --warning: #f4a261;
    --domino-bg: #fffef9;
    --domino-border: #2d2a26;
    --domino-shadow: rgba(45, 42, 38, 0.18);
    --header-h: 96px;
    --radius: 12px;
    --radius-lg: 18px;
    font-size: 16px;
}

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

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SPLASH ===== */
#splash-screen {
    position: fixed;
    inset: 0;
    background: var(--accent-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 9999;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

.splash-logo { animation: bounceIn 0.6s ease; }

.splash-domino {
    width: 72px;
    height: 140px;
    background: var(--domino-bg);
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.splash-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.splash-divider {
    width: 90%;
    height: 2px;
    background: rgba(45, 42, 38, 0.4);
}

.splash-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.5px;
}

.splash-sub {
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    font-weight: 300;
}

.splash-loader {
    width: 48px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.splash-loader div {
    height: 100%;
    width: 40%;
    background: var(--accent-light);
    border-radius: 2px;
    animation: slide 1s ease-in-out infinite;
}

@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== MAIN APP ===== */
.hidden-app {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hidden-app.visible {
    opacity: 1;
}

/* ===== HEADER ===== */
.app-header {
    position: sticky;
    top: 0;
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-area > a + a {
    margin-right: 16px;
}

.site-logo {
    height: 68px;
    width: auto;
    object-fit: contain;
}

/* סמל דומינו */
.logo-domino-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 34px;
    height: 56px;
    background: #2d5a3d;
    border-radius: 7px;
    padding: 6px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.ldi-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.ldi-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ldi-divider {
    width: 85%;
    height: 2px;
    background: rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-sub {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* ===== MAIN ===== */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px 48px;
}

/* ===== CREATOR SECTION ===== */
.creator-hero {
    text-align: center;
    margin-bottom: 28px;
}

.creator-title {
    font-size: 1.9rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.creator-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.creator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.pairs-header {
    display: flex;
    gap: 10px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.pair-col-label {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.delete-col { flex: 0 0 36px; }

/* word pair rows */
.word-pair-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    animation: rowIn 0.2s ease;
}

@keyframes rowIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.word-pair-row .row-num {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.word-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: 'Heebo', sans-serif;
    background: var(--surface2);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
}

.word-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12);
    background: var(--surface);
}

.word-input::placeholder { color: var(--text-muted); }

.delete-row-btn {
    flex: 0 0 32px;
    height: 32px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.delete-row-btn:hover {
    background: #fff1f2;
    border-color: var(--danger);
    color: var(--danger);
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 9px 18px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(45, 106, 79, 0.04);
}

.add-icon { font-size: 1.1rem; font-weight: 300; }

.creator-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.tile-count-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.tile-count-info strong { color: var(--accent); font-weight: 700; }

.cta-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--accent);
    color: white !important;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(45, 106, 79, 0.3);
}

.cta-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(45, 106, 79, 0.35);
}

.cta-btn:active { transform: translateY(0); }

.btn-icon { font-size: 0.9rem; }

/* ===== GAME SECTION ===== */
.hidden { display: none !important; }

.game-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.share-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.share-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 600;
}

.share-input {
    width: 260px;
    min-width: 0;
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: 'Heebo', sans-serif;
    background: var(--surface);
    color: var(--text-secondary);
    direction: ltr;
}

.copy-btn {
    padding: 7px 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}

.copy-btn:hover { border-color: var(--accent); background: rgba(45,106,79,0.06); }

.game-controls {
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    padding: 8px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: 'Heebo', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

.ctrl-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(45,106,79,0.05);
}

/* ===== DOMINO BOARD ===== */
#domino-board {
    position: relative;
    min-height: 500px;
    width: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(82,183,136,0.08) 0%, transparent 60%),
        linear-gradient(135deg, #e8f4ee 0%, #eef4f0 50%, #e8ede8 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.05);
    /* subtle grid */
    background-image:
        linear-gradient(rgba(45,106,79,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45,106,79,0.06) 1px, transparent 1px),
        radial-gradient(ellipse at 20% 20%, rgba(82,183,136,0.08) 0%, transparent 60%);
    background-size: 40px 40px, 40px 40px, 100% 100%;
}

.board-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

.board-hint.hidden { opacity: 0; }

/* ===== ROTATE MENU ===== */
#rotate-menu {
    position: absolute;
    z-index: 2000;
    background: var(--surface);
    border: 1.5px solid var(--border);
    padding: 5px 7px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    gap: 4px;
    transition: top 0.12s, left 0.12s;
}

#rotate-menu button {
    width: 32px;
    height: 32px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rotate-menu button:hover { background: var(--accent); color: white; border-color: var(--accent); }
#close-rotate-btn:hover { background: var(--danger) !important; border-color: var(--danger) !important; }

/* ===== DOMINO TILES ===== */
.domino-tile {
    position: absolute;
    background-color: var(--domino-bg);
    border: 2.5px solid var(--domino-border);
    border-radius: 12px;
    box-shadow:
        3px 4px 0 rgba(45,42,38,0.12),
        0 2px 8px var(--domino-shadow);
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: box-shadow 0.15s, transform 0.1s;
    display: flex;
}

.domino-tile:hover {
    box-shadow:
        4px 6px 0 rgba(45,42,38,0.15),
        0 4px 16px var(--domino-shadow);
    transform: translateY(-1px);
}

.domino-tile.dragging {
    cursor: grabbing;
    box-shadow:
        6px 10px 0 rgba(45,42,38,0.2),
        0 8px 28px rgba(0,0,0,0.25);
    transform: scale(1.03) translateY(-2px);
    z-index: 1000 !important;
}

.domino-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.88rem;
    word-break: break-word;
    line-height: 1.25;
}

.domino-divider { background-color: var(--domino-border); }

/* Rotations */
.rot-0   { flex-direction: column; width: 100px; height: 200px; }
.rot-0   .domino-divider { height: 2.5px; width: 100%; }

.rot-90  { flex-direction: row; width: 200px; height: 100px; }
.rot-90  .domino-divider { height: 100%; width: 2.5px; }

.rot-180 { flex-direction: column-reverse; width: 100px; height: 200px; }
.rot-180 .domino-divider { height: 2.5px; width: 100%; }

.rot-270 { flex-direction: row-reverse; width: 200px; height: 100px; }
.rot-270 .domino-divider { height: 100%; width: 2.5px; }

/* כל הקוביות לבנות עם מסגרת שחורה — כמו דומינו אמיתי */
.domino-tile.color-1,
.domino-tile.color-2,
.domino-tile.color-3,
.domino-tile.color-4,
.domino-tile.color-5 { --domino-bg: #ffffff; }

/* ===== GAME BOTTOM BAR ===== */
#game-section {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-h) - 80px);
    width: 100%;
}

#game-section #domino-board {
    flex: 1;
    min-height: 0;
    width: 100%;
}

.game-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.back-btn {
    padding: 9px 18px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: 'Heebo', sans-serif;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.back-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(45,106,79,0.05); }

.tiles-counter {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== WIN OVERLAY ===== */
.win-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.win-overlay.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.win-box {
    background: var(--surface);
    border-radius: 24px;
    padding: 40px 36px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.win-emoji {
    font-size: 3.5rem;
    margin-bottom: 12px;
    animation: bounce 0.6s ease 0.3s both;
}

@keyframes bounce {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.win-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-dark);
    margin-bottom: 8px;
}

.win-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

.win-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Board win flash */
#domino-board.win-flash {
    animation: boardFlash 0.6s ease;
}

@keyframes boardFlash {
    0%   { box-shadow: inset 0 0 0 rgba(82,183,136,0); }
    40%  { box-shadow: inset 0 0 60px rgba(82,183,136,0.5); }
    100% { box-shadow: inset 0 0 0 rgba(82,183,136,0); }
}

/* Special tiles */
.domino-tile.tile-start { --domino-bg: #ffffff; border-color: #1b1b1b !important; }
.domino-tile.tile-end   { --domino-bg: #ffffff; border-color: #1b1b1b !important; }
.domino-tile.tile-start .domino-half:first-child,
.domino-tile.tile-end   .domino-half:last-child {
    font-weight: 900;
    color: var(--accent-dark);
}
.domino-tile.tile-start .domino-half:first-child { color: #2e7d32 !important; font-weight: 900; }
.domino-tile.tile-end .domino-half:last-child { color: #c62828 !important; font-weight: 900; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--text-primary);
    color: white;
    padding: 10px 22px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 768px) {
    .main-content { padding: 8px 8px 40px; }
    .three-col-layout .main-content { max-width: 100% !important; width: 100% !important; }
    .game-top-bar { flex-direction: row; align-items: center; flex-wrap: nowrap; gap: 6px; }
    .share-area { display: none; }
    .game-controls { gap: 6px; width: 100%; }
    .ctrl-btn { flex: 1; padding: 8px 6px; font-size: 0.82rem; text-align: center; }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 480px) {

    /* ── header ── */
    .app-header { height: 56px; }
    :root { --header-h: 56px; }
    .header-inner { padding: 0 10px; }
    .site-logo { height: 44px; }
    .logo-domino-icon { width: 24px; height: 40px; }
    .logo-title { font-size: 0.85rem; }
    .logo-sub { font-size: 0.78rem; }
    .logo-area > a + a { margin-right: 8px; }
    .logo-area { gap: 6px; }

    /* ── main ── */
    .main-content { padding: 14px 10px 80px; }

    /* ── CREATOR: hero ── */
    .creator-hero { margin-bottom: 14px; }
    .creator-title { font-size: 1.3rem; }
    .creator-desc { font-size: 0.82rem; line-height: 1.4; }

    /* ── CREATOR: card ── */
    .creator-card { padding: 12px 10px; border-radius: 14px; gap: 0; }

    /* header row — hide on mobile, labels move into placeholders */
    .pairs-header { display: none; }

    /* each pair row becomes a card of its own: inputs stacked vertically */
    .word-pair-row {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
        background: var(--surface2);
        border: 1.5px solid var(--border);
        border-radius: 14px;
        padding: 12px 12px 12px 12px;
        position: relative;
    }

    /* header row inside card: number on right, X on left */
    .word-pair-row::before { display: none; }

    /* row number — inline at top of card as flex row */
    .word-pair-row .row-num {
        display: flex;
        position: static;
        align-self: flex-start;
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--text-muted);
        background: var(--border);
        width: 22px;
        height: 22px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        margin-bottom: 2px;
        flex-shrink: 0;
    }

    /* delete button — floated to start (right in RTL), same line as number */
    .delete-row-btn {
        position: absolute;
        top: 10px;
        left: 10px;
        flex: none;
        width: 30px;
        height: 30px;
        font-size: 13px;
        border-radius: 8px;
        border-color: transparent;
        color: var(--text-muted);
        background: var(--surface);
    }

    /* inputs full width */
    .word-input {
        width: 100%;
        padding: 12px 14px;
        font-size: 1rem;
        border-radius: 10px;
        margin-right: 0;
    }

    /* add button */
    .add-btn { padding: 13px; font-size: 1rem; margin-top: 6px; border-radius: 12px; }

    /* ── CREATOR: footer ── */
    .creator-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 10px;
        margin-top: 16px;
    }
    .tile-count-info { font-size: 0.9rem; }
    .cta-btn {
        width: 100%;
        justify-content: center;
        padding: 15px;
        font-size: 1.1rem;
        border-radius: 14px;
    }

    /* ── GAME: top bar ── */
    .game-top-bar { gap: 8px; margin-bottom: 10px; }
    .share-area { flex-direction: row; gap: 6px; }
    .share-label { display: none; }
    .share-input { font-size: 0.75rem; padding: 8px 10px; }
    .copy-btn { padding: 8px 12px; font-size: 1.1rem; }
    .game-controls { gap: 6px; }
    .ctrl-btn { flex: 1; padding: 9px 8px; font-size: 0.82rem; text-align: center; }

    /* ── GAME: board ── */
    #game-section { height: auto !important; }
    #domino-board { min-height: calc(100vh - var(--header-h) - 120px) !important; width: 100% !important; border-radius: 14px; }

    /* ── rotate menu — bigger for fingers ── */
    #rotate-menu { padding: 6px 8px; gap: 6px; border-radius: 14px; }
    #rotate-menu button { width: 44px; height: 44px; font-size: 20px; border-radius: 10px; }

    /* ── domino tiles — smaller on mobile ── */
    .rot-0   { width: 76px !important;  height: 152px !important; }
    .rot-90  { width: 152px !important; height: 76px !important; }
    .rot-180 { width: 76px !important;  height: 152px !important; }
    .rot-270 { width: 152px !important; height: 76px !important; }
    .domino-half { font-size: 0.78rem; padding: 7px 5px; }

    /* ── bottom bar ── */
    .game-bottom-bar { margin-top: 12px; }
    .back-btn { padding: 11px 16px; font-size: 0.95rem; }
    .tiles-counter { font-size: 0.8rem; }

    /* ── toast ── */
    .toast { bottom: 20px; font-size: 0.85rem; padding: 9px 18px; white-space: normal; text-align: center; max-width: 85vw; }
}


/* ===== 3-COLUMN LAYOUT ===== */
.three-col-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 16px;
    align-items: start;
    width: 100%;
}

.three-col-layout .main-content {
    max-width: 60vw;
    width: 60vw;
    min-width: 0;
    padding: 8px 0;
    margin: 0 auto;
}

.three-col-layout #domino-board {
    width: 100%;
    min-height: calc(100vh - var(--header-h) - 60px);
}

/* ===== ACCESSIBILITY ===== */
*:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* רווח שווה משני הצדדים */
.side-ad {
    min-width: 120px;
    max-width: 120px;
}

.three-col-layout {
    min-height: calc(100vh - var(--header-h) - 60px);
    align-items: stretch;
}

.three-col-layout #game-section {
    height: calc(100vh - var(--header-h) - 60px);
}

.three-col-layout #game-section #domino-board {
    flex: 1;
}

.side-ad {
    padding: 16px 8px;
    position: sticky;
    top: calc(var(--header-h) + 12px);
}

.side-ad .ad-unit {
    width: 100%;
    min-height: 500px;
    border-radius: 10px;
}

.desktop-only { display: block; }

@media (max-width: 960px) {
    .three-col-layout {
        grid-template-columns: 1fr;
    }
    .desktop-only { display: none; }
}

/* ===== WHATSAPP BUTTON ===== */
.whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.whatsapp-btn:hover {
    background: #1ebe5d;
    transform: scale(1.05);
}

/* ===== STATIC PAGES (merged from pages.css) ===== */
.page-layout {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
    display: block;
}
@media (max-width: 768px) {
    .page-layout { padding: 20px 16px; }
}

.page-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.page-content h1 { font-size: 2rem; font-weight: 900; color: var(--text-primary); margin-bottom: 8px; }
.page-content h2 { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); margin-top: 28px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.page-content p, .page-content li { color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; }
.page-content ul, .page-content ol { margin-bottom: 24px; padding-right: 24px; }
.page-content li { margin-bottom: 8px; }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding: 32px 24px;
    width: 100%;
    clear: both;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}
.footer-logo img { border-radius: 8px; opacity: 0.85; }
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: center;
}
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; font-weight: 600; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-links a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.footer-copy { color: var(--text-muted, #aaa); font-size: 0.8rem; margin: 0; }

/* ===== SKIP LINK ===== */
.skip-link {
    position: fixed;
    top: -100px;
    right: 16px;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    z-index: 10000;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    font-family: 'Heebo', sans-serif;
    text-decoration: none;
    font-size: 0.9rem;
    transition: top 0.3s ease;
}
.skip-link:focus { top: 0; outline: none; }

/* ===== HEADER LINK (eduplays) ===== */
.header-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 8px 16px;
    border: 1px solid var(--accent);
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
}
.header-link:hover { background: var(--accent); color: white; }
.header-link:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
@media (max-width: 600px) {
    .header-link { font-size: 0.78rem; padding: 6px 12px; }
}

/* ===== ACCESSIBILITY WIDGET ===== */
#accessibility-widget { position: fixed; bottom: 20px; left: 20px; z-index: 9998; }
#acc-toggle {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent); color: white; border: none;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s, background 0.2s; cursor: pointer;
}
#acc-toggle:hover { transform: scale(1.1); background: var(--accent-dark); }
.acc-panel {
    position: absolute; bottom: 60px; left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 180px;
    animation: accFadeUp 0.2s ease;
}
@keyframes accFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.acc-panel-title { font-size: 16px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.acc-option {
    padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; font-family: inherit; font-size: 14px; font-weight: 600;
    color: var(--text-primary); cursor: pointer; text-align: right;
    transition: background 0.2s, border-color 0.2s;
}
.acc-option:hover { background: rgba(45,106,79,0.06); border-color: var(--accent-light); }
.acc-option:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 1px; }

/* Accessibility Modes */
body.acc-high-contrast {
    --bg: #000; --surface: #1a1a1a; --surface2: #111;
    --border: #ffff00; --text-primary: #fff; --text-secondary: #ffff00;
    --text-muted: #ccc; --accent: #00ff00; --accent-light: #66ff66; --accent-dark: #009900;
    --domino-bg: #222; --domino-border: #ffff00;
}
body.acc-high-contrast .app-header { background: #1a1a1a; border-bottom-color: #ffff00; }
body.acc-high-contrast .site-footer { background: #1a1a1a; }
body.acc-underline-links a { text-decoration: underline !important; text-underline-offset: 3px; }
body.acc-readable-font, body.acc-readable-font * { font-family: Arial, Helvetica, sans-serif !important; letter-spacing: 0.02em; }
/* ===================== */
/* Sidebar Ads           */
/* ===================== */
.ad-sidebar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-sidebar-right { right: 8px; }
.ad-sidebar-left  { left: 8px;  }

@media (max-width: 1460px) {
    .ad-sidebar-right { right: 4px; }
    .ad-sidebar-left  { left: 4px;  }
}

@media (max-width: 1320px) {
    .ad-sidebar { display: none; }
}
