/* NEAGON UI layer for the web pages: base rules and the components of the design system
 * (components/bundle.css of the NEAGON design system), rewritten as plain HTML classes.
 * Load after fonts.css and tokens.css. Colours, type and spacing come only from the tokens;
 * nothing here defines a colour of its own.
 *
 * Rules kept from the design system: night is the default theme (pages set
 * data-theme="night" and a toggle switches to day), the 45-degree chamfer is the brand shape,
 * no gradients except scanlines, no glassmorphism, status is colour + icon + word,
 * focus is a solid 2px ring, touch targets >= 44px, mobile first from 360px. */

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
html[data-theme="day"] { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font-sans);
       overflow-wrap: break-word; }
img, svg, video { max-width: 100%; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-stretch: 112%; color: var(--ink); margin: 0 0 var(--space-4); }
h1 { font-size: 32px; line-height: 1.05; font-weight: 800; }
h2 { font-size: 24px; line-height: 1.15; font-weight: 700; }
h3 { font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: .01em; }
@media (min-width: 641px) { h1 { font-size: 40px; } h2 { font-size: 28px; } }
p { margin: 0 0 var(--space-4); }
.ng-muted { color: var(--ink-muted); }
.ng-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ng-skip { position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-banner); padding: var(--space-3) var(--space-4);
           background: var(--focus); color: var(--bg); font-weight: 700; }
.ng-skip:focus { top: var(--space-2); }
.ng-wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
.ng-wrap-text { max-width: var(--container-text); }
@media (min-width: 768px) { .ng-wrap { padding: 0 var(--space-6); } }
.ng-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.score, .hud, .initials, .score-xl, .ng-num { font-variant-numeric: tabular-nums; }
.ng-num { font-family: var(--font-mono); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0ms !important; animation-iteration-count: 1 !important;
                           transition-duration: 0ms !important; }
}

/* ---- Chamfer: top-left and bottom-right corners cut at 45 degrees ---- */
.ng-cut-sm { clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm)); }
.ng-cut-md { clip-path: polygon(var(--cut-md) 0, 100% 0, 100% calc(100% - var(--cut-md)), calc(100% - var(--cut-md)) 100%, 0 100%, 0 var(--cut-md)); }
.ng-cut-lg { clip-path: polygon(var(--cut-lg) 0, 100% 0, 100% calc(100% - var(--cut-lg)), calc(100% - var(--cut-lg)) 100%, 0 100%, 0 var(--cut-lg)); }

/* ---- Optional effects (night only, off with .ng-fx-off) ---- */
.ng-scanlines { position: relative; }
.ng-scanlines::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,var(--scanline-opacity)) 0, rgba(0,0,0,var(--scanline-opacity)) 1px, transparent 1px, transparent var(--scanline-pitch)); }
[data-theme="day"] .ng-scanlines::after, .ng-fx-off .ng-scanlines::after { display: none; }
.ng-neon-text { text-shadow: 0 0 calc(var(--glow-blur) / 3) currentColor; }
[data-theme="day"] .ng-neon-text, .ng-fx-off .ng-neon-text { text-shadow: none; }

/* ---- Icon: 24px grid, 2px stroke, square caps ---- */
.ng-icon { display: inline-block; flex: none; vertical-align: middle; width: 20px; height: 20px; stroke: currentColor; fill: none;
           stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.ng-icon-16 { width: 16px; height: 16px; }
.ng-icon-24 { width: 24px; height: 24px; }

/* ---- Logo: the SVG files of the brand package; the right one follows the theme ---- */
.ng-logo { display: inline-flex; align-items: center; line-height: 0; color: var(--ink); text-decoration: none; min-height: var(--tap-min); }
.ng-logo img { display: block; height: 22px; width: auto; }
.ng-logo .ng-logo-day { display: none; }
[data-theme="day"] .ng-logo .ng-logo-night { display: none; }
[data-theme="day"] .ng-logo .ng-logo-day { display: block; }
[data-theme="night"] .ng-logo-glow img { filter: drop-shadow(0 0 6px rgba(255, 63, 164, .45)); }
.ng-fx-off .ng-logo-glow img { filter: none; }

/* ---- Buttons ---- */
.ng-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap-min);
  padding: 0 var(--space-6); border: 0; border-radius: var(--radius-0); background: transparent; color: var(--ink);
  font: 700 15px/1 var(--font-display); font-stretch: 112%; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap; max-width: 100%;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.ng-btn:hover { text-decoration: none; }
.ng-btn-sm { min-height: 36px; padding: 0 var(--space-4); font-size: 13px; }
.ng-btn-lg { min-height: 56px; padding: 0 var(--space-8); font-size: 18px; gap: var(--space-3); }
.ng-btn-primary, .ng-btn-coin { clip-path: polygon(var(--cut-md) 0, 100% 0, 100% calc(100% - var(--cut-md)), calc(100% - var(--cut-md)) 100%, 0 100%, 0 var(--cut-md)); }
.ng-btn-primary { background: var(--brand); color: var(--on-brand); }
.ng-btn-primary:hover { background: var(--brand-strong); color: var(--on-brand); }
.ng-btn-coin { background: var(--accent); color: var(--on-accent); font-size: 16px; letter-spacing: .1em; font-stretch: 120%; }
.ng-btn-coin:hover { color: var(--on-accent); }
.ng-btn-coin.ng-btn-lg { font-size: 20px; }
.ng-btn-coin .ng-btn-blink { width: 6px; height: 6px; background: var(--on-accent); flex: none; animation: ng-blink 1.2s steps(1) infinite; }
@keyframes ng-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: .15; } }
.ng-btn-secondary { border-radius: var(--radius-sm); box-shadow: inset 0 0 0 2px var(--line-strong); color: var(--ink); }
.ng-btn-secondary:hover { box-shadow: inset 0 0 0 2px var(--brand); color: var(--ink); }
.ng-btn-ghost { color: var(--brand); padding: 0 var(--space-3); }
.ng-btn-ghost:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.ng-btn-danger { background: var(--danger); color: var(--on-brand);
  clip-path: polygon(var(--cut-md) 0, 100% 0, 100% calc(100% - var(--cut-md)), calc(100% - var(--cut-md)) 100%, 0 100%, 0 var(--cut-md)); }
.ng-btn-primary:focus-visible, .ng-btn-coin:focus-visible, .ng-btn-danger:focus-visible {
  outline: 0; box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 5px var(--focus); }
.ng-btn:disabled, .ng-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.ng-btn-full { width: 100%; }

/* ---- Tag: chamfered label ---- */
.ng-tag { display: inline-flex; align-items: center; gap: var(--space-2); vertical-align: middle; padding: 6px var(--space-3);
  font: 700 12px/1 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.ng-tag-play { background: var(--brand); color: var(--on-brand); }
.ng-tag-new, .ng-tag-soon { background: var(--accent); color: var(--on-accent); }
.ng-tag-live { background: var(--hot); color: var(--on-hot); }
.ng-tag-neutral { background: var(--surface-raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ng-tag-warning { background: var(--surface-raised); color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); }
.ng-tag-dot { width: 7px; height: 7px; border-radius: var(--radius-pill); background: currentColor; flex: none; }

/* ---- Notice: things that stay true on the page (colour + icon + word) ---- */
.ng-notice { --ns: var(--info); display: flex; align-items: flex-start; gap: var(--space-3); margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4); background: var(--surface-raised); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ns);
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm)); }
.ng-notice-success { --ns: var(--success); }
.ng-notice-warning { --ns: var(--warning); }
.ng-notice-danger { --ns: var(--danger); }
.ng-notice > .ng-icon { color: var(--ns); margin-top: 2px; }
.ng-notice-body { flex: 1; min-width: 0; }
.ng-notice-body > :last-child { margin-bottom: 0; }
.ng-notice-word { color: var(--ns); font-weight: 700; }

/* ---- Card: chamfered surface ---- */
.ng-card { position: relative; background: var(--surface); color: var(--ink); padding: var(--space-6);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(var(--cut-lg) 0, 100% 0, 100% calc(100% - var(--cut-lg)), calc(100% - var(--cut-lg)) 100%, 0 100%, 0 var(--cut-lg)); }
.ng-card > :last-child { margin-bottom: 0; }

/* ---- Fields ---- */
.ng-input, input[type=email], input[type=password], input[type=text], input[type=date], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: var(--tap-min); padding: 0 var(--space-3); font: inherit; color: var(--ink);
  background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
textarea { padding: var(--space-3); min-height: 6rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); opacity: 1; }
input[type=checkbox] { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--brand); }

/* ---- Credit badge: free virtual credits, never money ---- */
.ng-credit { display: inline-flex; align-items: center; gap: var(--space-2); background: var(--accent-soft); color: var(--ink);
  border-radius: var(--radius-pill); padding: 6px var(--space-4) 6px var(--space-3); white-space: nowrap; }
.ng-credit .ng-icon { color: var(--accent); }
.ng-credit-label { font: 700 12px/1 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; }
.ng-credit-count { font: 700 16px/1 var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- Leaderboard ---- */
.ng-lb { width: 100%; border-collapse: collapse; color: var(--ink); }
.ng-lb caption { text-align: left; padding: 0 0 var(--space-3); font: 800 14px/1.2 var(--font-display); font-stretch: 112%;
                 letter-spacing: .12em; text-transform: uppercase; }
.ng-lb th, .ng-lb td { padding: var(--space-3) var(--space-2); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.ng-lb thead th { color: var(--ink-muted); border-bottom: 2px solid var(--line-strong); font-weight: 600; font-size: 14px; }
.ng-lb .num { text-align: right; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.ng-lb .ini { font-family: var(--font-mono); font-weight: 700; letter-spacing: .12em; }
.ng-rank { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px;
           font: 700 16px/1 var(--font-mono); }
.ng-rank-1 { background: var(--hot); color: var(--on-hot); }
.ng-rank-2 { background: var(--accent); color: var(--on-accent); }
.ng-rank-3 { background: var(--brand); color: var(--on-brand); }
.ng-lb tr.ng-me th, .ng-lb tr.ng-me td { background: var(--brand-soft); }

/* ---- Empty state ---- */
.ng-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3);
            padding: var(--space-8) var(--space-4); max-width: 420px; margin: 0 auto; }
.ng-empty .ng-icon { color: var(--accent); width: 32px; height: 32px; }
.ng-empty p { margin: 0; color: var(--ink-muted); }

/* ---- Navigation bar ---- */
.ng-navbar { position: sticky; top: 0; z-index: var(--z-nav); background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
.ng-navbar-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); min-height: var(--nav-height);
                 max-width: var(--container); margin: 0 auto; padding: var(--space-2) var(--space-4); }
.ng-navbar-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-1); margin: 0; padding: 0; list-style: none; }
.ng-navbar-link { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 var(--space-2); color: var(--ink);
  text-decoration: none; font: 500 15px/1.2 var(--font-sans); border-bottom: 2px solid transparent; }
.ng-navbar-link:hover { color: var(--brand); }
.ng-navbar-link[aria-current="page"] { border-bottom-color: var(--brand); font-weight: 600; }
.ng-navbar-end { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
@media (max-width: 767px) {
  .ng-navbar { position: static; }
  .ng-navbar-bar > nav { order: 3; width: 100%; }
  .ng-navbar-links { margin-left: calc(var(--space-2) * -1); }
}

/* ---- Theme switch (night default, day on request) and language switch ---- */
.ng-theme { display: inline-flex; align-items: center; justify-content: center; width: var(--tap-min); height: var(--tap-min);
  padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer; }
.ng-theme:hover { color: var(--brand); }
.ng-theme .ng-theme-day { display: none; }
[data-theme="day"] .ng-theme .ng-theme-day { display: inline-block; }
[data-theme="day"] .ng-theme .ng-theme-night { display: none; }
/* .lingue: the class the pages' language selector already uses (tests and docs/i18n.md). */
.ng-lang, .lingue { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius-pill);
  background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ng-lang .ng-icon, .lingue .ng-icon { margin: 0 var(--space-1) 0 var(--space-2); color: var(--ink-muted); }
.ng-lang a, .lingue a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill); color: var(--ink); text-decoration: none; font: 600 13px/1 var(--font-sans); letter-spacing: .08em; }
.ng-lang a[aria-current], .lingue a[aria-current] { background: var(--brand); color: var(--on-brand); }

/* ---- Footer ---- */
.ng-footer { margin-top: var(--space-12); background: var(--surface); color: var(--ink); box-shadow: inset 0 1px 0 var(--line);
             padding: var(--space-8) 0 var(--space-6); }
.ng-footer-in { display: flex; flex-direction: column; gap: var(--space-4); }
.ng-footer-links { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); margin: 0; padding: 0; list-style: none; }
.ng-footer-links a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--ink-muted); text-decoration: none; }
.ng-footer-links a:hover { color: var(--brand); text-decoration: underline; }
.ng-footer p { margin: 0; color: var(--ink-muted); font-size: 14px; }
.ng-footer address { font-style: normal; }
/* Legal footer (neagon/_piede.html): logo, legal links, business data on every page. */
.piede-legale .piede-testa { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-6); }
.piede-legale .ng-logo img { height: 20px; }
.piede-legale .piede-impresa { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); color: var(--ink-muted); font-size: 14px; line-height: 1.5; }
.piede-legale .piede-impresa a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--ink-muted); overflow-wrap: anywhere; }
.piede-legale .piede-impresa > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 0.3em; }
.piede-legale .piede-impresa a:hover { color: var(--brand); }
.piede-legale .piede-copy { font-size: 13px; padding-top: var(--space-4); box-shadow: inset 0 1px 0 var(--line); }
