/* The game page's info panels (About, Directions, Algos, Nova Data), in the
   home page's language -- public/home.css's tokens, the simulation's phase
   gradient, cyan eyebrows, gradient-edged cards. Behaviour in game-info.js.
   Everything is scoped to .gi-* so the game's own styles are untouched. */

.gi-backdrop,
.gi-panel {
    --gi-bg:    #0a0b0d;
    --gi-raise: #111318;
    --gi-card:  #14161c;
    --gi-line:  #23262e;
    --gi-text:  #e8eaef;
    --gi-dim:   #9aa1ad;
    --gi-mute:  #6b7280;
    --gi-p0:    #ff3366;
    --gi-mid:   #b05cc4;
    --gi-p1:    #35e8e0;
    --gi-grad:  linear-gradient(100deg, var(--gi-p0), var(--gi-mid) 55%, var(--gi-p1));
}

.gi-backdrop[hidden],
.gi-panel[hidden] { display: none !important; }

/* Above the drawer (960), the dock and the visitor banner (10001): a panel
   the player opened is read on top of everything. */
.gi-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(5, 6, 8, 0.66);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
}

html.gi-open, html.gi-open body { overflow: hidden; }

.gi-panel {
    position: fixed;
    z-index: 10050;
    top: 50%;
    left: 50%;
    width: min(680px, calc(100vw - 32px));
    max-height: min(86vh, 860px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--gi-text);
    background: var(--gi-raise);
    border: 1px solid var(--gi-line);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(53, 232, 224, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
    line-height: 1.55;
    text-align: left;
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(.985);
    transition: opacity .2s ease, transform .2s ease;
}
.gi-panel.is-open { opacity: 1; transform: translate(-50%, -50%); }
@media (prefers-reduced-motion: reduce) {
    .gi-panel { transition: none; }
}
/* The phase gradient as a hairline across the top. */
.gi-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--gi-grad);
}

.gi-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    font-family: inherit;
    font-size: 22px;
    line-height: 1;
    color: var(--gi-dim);
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 50%;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}
.gi-close:hover { color: var(--gi-text); border-color: var(--gi-p1); }
.gi-close:focus-visible,
.gi-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(53, 232, 224, 0.35);
}

.gi-head {
    padding: 28px 64px 20px 26px;
    background: linear-gradient(160deg, var(--gi-card), var(--gi-raise) 70%);
    border-bottom: 1px solid var(--gi-line);
}
.gi-eyebrow {
    margin: 0 0 8px;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gi-p1);
}
.gi-panel h2 {
    margin: 0;
    font-size: clamp(1.35rem, 3.4vw, 1.8rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
    color: var(--gi-text);
}
.gi-lede {
    margin: 10px 0 0;
    max-width: 60ch;
    font-size: 0.98rem;
    color: var(--gi-dim);
}
.gi-zero-one {
    background: var(--gi-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 600;
    white-space: nowrap;
}

.gi-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px 18px;
    scrollbar-color: var(--gi-line) transparent;
}
.gi-body > * + * { margin-top: 16px; }

.gi-section {
    margin: 22px 0 10px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gi-p1);
}
.gi-body > .gi-section:first-child { margin-top: 0; }
.gi-muted { margin: 0; color: var(--gi-mute); }

/* About: feature cards with the home page's gradient rail. */
.gi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}
.gi-card {
    position: relative;
    padding: 14px 16px 14px 18px;
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 12px;
    overflow: hidden;
}
.gi-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--gi-p0), var(--gi-p1));
    opacity: .8;
}
.gi-card h3 { margin: 0 0 4px; font-size: 0.98rem; font-weight: 650; color: var(--gi-text); }
.gi-card p  { margin: 0; font-size: 0.9rem; color: var(--gi-dim); }

/* Directions: a real sequence, so numbered. */
.gi-steps {
    list-style: none;
    counter-reset: gi-step;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gi-steps li {
    counter-increment: gi-step;
    position: relative;
    padding: 12px 14px 12px 54px;
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 12px;
    color: var(--gi-dim);
}
.gi-steps li::before {
    content: counter(gi-step);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #07080a;
    background: var(--gi-grad);
    border-radius: 50%;
}
.gi-steps strong { color: var(--gi-text); font-weight: 600; }
.gi-steps em { color: var(--gi-p1); font-style: normal; }

/* Algos: rules as term / description rows. */
.gi-rules { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gi-rules > div {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 14px;
    padding: 11px 14px;
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 11px;
}
.gi-rules dt { font-weight: 600; color: var(--gi-text); }
.gi-rules dd { margin: 0; color: var(--gi-dim); font-size: 0.94rem; }
.gi-points { margin: 0; padding-left: 1.1em; color: var(--gi-dim); }
.gi-points li { margin: 4px 0; }
.gi-points li::marker { color: var(--gi-p1); }

/* Nova Data */
.gi-stats {
    display: grid;
    /* Six figures: three by two, or two by three on a phone -- auto-fit
       left a 4 + 2 row with a hole in it. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.gi-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 12px;
}
.gi-stat-v {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--gi-text);
}
.gi-stat:first-child .gi-stat-v {
    background: var(--gi-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.gi-stat-k {
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gi-mute);
}
.gi-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gi-recent li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 9px 14px;
    background: var(--gi-card);
    border: 1px solid var(--gi-line);
    border-radius: 10px;
    font-size: 0.88rem;
}
.gi-recent-main { display: flex; align-items: center; gap: 8px; }
.gi-recent-id { color: var(--gi-mute); font-variant-numeric: tabular-nums; }
.gi-recent-nums { display: flex; gap: 14px; justify-content: flex-end; color: var(--gi-dim); font-variant-numeric: tabular-nums; }
.gi-recent-at { color: var(--gi-mute); font-size: 0.8rem; white-space: nowrap; }
.gi-chip {
    padding: 2px 9px;
    font-size: 0.74rem;
    color: #c6fbf8;
    background: rgba(53, 232, 224, 0.09);
    border: 1px solid rgba(53, 232, 224, 0.32);
    border-radius: 999px;
}

/* Actions */
.gi-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 26px 20px;
    border-top: 1px solid var(--gi-line);
    background: var(--gi-raise);
}
.gi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--gi-text);
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.gi-btn-primary { background: var(--gi-grad); color: #07080a; }
.gi-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(53, 232, 224, 0.22); }
.gi-btn-ghost { border-color: var(--gi-line); }
.gi-btn-ghost:hover { border-color: var(--gi-p1); background: rgba(53, 232, 224, 0.06); }

/* Phones: a bottom sheet. */
@media (max-width: 600px) {
    .gi-panel {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        /* Leaves a strip of the game above it to tap back into. */
        max-height: 80vh;
        border-radius: 18px 18px 0 0;
        border-bottom: none;
        transform: translateY(24px);
    }
    .gi-panel.is-open { transform: none; }
    .gi-head { padding: 22px 56px 16px 16px; }
    .gi-body { padding: 18px 16px 14px; }
    .gi-actions { padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .gi-actions .gi-btn { flex: 1 1 auto; }
    .gi-rules > div { grid-template-columns: 1fr; gap: 2px; }
    .gi-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gi-recent li { grid-template-columns: 1fr auto; }
    .gi-recent-nums { grid-column: 1 / -1; justify-content: flex-start; order: 3; }
}

/* A tile that is a link (the Nova Data popout, 2026-10-13): the whole tile, no underline. */
.gi-stat-link { display: block; color: inherit; text-decoration: none; }
.gi-stat-link:hover .gi-stat { border-color: var(--gi-p1); }
.gi-stat-link .gi-stat-v { color: var(--gi-text); }
