/* ============================================================
   QalBeQal authenticated app shell.
   One coherent signed-in look: deep ink header, warm NEUTRAL
   ground (no coral, no cream), restrained copper/ember accents.
   Loaded by Views/Shared/_Layout.cshtml in all environments.
   Public landings use Layout = null and never load this file.
   ============================================================ */

:root {
    --ash-ink: #241f18;
    --ash-muted: #6b6459;
    --ash-ground: #f2f0ec;
    --ash-surface: #ffffff;
    --ash-line: #e4e0d8;
    --ash-line-soft: #ece9e3;
    --ash-copper: #a8571f;
    --ash-copper-deep: #8d4717;
    --ash-ember: #f0b56a;
    --ash-header: #171310;
    --ash-forest: #1f7a52;
    --ash-village: #bf4a2a;
    --ash-path: #a8571f;
    --ash-corner: #4a5d94;
    --ash-parent: #5b6a7e;
}

/* ---------- page frame: ground + sticky footer ---------- */

html {
    margin: 0;
    min-height: 100%;
    background: var(--ash-header);
}

body.ash-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--ash-ground);
    color: var(--ash-ink);
}

body.ash-body > noscript {
    display: none;
}

.ash-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ash-footer {
    margin-top: auto;
    padding: 18px clamp(14px, 4vw, 34px) 22px;
    background: var(--ash-header);
    border-top: 2px solid var(--ash-ember);
    color: #cfc4b4;
    font-size: .88rem;
    font-family: "Segoe UI", Arial, sans-serif;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: center;
}

.ash-footer a { color: #f0d9b8; font-weight: 700; text-decoration: none; }
.ash-footer a:hover { text-decoration: underline; }
.ash-footer .fidel { color: var(--ash-ember); font-family: Ebrima, Nyala, "Noto Sans Ethiopic", sans-serif; }

/* ---------- app nav ---------- */

.appnav {
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 10px 14px;
    padding: 9px clamp(12px, 3.5vw, 30px);
    background: var(--ash-header);
    border-bottom: 2px solid var(--ash-ember);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
    font-family: "Segoe UI", Arial, sans-serif;
}

.appnav-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    text-decoration: none;
    color: #fdf6ec;
    font-weight: 800;
    font-size: 1rem;
    flex: 0 0 auto;
}

.appnav-brand .fidel { color: var(--ash-ember); font-size: 1.2rem; font-family: Ebrima, Nyala, "Noto Sans Ethiopic", sans-serif; }

.appnav-menu { min-width: 0; flex: 1 1 auto; }

.appnav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.appnav-links::-webkit-scrollbar { display: none; }

.appnav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 8px;
    color: #ece2d2;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
}

.appnav-link:hover { background: rgba(240, 181, 106, .14); color: #fdf6ec; text-decoration: none; }

.appnav-link[aria-current="page"] {
    color: #2a1607;
    background: var(--ash-ember);
    border-color: #d99f4e;
}

.appnav :focus-visible { outline: 2px solid #fdf6ec; outline-offset: 2px; }

/* ---------- language dropdown (details/summary, no JS required) ---------- */

.langdd {
    position: relative;
    flex: 0 0 auto;
}

.langdd summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(236, 226, 210, .3);
    background: rgba(0, 0, 0, .25);
    color: #ece2d2;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    white-space: nowrap;
}

.langdd summary::-webkit-details-marker { display: none; }
.langdd summary::after { content: "\25BE"; font-size: .8em; color: var(--ash-ember); }
.langdd[open] summary::after { content: "\25B4"; }
.langdd summary:hover { border-color: rgba(236, 226, 210, .55); }

.langdd-flag { display: inline-block; line-height: 0; }
.langdd-flag svg { width: 21px; height: 14px; display: block; border-radius: 2px; }

.langdd-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    min-width: 190px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #221c15;
    border: 1px solid rgba(240, 181, 106, .4);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
}

.langdd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #ece2d2;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
}

.langdd-item:hover { background: rgba(240, 181, 106, .14); color: #fdf6ec; text-decoration: none; }

.langdd-item[aria-current="true"] {
    background: rgba(240, 181, 106, .22);
    color: #ffe9c8;
}

.langdd-item[aria-current="true"]::after { content: "\2713"; margin-left: auto; color: var(--ash-ember); }

/* ---------- identity chip: who is signed in (Admin / Parent / Child) ---------- */

.whodd {
    position: relative;
    font-family: "Segoe UI", Arial, sans-serif;
}

.whodd summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 4px 10px 4px 5px;
    border: 1px solid rgba(236, 226, 210, .3);
    border-radius: 10px;
    color: #ece2d2;
    font-size: .9rem;
    font-weight: 700;
    user-select: none;
}

.whodd summary::-webkit-details-marker { display: none; }
.whodd summary::after { content: "\25BE"; font-size: .8em; color: var(--ash-ember); }
.whodd[open] summary::after { content: "\25B4"; }
.whodd summary:hover { border-color: rgba(236, 226, 210, .55); }

.whodd-role {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 7px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    background: rgba(240, 181, 106, .18);
    color: var(--ash-ember);
}

.whodd-role-admin { background: rgba(191, 74, 42, .28); color: #f4c1ae; }
.whodd-role-child { background: rgba(31, 122, 82, .3); color: #a9dfc4; }

.whodd-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whodd-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    margin: 0;
    padding: 6px;
    list-style: none;
    min-width: 210px;
    background: #241d15;
    border: 1px solid rgba(240, 181, 106, .4);
    border-radius: 12px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .38);
}

.whodd-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 10px;
    border-bottom: 1px solid rgba(236, 226, 210, .16);
    margin-bottom: 4px;
}

.whodd-meta-role { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ash-ember); font-weight: 800; }
.whodd-meta-name { color: #ece2d2; font-size: .88rem; overflow-wrap: anywhere; }

.whodd-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 8px;
    color: #ece2d2;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
}

.whodd-item:hover { background: rgba(240, 181, 106, .14); color: #fdf6ec; text-decoration: none; }

.appnav-note {
    margin: 0;
    padding: 7px clamp(12px, 3.5vw, 30px);
    background: #241d15;
    color: #dcccb2;
    font-size: .86rem;
    font-style: italic;
    border-bottom: 1px solid rgba(240, 181, 106, .35);
    font-family: "Segoe UI", Arial, sans-serif;
}

@media (max-width: 720px) {
    .appnav { gap: 8px 10px; padding: 8px 12px; }
    .langdd { order: 2; margin-left: auto; }
    .langdd-name { display: none; } /* flag-only trigger on small screens */
    .whodd { order: 2; }
    .whodd-name { display: none; }  /* role-only chip on small screens */
    .appnav-menu { order: 3; flex-basis: 100%; }
    .appnav-links { gap: 4px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
    .appnav-link { font-size: .88rem; padding: 6px 10px; }
}

/* ---------- registry game tiles: one deterministic visual system ----------
   Overrides the legacy HomeMenu.css tile look. Tiles keep .buttonWrapper and
   data-url so the existing HomeMenu.js click binding still works. */

.registry-menu-shell {
    width: min(1240px, calc(100% - 28px));
    margin: 10px auto 44px;
    color: var(--ash-ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

.registry-menu-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px 22px;
    background: var(--ash-surface);
    border: 1px solid var(--ash-line);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(40, 32, 20, .06);
}

.registry-menu-hero h1 { margin: 0; color: var(--ash-ink); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 900; line-height: 1.08; }
.registry-menu-kicker { margin: 0 0 4px; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ash-copper); }
.registry-menu-subtitle { margin: 6px 0 0; color: var(--ash-muted); font-size: .92rem; max-width: 72ch; }

.registry-menu-count {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--ash-header);
    color: #fdf6ec;
    border: 2px solid var(--ash-ember);
}

.registry-menu-count span { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.registry-menu-count small { font-size: .72rem; color: #d8c9ae; }

.registry-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.buttonWrapper.registry-game-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 0;
    border: 1px solid var(--ash-line);
    border-radius: 14px;
    background: var(--ash-surface);
    box-shadow: 0 4px 12px rgba(40, 32, 20, .06);
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    font-family: "Segoe UI", Arial, sans-serif;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.buttonWrapper.registry-game-card:hover,
.buttonWrapper.registry-game-card:focus-visible {
    transform: translateY(-2px);
    border-color: #d9c39f;
    box-shadow: 0 10px 22px rgba(40, 32, 20, .13);
    outline: none;
}

.buttonWrapper.registry-game-card:focus-visible { outline: 2px solid var(--ash-copper); outline-offset: 2px; }

.gtile-visual {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    width: 100%;
    overflow: hidden;
    border-bottom: 3px solid var(--gtile-accent, var(--ash-copper));
}

.gtile-visual img,
.gtile-visual svg { display: block; width: 100%; height: 100%; object-fit: cover; }

.gtile-copy { display: grid; gap: 2px; padding: 10px 12px 12px; }
.gtile-title { font-weight: 800; font-size: .95rem; color: var(--ash-ink); line-height: 1.25; overflow-wrap: anywhere; }
.gtile-area {
    justify-self: start;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gtile-accent, var(--ash-copper));
}

.gtile-forest { --gtile-accent: var(--ash-forest); }
.gtile-village { --gtile-accent: var(--ash-village); }
.gtile-path { --gtile-accent: var(--ash-path); }
.gtile-corner { --gtile-accent: var(--ash-corner); }
.gtile-general { --gtile-accent: var(--ash-parent); }

/* ---------- admin pages: bring them onto the shell ---------- */

.adminx {
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(18px, 3vw, 32px) clamp(14px, 4vw, 34px) 44px;
    color: var(--ash-ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

.adminx-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.adminx-title { margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.1rem); font-weight: 900; }
.adminx-tag {
    display: inline-flex; align-items: center; min-height: 26px; padding: 3px 10px;
    border-radius: 8px; background: #efe4f0; color: #6b3a74; font-size: .78rem;
    font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.adminx-sub { margin: 0 0 16px; color: var(--ash-muted); }

.adminx-card {
    background: var(--ash-surface);
    border: 1px solid var(--ash-line);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 6px 18px rgba(40, 32, 20, .06);
}

.adminx-table { width: 100%; border-collapse: collapse; }
.adminx-table th { text-align: left; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ash-muted); padding: 8px 12px; border-bottom: 2px solid var(--ash-line); }
.adminx-table td { padding: 10px 12px; border-bottom: 1px solid var(--ash-line-soft); overflow-wrap: anywhere; }

.adminx-badge {
    display: inline-block; padding: 3px 9px; border-radius: 8px;
    background: #efe9df; color: #6b5233; font-weight: 700; font-size: .82rem;
}

.adminx-back { font-weight: 800; color: var(--ash-copper); text-decoration: none; }
.adminx-back:hover { text-decoration: underline; }

/* account-type badges + user management form */
.adminx-badge-admin { background: #f6e3dc; color: #8d3117; }
.adminx-badge-child { background: #e2efe8; color: #1f6a49; }
.adminx-badge-parent { background: #e8ebf3; color: #45537a; }

.adminx-status {
    margin: 0 0 14px; padding: 10px 14px; border-radius: 10px;
    border: 1px solid #b9dec0; background: #ecf8ee; color: #245b2f; font-weight: 700;
}

.adminx-errors {
    margin: 0 0 14px; padding: 10px 14px; border-radius: 10px;
    border: 1px solid #eccdc4; background: #fbeae6; color: #a32c12;
}
.adminx-errors ul { margin: 0 0 0 18px; padding: 0; }

.adminx-search { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }

.adminx-input {
    min-height: 44px; padding: 9px 13px; font-size: .96rem;
    border: 1px solid #d0cabd; border-radius: 10px; background: #fff; color: var(--ash-ink);
    max-width: 100%;
}
.adminx-input:focus-visible { outline: 2px solid var(--ash-copper); outline-offset: 1px; }
.adminx-search .adminx-input { flex: 0 1 340px; }

.adminx-btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
    padding: 9px 16px; border-radius: 10px; font-weight: 800; font-size: .93rem; cursor: pointer;
    background: #f6f5f2; color: #4a453c; border: 1px solid #d8d3c8; text-decoration: none;
}
.adminx-btn:hover { background: #edebe5; }
.adminx-btn-primary { background: var(--ash-copper); border-color: var(--ash-copper-deep); color: #fff; }
.adminx-btn-primary:hover { background: #b96526; }

.adminx-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 14px; align-items: start; }
@media (max-width: 860px) { .adminx-grid { grid-template-columns: 1fr; } }

.adminx-fieldset { border: 1px solid var(--ash-line); border-radius: 12px; padding: 14px 16px 16px; margin: 0 0 16px; }
.adminx-legend { font-weight: 900; font-size: .95rem; padding: 0 6px; }

.adminx-check { display: flex; align-items: flex-start; gap: 9px; margin: 8px 0; font-size: .94rem; cursor: pointer; }
.adminx-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ash-copper); }

.adminx-field { margin-top: 12px; }
.adminx-label { display: block; font-weight: 800; font-size: .9rem; margin-bottom: 5px; }
.adminx-hint { margin: 8px 0 0; font-size: .84rem; color: var(--ash-muted); }
.adminx-side-title { margin: 0 0 10px; font-size: 1.08rem; font-weight: 900; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0;
}
