/* Training companion — sprite-based pixel character, shown in two presentations that share
 * markup/canvas logic (companion-device.js):
 *   .companion-device     — the full "training link" handheld, /Progression/Companion only.
 *   .companion-mini       — plain compact version for the dashboard greeting card, styled in
 *                            the card's own white-on-navy language instead of the device frame.
 */

/* ── Full device (Companion detail page) ─────────────────────────────────────────────────── */

.companion-device {
    --cd-ink: #1b2436;
    --cd-lcd: #ffffff;
    --cd-lcd2: #e8edf5;
    --cd-accent: #fbbf24;   /* on-screen accent (XP bar, streak) — ties to the amber used elsewhere for XP */
    --cd-rim: #38bdf8;      /* case accent (rim glow, signal dots) — cool, distinct from the screen */
    width: min(100%, 300px);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    color: #cbd5e1;
}

.companion-device .cd-case {
    position: relative;
    border: 1px solid rgba(56, 189, 248, .35);
    border-radius: 26px;
    padding: 10px;
    background: linear-gradient(160deg, #1b2436, #090c13 70%);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, .55),
        0 0 0 1px rgba(56, 189, 248, .12),
        0 0 24px rgba(56, 189, 248, .12),
        inset 0 1px rgba(255, 255, 255, .08);
}
/* Faint top sheen — the one "glossy" touch that keeps the case from reading flat-matte */
.companion-device .cd-case::before {
    content: "";
    position: absolute; inset: 1px 1px auto 1px; height: 40%;
    border-radius: 25px 25px 60% 60% / 25px 25px 30px 30px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), transparent);
    pointer-events: none;
}

.companion-device .cd-header,
.companion-device .cd-footer {
    position: relative; z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 6px 8px;
    font-size: 9px;
    letter-spacing: .12em;
    color: #7d8aa3;
}
.companion-device .cd-footer { padding: 8px 6px 2px; }
.companion-device .cd-signal { color: var(--cd-rim); text-shadow: 0 0 6px rgba(56, 189, 248, .6); }

.companion-device .cd-lcd {
    position: relative;
    overflow: hidden;
    border: 5px solid #0a0d14;
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(160deg, var(--cd-lcd), var(--cd-lcd2));
    color: var(--cd-ink);
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, .08), 0 0 0 2px #1c2433;
}
/* Diagonal glass highlight instead of the old dark-green CRT scanlines — a white screen reads
 * as glass/OLED, not phosphor, so the texture changes with it. */
.companion-device .cd-scanlines {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, rgba(255, 255, 255, .5) 0%, transparent 22%);
    opacity: .5;
}

.companion-device .cd-level-row {
    position: relative; z-index: 1;
    display: flex; justify-content: space-between; align-items: flex-start;
}
.companion-device .cd-level-row small { display: block; font-size: 8px; letter-spacing: .16em; color: #64748b; }
.companion-device .cd-level-row strong { font-size: 22px; line-height: 1; }
.companion-device .cd-stage { text-align: right; }
.companion-device .cd-stage strong { font-size: 12px; }

.companion-device canvas {
    display: block;
    width: min(48vw, 176px); height: min(48vw, 176px);
    max-width: 176px; max-height: 176px;
    margin: -2px auto 10px;
    image-rendering: pixelated;
    border-radius: 6px;
}

.companion-device h5.cd-title {
    position: relative; z-index: 1; margin: 0; min-height: 16px;
    text-align: center; font-size: 12px; line-height: 1.2; letter-spacing: .08em; font-weight: 700;
}
.companion-device .cd-message {
    position: relative; z-index: 1; min-height: 22px; margin: 5px 0 10px;
    text-align: center; font-size: 9px; color: #475569;
}

.companion-device .cd-xp-label { position: relative; z-index: 1; display: flex; justify-content: space-between; font-size: 9px; font-weight: bold; }
.companion-device .cd-xp-track { position: relative; z-index: 1; height: 8px; margin-top: 4px; border: 2px solid var(--cd-ink); padding: 1px; border-radius: 3px; }
.companion-device .cd-xp-track span { display: block; height: 100%; background: var(--cd-accent); border-radius: 1px; transition: width .35s ease; }

.companion-device .cd-today { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 4px; margin-top: 10px; font-size: 7.5px; font-weight: bold; }
.companion-device .cd-today span { opacity: .5; }
.companion-device .cd-today .cd-done { opacity: 1; color: #16a34a; }

@media (max-width: 420px) {
    .companion-device { width: 100%; }
}

/* Large variant — the dedicated companion detail page. Today's checklist doesn't apply there
 * (it's a profile view, not "today"), so it's hidden rather than shown as three false checks. */
.companion-device--large { width: min(100%, 420px); }
.companion-device--large canvas {
    width: min(70vw, 256px); height: min(70vw, 256px); max-width: 256px; max-height: 256px;
}
.companion-device--large .cd-level-row strong { font-size: 30px; }
.companion-device--large h5.cd-title { font-size: 15px; }
.companion-device--large .cd-message { font-size: 11px; min-height: 26px; }
.companion-device--large .cd-today { display: none; }

/* ── Mini companion (dashboard greeting card) ────────────────────────────────────────────── */

.companion-mini-canvas {
    width: 64px; height: 64px;
    flex-shrink: 0;
    image-rendering: pixelated;
    /* No background tile — the sprite sheet is already transparent outside the figure, so it
     * sits directly on the card's gradient instead of reading as a separate chip. */
}

.companion-mini-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 14px;
    transition: opacity .15s ease, transform .15s ease;
}
.companion-mini-link:hover,
.companion-mini-link:focus-visible {
    opacity: .85;
    transform: translateY(-1px);
}
.companion-mini-link:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: 3px; }
