/* Hra Notová hliadka — celá obrazovka. Dva vzhľady: data-theme="castle" (predvolený) a "space". */
.ng-app {
    /* vesmír */
    --ng-bg: #050714;
    --ng-app-bg:
        radial-gradient(ellipse at 70% 20%, #16204a 0%, rgba(22, 32, 74, 0) 55%),
        radial-gradient(ellipse at 20% 90%, #1a0f3a 0%, rgba(26, 15, 58, 0) 50%),
        #050714;
    --ng-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ng-font-head: var(--ng-font);
    --ng-text: #e8f4ff;
    --ng-muted: #9db3d6;
    --ng-accent: #ffd447;
    --ng-accent2: #7af4ff;
    --ng-danger: #ff4766;
    --ng-ok: #74f0a6;
    --ng-line: rgba(120, 200, 255, 0.22);
    --ng-hud-bg: linear-gradient(rgba(5, 7, 20, 0.85), rgba(5, 7, 20, 0));
    --ng-hud-text: #e8f4ff;
    --ng-hud-sub: #7af4ff;
    --ng-icon-bg: rgba(16, 26, 58, 0.8);
    --ng-icon-text: #e8f4ff;
    --ng-progress-track: rgba(120, 200, 255, 0.15);
    --ng-progress-bar: linear-gradient(90deg, #7af4ff, #ffd447);
    --ng-life: #7af4ff;
    --ng-life-glow: 0 0 8px #7af4ff;
    --ng-life-lost: rgba(120, 200, 255, 0.18);
    --ng-controls-bg: linear-gradient(#0b1128, #070a1a);
    --ng-controls-border: rgba(120, 200, 255, 0.22);
    --ng-key-bg: linear-gradient(#22306a, #151f48 60%, #10183a);
    --ng-key-text: #e8f4ff;
    --ng-key-border: rgba(140, 210, 255, 0.28);
    --ng-key-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 0 #080c1e;
    --ng-key-pressed: linear-gradient(#3a59c4, #2440a0);
    --ng-key-pressed-text: #fff;
    --ng-key-sub: #ffd447;
    --ng-acc-bg: linear-gradient(#1a2550, #121a3c);
    --ng-active-bg: linear-gradient(#ffe07a, #f5b82e);
    --ng-active-text: #1b1300;
    --ng-active-border: #ffe9a3;
    --ng-active-glow: 0 0 16px rgba(255, 212, 71, 0.55);
    --ng-overlay-bg: rgba(3, 5, 16, 0.68);
    --ng-overlay-light: rgba(3, 5, 16, 0.42);
    --ng-card-bg: linear-gradient(160deg, rgba(20, 30, 70, 0.96), rgba(10, 14, 36, 0.96));
    --ng-card-border: rgba(122, 244, 255, 0.25);
    --ng-card-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(60, 130, 255, 0.15);
    --ng-card-text: #e8f4ff;
    --ng-select-bg: #0d1533;
    --ng-btn-bg: #142050;
    --ng-btn-text: #e8f4ff;
    --ng-primary-bg: linear-gradient(#ffe07a, #f5b82e);
    --ng-primary-text: #1b1300;
    --ng-primary-border: #ffe9a3;
    --ng-primary-glow: 0 0 22px rgba(255, 212, 71, 0.35);
    --ng-title: linear-gradient(90deg, #7af4ff, #ffd447);
    --ng-float-name: #ffd447;
    --ng-float-pts: #7af4ff;
    --ng-float-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    --ng-keys-h: clamp(104px, 23vh, 186px);  /* výška tlačidiel nôt */
    --ng-acc-h: clamp(40px, 7vh, 56px);      /* výška ♭ ♮ ♯ nad nimi */
    --ng-keys-w: 100%;                       /* najväčšia šírka radu nôt aj posuviek */
    --ng-music: "Noto Music", "Segoe UI Symbol", "Apple Symbols", serif;
    --ng-ctl-hud-text: #e8f4ff;              /* HUD v paneli ovládania (telefón na šírku) */
    --ng-ctl-hud-sub: #7af4ff;
    --ng-ctl-track: rgba(120, 200, 255, 0.18);
    --ng-ctl-life-lost: rgba(120, 200, 255, 0.2);
    --ng-ctl-icon-border: rgba(140, 210, 255, 0.3);
    --ng-float-drop: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
}
.ng-app[data-theme="castle"] {
    --ng-bg: #cfe8fb;
    --ng-app-bg: linear-gradient(#7fbcf0 0%, #b5dcfa 45%, #e9f4f6 72%, #f8ecd2 100%);
    --ng-font: "Alegreya Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ng-font-head: "Alegreya", Georgia, "Times New Roman", serif;
    --ng-text: #2b1d12;
    --ng-muted: #6b5844;
    --ng-accent: #b3121f;
    --ng-accent2: #8a5a1c;
    --ng-danger: #c8102e;
    --ng-ok: #2f7d32;
    --ng-line: rgba(120, 84, 40, 0.35);
    --ng-hud-bg: linear-gradient(rgba(255, 248, 230, 0.92), rgba(255, 248, 230, 0));
    --ng-hud-text: #2b1d12;
    --ng-hud-sub: #8e1b1b;
    --ng-icon-bg: linear-gradient(#8a5a33, #5e3a1e);
    --ng-icon-text: #fbe9c2;
    --ng-progress-track: rgba(90, 60, 30, 0.2);
    --ng-progress-bar: linear-gradient(90deg, #b3121f, #e0a82e);
    --ng-life: linear-gradient(#d4202f, #8e0f17);
    --ng-life-glow: none;
    --ng-life-lost: rgba(90, 60, 30, 0.2);
    --ng-controls-bg: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 118px, rgba(0, 0, 0, 0.18) 118px 121px), linear-gradient(#5b3b22, #3b2414);
    --ng-controls-border: #2a170b;
    --ng-key-bg: linear-gradient(#fbf1d9, #efdcb2 70%, #e2c891);
    --ng-key-text: #2b1d12;
    --ng-key-border: #8b6b3e;
    --ng-key-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #23140a;
    --ng-key-pressed: linear-gradient(#e6c784, #d2a955);
    --ng-key-pressed-text: #2b1d12;
    --ng-key-sub: #8e1b1b;
    --ng-acc-bg: linear-gradient(#fbf1d9, #e7d1a1);
    --ng-active-bg: linear-gradient(#c8222f, #8e0f17);
    --ng-active-text: #ffe7a6;
    --ng-active-border: #f0c85a;
    --ng-active-glow: 0 0 14px rgba(240, 200, 90, 0.6);
    --ng-overlay-bg: rgba(40, 26, 12, 0.5);
    --ng-overlay-light: rgba(40, 26, 12, 0.22);
    --ng-card-bg: linear-gradient(170deg, #fbf3df, #f1e1bb);
    --ng-card-border: #8b6b3e;
    --ng-card-shadow: 0 18px 50px rgba(40, 24, 8, 0.45), inset 0 0 0 4px rgba(255, 255, 255, 0.35);
    --ng-card-text: #2b1d12;
    --ng-select-bg: #fffaf0;
    --ng-btn-bg: linear-gradient(#f3e3bd, #e2c891);
    --ng-btn-text: #3b2a1d;
    --ng-primary-bg: linear-gradient(#c8222f, #8e0f17);
    --ng-primary-text: #ffe9b0;
    --ng-primary-border: #6e0a10;
    --ng-primary-glow: 0 3px 0 #5a070c;
    --ng-title: linear-gradient(90deg, #8e0f17, #b3121f);
    --ng-float-name: #8e0f17;
    --ng-float-pts: #6a4513;
    --ng-float-shadow: 0 0 6px #fff8e8, 0 0 12px #fff8e8;
    --ng-ctl-hud-text: #fbe9c2;
    --ng-ctl-hud-sub: #f0c85a;
    --ng-ctl-track: rgba(255, 235, 200, 0.18);
    --ng-ctl-life-lost: rgba(255, 235, 200, 0.22);
    --ng-ctl-icon-border: rgba(255, 235, 200, 0.25);
    --ng-float-drop: drop-shadow(0 0 2px #fff8e8) drop-shadow(0 0 4px #fff8e8);
}

html, body.ng-body {
    margin: 0;
    height: 100%;
    background: #050714;
    overflow: hidden;
    overscroll-behavior: none;
}
.ng-app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    color: var(--ng-text);
    font-family: var(--ng-font);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background: var(--ng-app-bg);
}
.ng-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
#ng-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* --- HUD ------------------------------------------------------------------- */
.ng-hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    background: var(--ng-hud-bg);
    color: var(--ng-hud-text);
    font-variant-numeric: tabular-nums;
    z-index: 2;
}
.ng-hud-l, .ng-hud-r { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ng-hud-l { flex: 1 1 auto; }
.ng-hud-r { flex: 0 0 auto; }               /* štíty, skóre a zvuk sa nezmenšujú — skráti sa názov tóniny */
.ng-app[data-mode="menu"] .ng-hud { visibility: hidden; }
.ng-icon-btn {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    border: 1px solid var(--ng-line);
    background: var(--ng-icon-bg);
    color: var(--ng-icon-text);
    cursor: pointer;
    padding: 0;
}
.ng-icon-btn:hover { border-color: var(--ng-accent2); }
.ng-icon-btn:focus-visible, .ng-btn:focus-visible, .ng-note-btn:focus-visible, .ng-acc-btn:focus-visible, .ng-field select:focus-visible {
    outline: 2px solid var(--ng-accent);
    outline-offset: 2px;
}
#ng-btn-mute .ng-ico-off { display: none; }
#ng-btn-mute.ng-muted-on .ng-ico-off { display: block; }
#ng-btn-mute.ng-muted-on .ng-ico-on { display: none; }
.ng-hud-level {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    flex: 0 1 auto;
    min-width: 0;
}
#ng-hud-level { font-family: var(--ng-font-head); font-weight: 800; font-size: 16px; letter-spacing: 0.02em; }
.ng-hud-key { font-size: 13px; font-weight: 700; color: var(--ng-hud-sub); }
#ng-hud-level, .ng-hud-key { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ng-hud-progress {
    flex: 1 1 auto;
    min-width: 40px;
    height: 6px;
    border-radius: 3px;
    background: var(--ng-progress-track);
    overflow: hidden;
}
#ng-hud-progress-bar {
    height: 100%;
    width: 0;
    background: var(--ng-progress-bar);
    transition: width 0.25s ease;
}
.ng-hud-lives { display: flex; gap: 4px; }
.ng-life {
    width: 13px; height: 15px;
    background: var(--ng-life);
    clip-path: polygon(50% 0, 100% 18%, 92% 70%, 50% 100%, 8% 70%, 0 18%);
    box-shadow: var(--ng-life-glow);
}
.ng-life-lost { background: var(--ng-life-lost); }
.ng-hud-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.05;
    min-width: 64px;
}
#ng-hud-score { font-family: var(--ng-font-head); font-size: 21px; font-weight: 800; }
#ng-hud-score.ng-bump { animation: ng-bump 0.25s ease; }
.ng-hud-combo { font-size: 13px; color: var(--ng-accent); font-weight: 800; min-height: 13px; }
@keyframes ng-bump { 50% { transform: scale(1.18); color: var(--ng-accent); } }

.ng-stage.ng-flash-wrong::after, .ng-stage.ng-flash-hit::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    animation: ng-flash 0.35s ease-out forwards;
}
.ng-stage.ng-flash-wrong::after { box-shadow: inset 0 0 60px rgba(255, 71, 102, 0.55); }
.ng-stage.ng-flash-hit::after { box-shadow: inset 0 0 120px rgba(255, 71, 102, 0.85); }
@keyframes ng-flash { from { opacity: 1; } to { opacity: 0; } }

/* --- mená nôt: písmeno + ♯/♭ ako SVG (rovnaké ako na tlačidlách) ------------------ */
.ng-nn { white-space: nowrap; }
.ng-sym {
    display: inline-block;
    height: 0.82em;
    width: auto;
    margin-left: 0.04em;
    vertical-align: -0.02em;
    fill: none;
    stroke: currentColor;
    stroke-linecap: butt;
    overflow: visible;
}
.ng-sr {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.ng-float .ng-sym { filter: var(--ng-float-drop); }

/* --- plávajúce mená nôt ------------------------------------------------------ */
.ng-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.ng-float {
    position: absolute;
    transform: translate(-50%, -50%);
    font-weight: 800;
    white-space: nowrap;
    text-shadow: var(--ng-float-shadow);
    animation: ng-float-up 0.9s ease-out forwards;
}
.ng-float-name { font-family: var(--ng-font-head); font-size: clamp(22px, 3.4vw, 36px); color: var(--ng-float-name); }
.ng-float-pts { font-size: 15px; color: var(--ng-float-pts); }
.ng-float-chord { font-family: var(--ng-font-head); font-size: clamp(18px, 2.6vw, 28px); color: var(--ng-ok); animation-duration: 1.4s; }
.ng-float-wrong { font-size: 20px; color: var(--ng-danger); }
.ng-float-missed { font-size: 22px; color: var(--ng-danger); animation-duration: 1.3s; }
@keyframes ng-float-up {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

/* --- ovládanie ---------------------------------------------------------------- */
/* Dole 7 nôt, nad nimi ♭ ♮ ♯ (len v leveloch s posuvkami) — na telefóne aj na počítači */
.ng-controls {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    box-sizing: border-box;
    background: var(--ng-controls-bg);
    border-top: 2px solid var(--ng-controls-border);
    z-index: 3;
}
.ng-app[data-mode="menu"] .ng-controls { display: none; }
.ng-app[data-mode="over"] .ng-controls { opacity: 0.45; pointer-events: none; }
/* s posuvkami o niečo nižšie noty, nech osnove ostane miesto */
.ng-app:not(.ng-no-acc) { --ng-keys-h: clamp(92px, 19vh, 160px); }
.ng-acc {
    width: 100%;
    max-width: var(--ng-keys-w);
    height: var(--ng-acc-h);
    display: flex;
    justify-content: center;
    gap: 8px;
}
.ng-acc[hidden] { display: none; }
.ng-notes {
    width: 100%;
    max-width: var(--ng-keys-w);
    height: var(--ng-keys-h);
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    min-width: 0;
}
.ng-acc-btn, .ng-note-btn {
    position: relative;
    border: 1px solid var(--ng-key-border);
    border-radius: 12px;
    color: var(--ng-key-text);
    cursor: pointer;
    padding: 0;
    touch-action: none;
    box-shadow: var(--ng-key-shadow);
    transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
}
.ng-acc-btn {
    flex: 0 1 120px;
    min-width: 0;
    display: grid;
    place-items: center;
    background: var(--ng-acc-bg);
}
.ng-acc-btn svg {
    height: min(70%, 44px);
    width: auto;
    stroke: currentColor;
    stroke-linecap: butt;
    pointer-events: none;
}
.ng-acc-btn.ng-active {
    background: var(--ng-active-bg);
    color: var(--ng-active-text);
    border-color: var(--ng-active-border);
    box-shadow: var(--ng-active-glow);
}
.ng-note-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: var(--ng-key-bg);
}
.ng-note-main { font-family: var(--ng-font-head); font-size: clamp(24px, 6.4vw, 38px); font-weight: 800; line-height: 1; }
.ng-note-sub { font-size: clamp(12px, 3vw, 17px); font-weight: 800; color: var(--ng-key-sub); min-height: 1.1em; line-height: 1.1; }
.ng-note-btn.ng-mod { border-color: var(--ng-active-border); }
.ng-note-btn.ng-pressed, .ng-acc-btn.ng-pressed {
    transform: translateY(2px);
    background: var(--ng-key-pressed);
    color: var(--ng-key-pressed-text);
}
@media (hover: hover) {
    .ng-note-btn:hover, .ng-acc-btn:not(.ng-active):hover { border-color: var(--ng-accent2); }
}

/* telefón na šírku: nízky panel; HUD (presunutý z plochy cez JS) je v rade ♭ ♮ ♯ — vľavo level, vpravo štíty a skóre */
@media (orientation: landscape) and (max-height: 520px) {
    .ng-app, .ng-app:not(.ng-no-acc) { --ng-keys-h: 54px; --ng-acc-h: 34px; }
    .ng-controls {
        display: grid;
        /* vpravo aspoň toľko, koľko treba na štíty, skóre a zvuk; vľavo sa skráti postup a tónina */
        grid-template-columns: minmax(0, 1fr) auto minmax(max-content, 1fr);
        grid-template-areas: "hl acc hr" "notes notes notes";
        column-gap: 12px;
        row-gap: 5px;
        align-items: center;
        padding-top: 5px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
    .ng-controls > .ng-hud { display: contents; }
    .ng-controls .ng-hud-l { grid-area: hl; gap: 8px; color: var(--ng-ctl-hud-text); }
    .ng-controls .ng-hud-r { grid-area: hr; gap: 8px; justify-content: flex-end; color: var(--ng-ctl-hud-text); }
    .ng-controls .ng-hud-key { color: var(--ng-ctl-hud-sub); font-size: 12px; }
    .ng-controls .ng-hud-progress { background: var(--ng-ctl-track); min-width: 24px; }
    .ng-controls .ng-life-lost { background: var(--ng-ctl-life-lost); }
    .ng-controls .ng-icon-btn { width: 34px; height: 34px; border-color: var(--ng-ctl-icon-border); }
    .ng-controls #ng-hud-level { font-size: 14px; }
    .ng-controls #ng-hud-score { font-size: 18px; }
    .ng-controls .ng-hud-combo { font-size: 11px; min-height: 11px; }
    .ng-controls .ng-life { width: 11px; height: 13px; }
    .ng-controls .ng-hud-score { min-width: 52px; }
    /* pevná šírka stredného stĺpca (inak ho grid zúži na obsah a tlačidlá prekryjú HUD); na úzkom telefóne užšie */
    .ng-acc { grid-area: acc; width: clamp(180px, 100vw - 460px, 280px); height: var(--ng-acc-h); }
    .ng-acc-btn { flex: 1 1 0; }
    .ng-notes { grid-area: notes; max-width: none; }
    .ng-note-main { font-size: 24px; }
    .ng-note-sub { font-size: 13px; }
}
/* počítač: rad nôt aj posuviek uprostred */
@media (min-width: 900px) and (min-height: 560px) {
    .ng-app, .ng-app:not(.ng-no-acc) { --ng-keys-h: 96px; --ng-acc-h: 50px; --ng-keys-w: 680px; }
}

/* --- okná (menu, level, koniec) ------------------------------------------------- */
.ng-overlay {
    position: fixed;          /* celá obrazovka vrátane panela ovládania — na šírku má okno o ~100 px viac */
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: var(--ng-overlay-bg);
    backdrop-filter: blur(2px);
    overflow-y: auto;
}
.ng-overlay[hidden] { display: none; }
.ng-overlay-light { background: var(--ng-overlay-light); backdrop-filter: none; }
.ng-card {
    width: min(520px, 100%);
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 20px 22px;
    border-radius: 18px;
    color: var(--ng-card-text);
    background: var(--ng-card-bg);
    border: 1px solid var(--ng-card-border);
    box-shadow: var(--ng-card-shadow);
    -webkit-user-select: text;
    user-select: text;
}
.ng-app[data-theme="castle"] .ng-card { border-width: 2px; border-radius: 10px; }
.ng-card-small { width: min(360px, 100%); text-align: center; }
.ng-card h2 { margin: 0 0 10px; font-family: var(--ng-font-head); font-size: 24px; }
.ng-card h3 { margin: 16px 0 8px; font-size: 15px; color: var(--ng-accent2); letter-spacing: 0.04em; text-transform: uppercase; }
.ng-back { display: inline-block; color: var(--ng-muted); text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.ng-back:hover { color: var(--ng-card-text); }
.ng-title {
    margin: 0 0 6px;
    font-family: var(--ng-font-head);
    font-size: clamp(30px, 6.4vw, 44px);
    line-height: 1.05;
    letter-spacing: 0.01em;
    background: var(--ng-title);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.ng-lead { margin: 0 0 6px; color: var(--ng-muted); line-height: 1.45; font-size: 16px; }
.ng-menu-best { margin: 0 0 10px; color: var(--ng-accent); font-weight: 800; }
.ng-menu-best:empty { display: none; }
.ng-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 16px; }
.ng-form > .ng-field:last-of-type, .ng-fixed-row { grid-column: 1 / -1; }
.ng-fixed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ng-fixed-row[hidden] { display: none; }
.ng-field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ng-muted); }
.ng-field select {
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    color: var(--ng-card-text);
    background: var(--ng-select-bg);
    border: 1px solid var(--ng-line);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 44px;
}
.ng-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ng-actions-col { flex-direction: column; }
.ng-btn {
    flex: 1 1 auto;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--ng-line);
    background: var(--ng-btn-bg);
    color: var(--ng-btn-text);
    font: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
}
.ng-btn:hover { border-color: var(--ng-accent2); }
.ng-btn.ng-primary {
    background: var(--ng-primary-bg);
    color: var(--ng-primary-text);
    border-color: var(--ng-primary-border);
    box-shadow: var(--ng-primary-glow);
}
.ng-help { margin-top: 14px; color: var(--ng-muted); font-size: 14px; line-height: 1.45; }
.ng-help summary { cursor: pointer; color: var(--ng-card-text); font-weight: 700; }
.ng-help ul { padding-left: 18px; margin: 8px 0 0; }
.ng-help li { margin-bottom: 6px; }
.ng-rotate-tip { display: none; margin: 10px 0 0; font-size: 13px; color: var(--ng-muted); }
@media (orientation: portrait) and (max-width: 600px) { .ng-rotate-tip { display: block; } }
@media (hover: none) { .ng-desktop-only { display: none; } }

/* úvod levelu a správa po dokončení */
.ng-card-level { padding: 16px 20px; }
.ng-card h2.ng-level-head { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.ng-level-head.ng-done-title { color: var(--ng-ok); }
.ng-level-stats { margin: 0 0 2px; font-size: 14px; color: var(--ng-muted); }
.ng-level-next { margin: 0; font-weight: 800; color: var(--ng-accent2); }
.ng-level-hints { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.4; color: var(--ng-accent); font-weight: 600; }
.ng-level-hints:empty { display: none; }
.ng-level-hints li { margin-bottom: 2px; }
.ng-level-hints li.ng-hint-desc { color: var(--ng-card-text); font-weight: 500; }
.ng-level-hints .ng-nn { font-weight: 800; }
.ng-card-level .ng-actions { margin-top: 12px; }
.ng-muted { color: var(--ng-muted); font-size: 14px; }

.ng-over-score { font-family: var(--ng-font-head); font-size: 46px; font-weight: 800; color: var(--ng-accent); line-height: 1.1; }
.ng-over-score small { font-family: var(--ng-font); font-size: 16px; color: var(--ng-muted); font-weight: 600; }
.ng-over-meta { margin: 2px 0; color: var(--ng-muted); }
.ng-over-best { margin: 6px 0; font-weight: 800; min-height: 1.2em; }
.ng-over-best.ng-record { color: var(--ng-ok); }
.ng-over-best:empty { display: none; }
.ng-card-over { display: flex; flex-direction: column; }
.ng-card-over > * { flex: 0 0 auto; }
.ng-card-over .ng-over-boardwrap { flex: 1 1 auto; min-height: 90px; overflow-y: auto; }
.ng-over-errors .ng-nn { color: var(--ng-card-text); font-weight: 800; }

.ng-board { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.ng-board th { text-align: left; color: var(--ng-muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--ng-line); }
.ng-board td { padding: 7px 6px; border-bottom: 1px solid var(--ng-line); }
.ng-board td:nth-child(2) { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-board .ng-num { text-align: right; }
.ng-board tr.ng-me td { color: var(--ng-accent); font-weight: 800; }
.ng-board-me { margin: 10px 0 0; color: var(--ng-accent); font-weight: 800; }
@media (max-width: 420px) { .ng-hide-xs { display: none; } }

.ng-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ng-muted);
    z-index: 6;
    padding: 20px;
    text-align: center;
}
.ng-loading[hidden] { display: none; }

@media (max-width: 420px) {
    /* 360 px: menšie medzery a ikony, nech sa zmestí celý názov tóniny („cis mol harmonická“) */
    .ng-hud, .ng-hud-l, .ng-hud-r { gap: 5px; }
    .ng-hud .ng-icon-btn { width: 34px; height: 34px; }
    .ng-hud-progress { min-width: 20px; }
    .ng-hud-key { font-size: 12px; }
    .ng-hud-score { min-width: 52px; }
    .ng-life { width: 11px; height: 13px; }
    #ng-hud-score { font-size: 18px; }
    .ng-card { padding: 16px; }
}
@media (max-width: 600px) and (orientation: portrait) {
    .ng-title { font-size: 32px; }
    .ng-lead { font-size: 15px; line-height: 1.4; }
    .ng-form { gap: 8px; margin: 10px 0 12px; }
    .ng-field select { min-height: 42px; padding: 8px 10px; }
    .ng-help { margin-top: 10px; }
    .ng-overlay-light { place-items: end center; }
}
/* telefón na šírku: menu v dvoch stĺpcoch, správa levelu vedľa tlačidla, koniec hry s rebríčkom vpravo */
@media (orientation: landscape) and (max-height: 520px) {
    .ng-overlay { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .ng-card { padding: 14px 18px; }
    .ng-card h2 { font-size: 20px; margin-bottom: 6px; }
    .ng-card-menu {
        width: min(760px, 100%);
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
        grid-template-areas: "back form" "title form" "lead form" "best form" "actions help" "tip help";
        grid-template-rows: auto auto auto auto auto 1fr;
        column-gap: 22px;
        align-items: start;
    }
    .ng-card-menu .ng-back { grid-area: back; margin-bottom: 2px; }
    .ng-card-menu .ng-title { grid-area: title; font-size: 30px; }
    .ng-card-menu .ng-lead { grid-area: lead; font-size: 14px; line-height: 1.35; }
    .ng-card-menu .ng-menu-best { grid-area: best; margin: 2px 0 0; }
    .ng-card-menu .ng-form { grid-area: form; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
    .ng-card-menu .ng-actions { grid-area: actions; margin-top: 10px; }
    .ng-card-menu .ng-help { grid-area: help; margin-top: 10px; }
    .ng-card-menu .ng-rotate-tip { grid-area: tip; }
    .ng-field select { min-height: 38px; padding: 6px 10px; font-size: 15px; }
    .ng-btn { min-height: 42px; padding: 8px 14px; font-size: 16px; }
    .ng-overlay-light { place-items: end center; }
    .ng-card-level {
        width: min(700px, 100%);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 18px;
        align-items: center;
        padding: 12px 16px;
    }
    .ng-card-level .ng-actions { margin-top: 0; }
    .ng-card-level .ng-btn { min-width: 120px; }
    .ng-card h2.ng-level-head { font-size: 19px; }
    .ng-card-over {
        width: min(760px, 100%);
        display: grid;
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
        grid-template-areas: "h board" "score board" "meta board" "best board" "errors board" "actions board";
        grid-template-rows: auto auto auto auto 1fr auto;
        column-gap: 22px;
    }
    .ng-card-over > h2 { grid-area: h; }
    .ng-card-over .ng-over-score { grid-area: score; font-size: 38px; }
    .ng-card-over .ng-over-meta { grid-area: meta; }
    .ng-card-over .ng-over-best { grid-area: best; }
    .ng-card-over .ng-over-errors { grid-area: errors; }
    .ng-card-over .ng-actions { grid-area: actions; }
    .ng-card-over .ng-over-boardwrap { grid-area: board; min-height: 0; max-height: calc(100dvh - 48px); }
    .ng-card-over .ng-over-boardwrap h3 { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .ng-float { animation-duration: 0.6s; }
    #ng-hud-score.ng-bump { animation: none; }
}
