/* ═══════════════════════════════════════════════════════════════════
   Math Playground — tile grid + widget launcher
   ═══════════════════════════════════════════════════════════════════ */

.ama-playground-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 980px;
    margin: 0 auto;
    padding: 0;
}

/* ── Header ──────────────────────────────────────────────────────── */
.amp-header {
    text-align: center;
    padding: 32px 20px 24px;
}
.amp-header-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: #1a4171;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}
.amp-header-sub {
    font-size: 1rem;
    color: #64748b;
    font-weight: 500;
}

/* ── Tile grid ───────────────────────────────────────────────────── */
.amp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    padding: 0 16px 32px;
}

.amp-tile {
    background: #fff;
    border: 2px solid var(--amp-color-lt, #e2e8f0);
    border-radius: 18px;
    padding: 28px 20px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    -webkit-user-select: none;
    user-select: none;
}
.amp-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 32px rgba(0,0,0,0.12);
    border-color: var(--amp-color, #2E68A1);
}

.amp-tile-emoji {
    font-size: 2.6rem;
    line-height: 1;
    background: var(--amp-color-lt, #e4f3f9);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.amp-tile-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--amp-color, #1a4171);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.amp-tile-desc {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.4;
    flex: 1;
}

.amp-play-btn {
    margin-top: 6px;
    background: var(--amp-color, #2E68A1);
    color: #fff;
    border-radius: 10px;
    padding: 7px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.amp-tile:hover .amp-play-btn { opacity: 0.88; }

/* ── Back bar ────────────────────────────────────────────────────── */
.amp-back-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.amp-back-btn {
    background: #2E68A1;
    border: none;
    color: #fff;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.14s;
    white-space: nowrap;
    flex-shrink: 0;
}
.amp-back-btn:hover { background: #1a4171; }

.amp-back-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #475569;
}

/* ── Widget wrap ─────────────────────────────────────────────────── */
.amp-widget-wrap {
    /* Let each widget control its own max-width / height */
}

/* ── Inside student portal ───────────────────────────────────────── */
#ama-student-section-playground {
    padding: 0 4px;
}
#ama-student-section-playground .ama-playground-container {
    max-width: 100%;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .amp-grid { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 10px 24px; }
    .amp-tile { padding: 20px 14px 16px; }
    .amp-tile-emoji { width: 56px; height: 56px; font-size: 2rem; }
    .amp-header-title { font-size: 1.4rem; }
}
@media (max-width: 380px) {
    .amp-grid { grid-template-columns: 1fr; }
}
