/* =========================================================
   Brainygaming — Base (Light two-color, kid-friendly)
   CLEAN • ORDERED • BUTTONS FIXED (no underline)
   ========================================================= */

/* ========== 1) DESIGN TOKENS ========== */
:root {
    /* Palette */
    --bg: #f8faff;
    --surface: #ffffff;
    --card: #ffffff;

    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;

    --brand: #3b82f6; /* Sky Blue */
    --accent: #22c55e; /* Mint Green */
    --brand-rgb: 59, 130, 246;
    --accent-rgb: 34, 197, 94;

    /* Soft tints */
    --brand-10: #eff6ff;
    --brand-20: #e5f0ff;
    --accent-10: #edfcf4;
    --accent-20: #e3faee;

    /* Layout */
    --radius: 18px;
    --shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
    --transition: 0.15s ease;

    /* Sidebar gradient */
    --sidebar-start: var(--brand-10);
    --sidebar-end: var(--accent-10);
}

/* ========== 2) BASE / RESET ========== */
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font-family: ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto,
        "Noto Kufi Arabic", Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(
            120px 60px at 8% 0%,
            rgba(var(--brand-rgb), 0.15),
            transparent 60%
        ),
        radial-gradient(
            120px 60px at 92% 0%,
            rgba(var(--accent-rgb), 0.15),
            transparent 60%
        ),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img,
svg,
video {
    display: block;
    max-width: 100%;
}
a {
    color: inherit;
}

/* Focus for accessibility */
:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ========== 3) HEADER ========== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.app-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.brand .brand-mark {
    font-size: 22px;
}
.brand .brand-name {
    font-weight: 800;
    letter-spacing: 0.2px;
}
.burger {
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform var(--transition), filter var(--transition);
}
.burger:hover {
    transform: translateY(-1px);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lang-switch .lang-btn {
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
}
.lang-switch .lang-btn.active {
    outline: 2px solid var(--brand);
}
.user-pic img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* ========== 4) APP SHELL LAYOUT ========== */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    padding: 16px;
}
.main {
    min-height: calc(100dvh - 96px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

/* ========== 5) SIDEBAR ========== */
.sidebar {
    position: sticky;
    top: 84px;
    height: calc(100dvh - 100px);
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: radial-gradient(
            14px 14px at 16% 10%,
            rgba(var(--brand-rgb), 0.18) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            12px 12px at 85% 20%,
            rgba(var(--accent-rgb), 0.16) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            10px 10px at 40% 78%,
            rgba(var(--brand-rgb), 0.12) 0 70%,
            transparent 71%
        ),
        linear-gradient(180deg, var(--sidebar-start), var(--sidebar-end));
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.side-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text);
    border-radius: 14px;
    background: linear-gradient(
        90deg,
        rgba(var(--brand-rgb), 0.12),
        rgba(var(--accent-rgb), 0.12)
    );
    border: 1px solid var(--border);
    margin-bottom: 6px;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-brand {
    background: var(--brand);
}
.dot-accent {
    background: var(--accent);
}
.side-brand-name {
    font-weight: 700;
}
.sidebar a {
    text-decoration: none;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition);
}
.sidebar a:hover,
.sidebar a.active {
    background: rgba(var(--brand-rgb), 0.1);
    border-color: var(--border);
}
.sidebar-foot {
    margin-top: auto;
    display: flex;
    gap: 8px;
}

/* ========== 6) BUTTONS (Underline removed) ========== */
/* Generic button that works for <button> and <a> */
.btn {
    --bg: #fff;
    --fg: #0b1b3a;
    --bd: var(--border);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--bd);
    background: var(--bg);
    color: var(--fg);
    text-decoration: none; /* <-- remove underline inside buttons */
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: transform var(--transition), filter var(--transition),
        box-shadow var(--transition);
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}
.btn .icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0) scale(0.98);
}
.btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.25);
}

.btn-primary {
    --bg: var(--brand);
    --fg: #fff;
    --bd: var(--brand);
}
.btn-accent {
    --bg: var(--accent);
    --fg: #fff;
    --bd: var(--accent);
}
.btn-ghost {
    --bg: #fff;
    --fg: #0b1b3a;
    --bd: var(--border);
}
.btn-outline {
    --bg: transparent;
    --fg: var(--brand);
    --bd: var(--brand);
}

.btn-sm {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.92rem;
}
.btn-lg {
    padding: 12px 16px;
    border-radius: 14px;
}
.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn[disabled],
.btn.is-disabled {
    opacity: 0.55;
    filter: grayscale(10%);
    cursor: not-allowed;
    transform: none;
}

/* Ensure anchors styled as buttons never show underline in any state */
a.btn:link,
a.btn:visited,
a.btn:hover,
a.btn:active {
    text-decoration: none;
}

/* ========== 7) TYPOGRAPHY / MISC ========== */
.link-back {
    color: var(--muted);
    text-decoration: none;
}
.link-back:hover {
    color: var(--text);
}
.section-title {
    margin: 0 0 8px;
    font-size: 18px;
}
.list {
    margin: 0;
    padding-inline-start: 18px;
    color: var(--muted);
}
.pattern-bubbles {
    background-image: radial-gradient(
            16px 16px at 20% 18%,
            rgba(var(--brand-rgb), 0.14) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            12px 12px at 80% 28%,
            rgba(var(--accent-rgb), 0.14) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            12px 12px at 40% 76%,
            rgba(var(--brand-rgb), 0.1) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            10px 10px at 70% 70%,
            rgba(var(--accent-rgb), 0.1) 0 70%,
            transparent 71%
        );
    background-repeat: no-repeat;
}

/* ========== 8) GAME HERO GRID ========== */
/* Banner + Meta + Start + About (with About under banner) */
.game-hero.game-hero--grid {
    display: grid;
    grid-template-columns: 2fr 1.1fr 1.1fr;
    grid-template-areas:
        "banner meta  start"
        "about  meta  start";
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}
.game-hero__banner {
    grid-area: banner;
}
.game-hero__meta {
    grid-area: meta;
}
.start-panel {
    grid-area: start;
}
.about-card {
    grid-area: about;
}

.game-hero__banner img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}
.game-title {
    margin: 0 0 6px;
    font-size: 24px;
}
.game-subtitle {
    margin: 0 0 12px;
    color: var(--muted);
}
.game-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 9) CARDS & SKILLS ========== */
.pro-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    background: #fff;
    box-shadow: var(--shadow);
}
.pro-card--brand {
    background: linear-gradient(180deg, var(--brand-10), #fff 55%);
    border-color: #d7e6ff;
}
.pro-card--accent {
    background: linear-gradient(180deg, var(--accent-10), #fff 55%);
    border-color: #cfefe1;
}
.pro-card--accent-strong {
    background: linear-gradient(180deg, var(--accent-20), #fff 55%);
    border-color: #bfead6;
}
.is-bubbly::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: radial-gradient(
            10px 10px at 15% 25%,
            rgba(var(--brand-rgb), 0.1) 0 70%,
            transparent 71%
        ),
        radial-gradient(
            8px 8px at 85% 65%,
            rgba(var(--accent-rgb), 0.1) 0 70%,
            transparent 71%
        );
}
.pro-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.pro-card__title {
    font-weight: 800;
    color: #0b1b3a;
}
.pro-card__icon.bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(var(--brand-rgb), 0.12);
}
.pro-card--accent .pro-card__icon {
    background: rgba(var(--accent-rgb), 0.12);
}
.icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}
.icon--brand {
    color: #1d4ed8;
}
.icon--accent {
    color: #15803d;
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}
.skill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(var(--brand-rgb), 0.06);
    color: var(--text);
}
.pro-card--accent .skill {
    background: rgba(var(--accent-rgb), 0.06);
}
.skill__icon .icon {
    width: 20px;
    height: 20px;
}

.kpi-card {
    text-align: center;
}
.kpi-card__label {
    color: var(--muted);
    font-size: 12px;
}
.kpi-card__value {
    font-size: 28px;
    font-weight: 900;
    color: #0b1b3a;
}

/* ========== 10) INPUTS ========== */
.input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

/* ========== 11) USER AVATAR & MENU ========== */
.user {
    position: relative;
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: #0b1b3a;
    display: grid;
    place-items: center;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.avatar--initial {
    background: linear-gradient(180deg, var(--brand-20), #fff);
}
.avatar__img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.avatar--sm {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 200px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    display: none;
}
.menu.open {
    display: block;
}
.menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, var(--brand-10), #fff 60%);
    margin-bottom: 6px;
}
.menu-name {
    font-weight: 700;
    color: #0b1b3a;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
}
.menu-item:hover {
    background: rgba(var(--brand-rgb), 0.08);
    border-color: var(--border);
}

/* ========== 12) MODAL (YouTube, etc.) ========== */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}
.modal.open {
    display: block;
}
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
}
.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(920px, 92vw);
    margin: 6vh auto;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.modal__close {
    position: absolute;
    top: 8px;
    inset-inline-end: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.modal__body {
    margin-top: 24px;
}
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
}
.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
body.modal-open {
    overflow: hidden;
}
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ========== 13) GRID HELPERS ========== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 16px 0;
}

/* ========== 14) RESPONSIVE ========== */
@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
    }
    .grid-3 {
        grid-template-columns: 1fr;
    }
}
@media (min-width: 1100px) {
    .start-panel {
        max-width: 420px;
    }
}

/* Collapse sidebar (optional) */
body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
}
body.sidebar-collapsed .sidebar {
    display: none;
}

/* ========== 15) RTL TWEAKS ========== */
html[dir="rtl"] .list {
    padding-inline-start: 0;
    padding-inline-end: 18px;
}
html[dir="rtl"] .game-subtitle {
    text-align: right;
}
