/* FriendDex: chibi game menu.
   Bead-black pixel frames on white windows, over a sky-blue "overworld". */

:root {
    --sky: #8ed1f2;
    --sky-deep: #74c3ea;
    --sky-pale: #e6f5fd;
    --paper: #ffffff;
    --ink: #1f1b1c;          /* matches the black outline beads in sprites */
    --ink-soft: #5b5456;
    --leaf: #5dbb4f;         /* likes, OK */
    --leaf-pale: #dcf3d6;
    --berry: #e8546e;        /* dislikes, delete */
    --berry-pale: #fde0e5;
    --sun: #ffc93c;          /* cursor, highlights */

    --font-pixel: "Pixelify Sans", ui-monospace, monospace;
    --font-body: "M PLUS Rounded 1c", system-ui, sans-serif;

    --px: 4px;               /* one "pixel" of frame */
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink);
    background-color: var(--sky);
    /* Soft checker like overworld grass tiles, made from two gradients */
    background-image:
        linear-gradient(45deg, var(--sky-deep) 25%, transparent 25%, transparent 75%, var(--sky-deep) 75%),
        linear-gradient(45deg, var(--sky-deep) 25%, transparent 25%, transparent 75%, var(--sky-deep) 75%);
    background-size: 48px 48px;
    background-position: 0 0, 24px 24px;
}

h1, h2, h3 { font-family: var(--font-pixel); line-height: 1.15; margin: 0 0 0.5rem; }
h1:focus { outline: none; }
p { margin: 0 0 0.75rem; }
a { color: var(--ink); }

:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }

/* ---------- Pixel window frame ----------
   Four hard shadows instead of a border give the notched, stepped corners of a game window. */
.win {
    position: relative;
    background: var(--paper);
    margin: var(--px);
    padding: 1.25rem;
    box-shadow:
        0 calc(-1 * var(--px)) 0 0 var(--ink),
        0 var(--px) 0 0 var(--ink),
        calc(-1 * var(--px)) 0 0 0 var(--ink),
        var(--px) 0 0 0 var(--ink),
        inset 0 calc(-1 * var(--px)) 0 0 #d7e9f3;
}

.win-title {
    font-size: 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.win + .win, .win + .grid-2, .grid-2 + .win { margin-top: 1.75rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1.75rem;
}

/* ---------- Buttons ---------- */
.px-btn {
    --btn-bg: var(--paper);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-pixel);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1;
    color: var(--ink);
    text-decoration: none;
    background: var(--btn-bg);
    border: 0;
    padding: 0.6rem 0.9rem;
    margin: 3px;
    cursor: pointer;
    box-shadow:
        0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink),
        -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink),
        inset 0 -3px 0 0 rgb(0 0 0 / 0.15);
}
.px-btn:hover { filter: brightness(1.05); }
.px-btn:active { transform: translateY(2px); box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink); }
.px-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.px-btn-sun { --btn-bg: var(--sun); }
.px-btn-leaf { --btn-bg: var(--leaf); color: var(--paper); text-shadow: 0 2px 0 rgb(0 0 0 / 0.25); }
.px-btn-berry { --btn-bg: var(--berry); color: var(--paper); text-shadow: 0 2px 0 rgb(0 0 0 / 0.25); }
.px-btn-sm { font-size: 0.85rem; padding: 0.45rem 0.65rem; }

.text-btn {
    font: inherit;
    font-size: 0.9rem;
    background: none;
    border: 0;
    padding: 0.25rem;
    color: var(--ink-soft);
    text-decoration: underline;
    cursor: pointer;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ---------- Form fields ---------- */
.field { margin-bottom: 1rem; }
.field label, .field-label {
    display: block;
    font-family: var(--font-pixel);
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.px-input, .px-select, .px-textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 0;
    padding: 0.55rem 0.7rem;
}
.px-input:focus, .px-select:focus, .px-textarea:focus {
    outline: none;
    background: var(--sky-pale);
    box-shadow: 0 0 0 3px var(--sun);
}
.px-textarea { resize: vertical; }

.validation-message { color: var(--berry); font-size: 0.9rem; margin-top: 0.3rem; font-weight: 700; }
.invalid { border-color: var(--berry); }

.error-text { color: var(--berry); font-weight: 700; font-size: 0.9rem; }
.muted { color: var(--ink-soft); }

/* ---------- Sprites ---------- */
.sprite { image-rendering: pixelated; display: block; }

/* ---------- Menu cursor (the ▶ that blinks next to the selected item) ---------- */
.has-cursor { position: relative; }
.has-cursor::before {
    content: "▶";
    position: absolute;
    left: -1.35rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sun);
    font-size: 1.1rem;
    text-shadow: 2px 0 var(--ink), -2px 0 var(--ink), 0 2px var(--ink), 0 -2px var(--ink);
    opacity: 0;
    pointer-events: none;
}
.has-cursor:hover::before, .has-cursor:focus-visible::before {
    opacity: 1;
    animation: cursor-blink 0.8s steps(2, jump-none) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }

/* Sprite hop when a new sprite appears */
.hop { animation: hop 0.5s steps(2, jump-none) 2; }
@keyframes hop { 50% { transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
    .has-cursor:hover::before, .has-cursor:focus-visible::before { animation: none; }
    .hop { animation: none; }
    .px-btn:active { transform: none; }
}

/* ---------- Blazor error boundary ---------- */
.blazor-error-boundary { background: var(--berry); padding: 1rem; color: var(--paper); }
.blazor-error-boundary::after { content: "Something went wrong on this part of the page."; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.small { font-size: 0.85rem; }

/* Like / dislike tags (used on the passport and in AI suggestions) */
.tag {
    display: inline-block;
    font-family: var(--font-pixel);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--sky-pale);
    border: 3px solid var(--ink);
    padding: 0.2rem 0.6rem;
    margin: 0 0.15rem 0.15rem 0;
}
.tag-like { background: var(--leaf-pale); }
.tag-dislike { background: var(--berry-pale); }
button.tag { cursor: pointer; }
button.tag:hover { filter: brightness(0.96); }
.tag-open { box-shadow: 0 3px 0 var(--ink); transform: translateY(-2px); }

/* Windows inside a grid are spaced by the grid gap, not by the stacking margin */
.grid-2 > .win, .grid-2 > .win + .win { margin: var(--px); }
