/* ==========================================================================
   Slovko — global styles: font, design tokens, mobile-safe base reset, boot screen.
   Component styles live next to their components (*.razor.css, scoped).
   ========================================================================== */

/* Nunito (variable, SIL OFL 1.1) — vendored, Cyrillic + Latin subsets. */
@font-face {
    font-family: 'Nunito Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 200 1000;
    src: url(../fonts/nunito-cyrillic-ext-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Nunito Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 200 1000;
    src: url(../fonts/nunito-cyrillic-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Nunito Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 200 1000;
    src: url(../fonts/nunito-latin-ext-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Nunito Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 200 1000;
    src: url(../fonts/nunito-latin-wght-normal.woff2) format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Typography */
    --font-main: 'Nunito Variable', 'Nunito', ui-rounded, 'Segoe UI', system-ui, sans-serif;

    /* Lija (fox) palette — matches the emoji reference */
    --c-fox: #f4900c;
    --c-fox-light: #ffb347;
    --c-fox-dark: #d9730a;
    --c-ear: #a0041e;
    --c-cream: #ffe8b6;
    --c-ink: #292f33;

    /* UI palette */
    --c-text: #3d2a1c;          /* warm dark brown for text on light surfaces */
    --c-text-soft: #7a5a43;
    --c-surface: #fffaf0;       /* card / bubble surface */
    --c-surface-edge: #f1dcc0;
    --c-sky-top: #8fd3ff;
    --c-sky-bottom: #e6f7ff;
    --c-grass: #8fd16a;
    --c-grass-dark: #5fae45;
    --c-gold: #ffc93c;
    --c-gold-dark: #f29f05;
    --c-xp: #5ad1ff;
    --c-xp-dark: #1f9bd6;

    /* Menu area colours (top → bottom gradient stops) */
    --c-forest-1:   #81c784;  --c-forest-2:   #43a047;   /* Игре (games) */
    --c-city-1:     #ff8a65;  --c-city-2:     #f4511e;   /* Слова (letters) */
    --c-beach-1:    #64b5f6;  --c-beach-2:    #1e88e5;   /* Слогови (syllables) */
    --c-mountain-1: #b39ddb;  --c-mountain-2: #7e57c2;   /* Речи (words) */
    --c-space-1:    #7986cb;  --c-space-2:    #3949ab;   /* Реченице (sentences) */

    /* Shape & depth */
    --radius-s: 12px;
    --radius-m: 20px;
    --radius-l: 28px;
    --shadow-soft: 0 6px 18px rgba(61, 42, 28, 0.18);
    --shadow-pop: 0 4px 0 rgba(0, 0, 0, 0.18), 0 10px 22px rgba(61, 42, 28, 0.22);

    /* Safe areas (notch / home indicator) */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);

    /* Stacking order of the home screen layers */
    --z-backdrop: 0;
    --z-stage: 10;
    --z-bubble: 15;
    --z-hud: 20;
    --z-effects: 30;
    --z-modal: 40;

    /* Motion */
    --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* Home-screen layout bands (phone portrait first). The companion stage is the box left between them.
       --hud-top-h: top bar band below safe-area-top; --dock-h: bottom menu band above safe-area-bottom;
       --dock-w: right-hand menu rail (only when the dock turns vertical in phone landscape). */
    --hud-top-h: 84px;
    --dock-h: 124px;
    --dock-w: 0px;
}

/* Phone landscape: short screen → the menu becomes a vertical rail on the right. */
@media (orientation: landscape) and (max-height: 560px) {
    :root {
        --hud-top-h: 64px;
        --dock-h: 0px;
        --dock-w: 116px;
    }
}

/* Tablets / desktop: more room for bigger HUD and buttons. */
@media (min-width: 768px) and (min-height: 700px) {
    :root {
        --hud-top-h: 100px;
        --dock-h: 156px;
    }
}

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

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: var(--font-main);
    font-weight: 700;
    color: var(--c-text);
    background: linear-gradient(180deg, var(--c-sky-top) 0%, var(--c-sky-bottom) 60%, var(--c-grass) 60%, var(--c-grass-dark) 100%);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

#app {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;      /* fallback */
    height: 100dvh;
    overflow: hidden;
}

button {
    font: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:focus {
    outline: none;
}

button:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

img,
svg,
canvas {
    -webkit-user-drag: none;
    user-select: none;
}

/* --------------------------------------------------------------------------
   Boot screen (shown while the WebAssembly runtime downloads)
   -------------------------------------------------------------------------- */
.boot {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: radial-gradient(120% 80% at 50% 20%, #fff6e3 0%, #ffd9a0 55%, #ffb871 100%);
}

.boot__logo {
    display: flex;
    gap: 2px;
    font-size: clamp(44px, 14vw, 84px);
    font-weight: 900;
    letter-spacing: 1px;
}

.boot__logo span {
    display: inline-block;
    color: var(--c-fox);
    text-shadow: 0 4px 0 var(--c-fox-dark), 0 10px 18px rgba(160, 4, 30, 0.25);
    animation: boot-hop 1.2s var(--ease-pop) infinite;
}

.boot__logo span:nth-child(2) { animation-delay: 0.1s; color: #ef6c4a; }
.boot__logo span:nth-child(3) { animation-delay: 0.2s; color: #3fa9f5; }
.boot__logo span:nth-child(4) { animation-delay: 0.3s; color: #6cc04a; }
.boot__logo span:nth-child(5) { animation-delay: 0.4s; color: #9b6cd6; }
.boot__logo span:nth-child(6) { animation-delay: 0.5s; color: #f4b400; }

@keyframes boot-hop {
    0%, 60%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-14px) scale(1.06); }
}

.boot__bar {
    width: min(260px, 64vw);
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 2px 4px rgba(61, 42, 28, 0.15);
    overflow: hidden;
}

.boot__fill {
    height: 100%;
    width: var(--blazor-load-percentage, 4%);
    min-width: 8%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--c-fox-light), var(--c-fox));
    transition: width 0.2s ease-out;
}

.boot__text {
    font-size: 18px;
    color: var(--c-text-soft);
}

/* --------------------------------------------------------------------------
   Blazor error UI
   -------------------------------------------------------------------------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #fff3cd;
    color: var(--c-text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem calc(0.8rem + var(--safe-bottom)) 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .reload {
    color: #c62828;
    margin-left: 8px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.9rem;
    top: 0.6rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Упс! Нешто није у реду.";
}
