/* ============================================================
   2048 — Warm Tiles Theme
   Accent: #f97316 (orange)   Warm: #fbbf24
   Font: Syne (display) · DM Sans (body) · JetBrains Mono (data)
   ============================================================ */

/* ── 2048 Layout (3-column) ── */
.tf-layout {
    display: grid;
    grid-template-areas:
        "top top top"
        "left game right"
        "bottom bottom bottom";
    grid-template-columns: 160px 1fr 160px;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    background: #1a1408;
    color: #e0d6c8;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.tf-layout .ad-slot--top    { grid-area: top; }
.tf-layout .ad-slot--left   { grid-area: left; }
.tf-layout .ad-slot--right  { grid-area: right; }
.tf-layout .ad-slot--bottom { grid-area: bottom; }

.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.ad-placeholder {
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.15);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.ad-placeholder--vertical {
    writing-mode: vertical-lr;
    padding: 24px 12px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tf-app {
    grid-area: game;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 24px;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* ── Header ── */
.tf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 420px;
    gap: 12px;
}

.tf-title {
    font-family: 'Syne', sans-serif;
    font-size: 42px;
    font-weight: 800;
    color: #f97316;
    text-shadow: 0 2px 8px rgba(249,115,22,0.3);
    margin: 0;
    letter-spacing: -1px;
}

.tf-scores {
    display: flex;
    gap: 8px;
}

.tf-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(249,115,22,0.15);
    border-radius: 8px;
    padding: 6px 16px;
    min-width: 72px;
}

.tf-score-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(249,115,22,0.6);
    font-weight: 600;
}

.tf-score-value {
    font-size: 20px;
    font-weight: 700;
    color: #f97316;
}

/* ── Controls ── */
.tf-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 420px;
}

.tf-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.tf-control-group select {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #e0d6c8;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.tf-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tf-btn--primary {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #1a1408;
    margin-left: auto;
}
.tf-btn--primary:hover {
    background: linear-gradient(135deg, #fb923c, #f97316);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249,115,22,0.3);
}

.tf-btn--secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #e0d6c8;
}
.tf-btn--secondary:hover {
    background: rgba(255,255,255,0.12);
}

/* ── Canvas ── */
.tf-canvas-wrap {
    position: relative;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 60px rgba(249,115,22,0.08);
}

#gameCanvas {
    display: block;
    background: #1a1408;
    touch-action: none;
    max-width: 100%;
    height: auto;
}

/* ── Mobile arrow controls ── */
.tf-mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.tf-arrow-row {
    display: flex;
    gap: 4px;
}

.tf-arrow-btn {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(249,115,22,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #f97316;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.tf-arrow-btn:active {
    background: rgba(249,115,22,0.15);
    transform: scale(0.95);
}

/* ── Volume ── */
.tf-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}
.tf-volume-control input[type="range"] {
    width: 80px;
    accent-color: #f97316;
}

/* ── Info ── */
.tf-info {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    max-width: 420px;
}
.tf-info p {
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .tf-layout {
        grid-template-areas:
            "top"
            "game"
            "bottom";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .ad-slot--left, .ad-slot--right {
        display: none;
    }
    .tf-mobile-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    .tf-title {
        font-size: 32px;
    }
    .tf-score-box {
        padding: 4px 10px;
        min-width: 56px;
    }
    .tf-score-value {
        font-size: 16px;
    }
    #gameCanvas {
        max-width: calc(100vw - 32px);
    }
}
