/* Sunset-over-the-village palette: sky blue fading into a burning
   orange-red horizon, the two colors most associated with Naruto himself
   (his jacket, his headband) -- plus the original "forehead protector"
   framing as a homage that doesn't reuse any show art. */
@font-face {
  font-family: "Kouzan";
  src: url("../assets/fonts/kouzan_mouhitsu.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg-top: #0a2647;
  --bg-bottom: #b8360f;
  --ink: #ffffff;
  --ink-dim: #b9d4ea;
  --accent: #ff7a1a;
  --accent-2: #29b6f6;
  --accent-3: #ffd166;
  --good: #4ade80;
  --bad: #ff4646;
  --gold: #ffb238;
  --panel: #11273b;
  --panel-light: #1e3f58;
  --panel-glass: rgba(9, 24, 40, 0.88);
  --panel-border: rgba(255, 255, 255, 0.13);
  --player: #29b6f6;
  --enemy: #ff5a3c;
  --radius: 6px;
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 0 1px rgba(255, 122, 26, 0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
}

html {
  background: var(--bg-top);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

/* Sky gradient + vignette as real position:fixed layers rather than
   `background-attachment: fixed` -- that CSS value is unreliable on mobile
   Safari (often silently downgraded to `scroll`) and, combined with a
   separate solid `html` background, was observed here to stop repainting
   entirely after the first scroll (page turned into a single flat color).
   Fixed-position elements don't have either problem. */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::after {
  z-index: -3;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(120, 200, 255, 0.28), transparent 60%),
    linear-gradient(180deg, var(--bg-top) 0%, #14416b 38%, #a8431f 78%, var(--bg-bottom) 100%);
}
/* Soft vignette + horizon glow sitting above the sky gradient/photo layers
   and below actual page content, shared by every page for visual cohesion. */
body::before {
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(255, 178, 56, 0.28), transparent 70%),
    radial-gradient(ellipse 60% 30% at 15% 0%, rgba(41, 182, 246, 0.22), transparent 70%);
}

a { color: var(--accent-2); }

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  position: relative;
  z-index: 1;
}

/* Solid color (not a clipped gradient fill -- background-clip:text silently
   fails to paint on some mobile/WebView renderers, leaving fully invisible
   text with no fallback) with an animated multi-color glow instead. Works
   everywhere, still reads as "alive". Kept slow and low-amplitude on
   purpose -- the brand title shouldn't be the thing pulling the eye away
   from the actual page content. */
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 16px rgba(255, 122, 26, 0.45), 0 0 34px rgba(255, 122, 26, 0.22); }
  50% { text-shadow: 0 0 18px rgba(41, 182, 246, 0.4), 0 0 36px rgba(255, 178, 56, 0.28); }
}

h1.title {
  /* NOT Kouzan: it's a Japanese brush font with no Cyrillic glyphs, and
     every h1.title on this site is Russian text -- it rendered fully
     blank (confirmed against a solid background) rather than falling
     back to Segoe UI for the missing glyphs. */
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: clamp(34px, 11vw, 64px);
  text-align: center;
  margin: 18px 0 2px;
  font-weight: 800;
  letter-spacing: clamp(1px, 0.6vw, 4px);
  color: var(--ink);
  line-height: 1.02;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.brush { font-family: "Kouzan", "Segoe UI", sans-serif; }

.subtitle {
  text-align: center;
  color: var(--accent-2);
  letter-spacing: clamp(1px, 1vw, 6px);
  font-weight: 700;
  margin-bottom: 28px;
  text-transform: uppercase;
  font-size: clamp(11px, 3vw, 13px);
}

/* "Forehead protector" framed panel: a beveled metal-plate header bar,
   evoking a hitai-ate without reproducing the show's actual leaf emblem.
   Glassy + animated-in so the whole cabinet feels alive rather than flat. */
@keyframes panelIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.plate-panel {
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  box-shadow: var(--shadow-soft);
  animation: panelIn 0.3s ease-out both;
}

.plate-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -24px -24px 20px;
  padding: 13px 24px;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid var(--panel-border);
  border-radius: var(--radius) var(--radius) 0 0;
}

@keyframes shimmerSweep {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.plate-emblem {
  width: 3px;
  height: 16px;
  background: var(--accent);
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.plate-header .plate-title {
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 12.5px;
  color: #eaf1f7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--accent); background: rgba(255, 122, 26, 0.14); }
.btn:active { background: rgba(255, 122, 26, 0.24); }
.btn:focus-visible, .nav-btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
@keyframes primaryPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 178, 56, 0); }
  50% { box-shadow: 0 0 22px rgba(255, 178, 56, 0.5); }
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0f06;
}
.btn.primary:hover { background: #ff8e3a; border-color: #ff8e3a; }
.btn.primary:active { background: #e86a0e; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; animation: none; }

input[type="text"], input[type="password"], input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(41, 182, 246, 0.35); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.col { flex: 1; min-width: 220px; }

.muted { color: var(--ink-dim); font-size: 14px; }
.center { text-align: center; }
.error-text { color: var(--bad); font-size: 14px; min-height: 18px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink-dim);
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab.active { background: var(--panel-light); color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  background: rgba(255, 122, 26, 0.12);
  border: 1px solid rgba(255, 122, 26, 0.7);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

canvas { display: block; }

.news-item { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-item .news-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 1.5px;
  padding: 2px 8px; border-radius: 4px; background: var(--accent-2); color: #052733; margin-right: 8px;
}
.news-item .news-date { color: var(--ink-dim); font-size: 12px; }
.news-item .news-title { font-weight: 800; font-size: 17px; margin: 6px 0 4px; color: var(--gold); }
.news-item .news-body { color: var(--ink-dim); font-size: 14px; line-height: 1.5; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--accent-2), var(--accent)); border-radius: 6px; }

@media (max-width: 820px) {
  .wrap { max-width: 100%; }
  .row { gap: 10px; }
  .col { min-width: 160px; }
}

@media (max-width: 480px) {
  .wrap { padding: 18px 14px 40px; }
  .plate-panel { padding: 16px; }
  .plate-header { margin: -16px -16px 16px; padding: 10px 14px; }
  .plate-emblem { width: 22px; height: 22px; }
  .row { flex-direction: column; }
  .col { min-width: 0; width: 100%; }
  .btn { padding: 13px 18px; font-size: 15px; }
}

/* Respect users who've asked for less motion -- keep the game legible and
   comfortable instead of forcing every pulse/shimmer/spin on everyone. */
@media (prefers-reduced-motion: reduce) {
  h1.title, .plate-panel, .plate-header, .plate-emblem, .btn.primary, .btn::before {
    animation: none !important;
    transition: none !important;
  }
}

.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 22px; text-align: center; font-weight: 800; color: var(--ink-dim); }
.lb-rank.gold { color: var(--gold); text-shadow: 0 0 8px var(--gold); }
.lb-name { flex: 1; font-weight: 700; }
.lb-score { font-size: 13px; color: var(--ink-dim); }
.match-row { padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 13px; }
.match-row:last-child { border-bottom: none; }
.match-row .winner { color: var(--good); font-weight: 700; }
.match-row .loser { color: var(--ink-dim); }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.ach-cell {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ach-cell:hover { transform: translateY(-2px); }
.ach-cell.unlocked { border-color: var(--gold); background: rgba(255, 178, 56, 0.1); }
.ach-cell.unlocked:hover { box-shadow: 0 0 16px rgba(255, 178, 56, 0.3); }
.ach-icon { font-size: 26px; filter: grayscale(1) opacity(0.3); flex-shrink: 0; }
.ach-cell.unlocked .ach-icon { filter: none; }
.ach-text { min-width: 0; }
.ach-name { font-weight: 700; font-size: 13px; }
.ach-cell:not(.unlocked) .ach-name { color: var(--ink-dim); }
.ach-desc { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }

/* Full-bleed atmospheric sky photo, randomized per page load by
   js/bg_photo.js. Sits beneath the ember canvas, above the CSS gradient,
   tinted so any source photo reads as "this game's sky" rather than a
   pasted-in stock image. */
#bgPhoto {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  opacity: 0;
  filter: saturate(1.15) brightness(0.85);
  transition: opacity 1.4s ease;
  pointer-events: none;
}
#bgPhoto.loaded { opacity: 0.55; }
#bgPhoto::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 38, 71, 0.55) 0%, rgba(20, 65, 107, 0.25) 40%, rgba(168, 67, 31, 0.35) 75%, rgba(184, 54, 15, 0.65) 100%);
}

/* Avatar constructor ("character forge") -- a lit pedestal for the preview
   canvas plus tactile ring swatches instead of raw <input type="color">
   rectangles, so building a character feels like an actual creation
   screen instead of a settings form. */
.avatar-editor-layout { align-items: flex-start; }

.avatar-preview {
  text-align: center;
  padding: 18px;
  border-radius: 14px;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(41, 182, 246, 0.18), rgba(0, 0, 0, 0.3) 75%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}
.avatar-preview canvas {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 30px rgba(41, 182, 246, 0.25);
}

.avatar-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.avatar-color-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.avatar-swatch-ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 90deg, var(--accent-2), var(--gold), var(--accent), var(--accent-2));
  display: flex;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.avatar-color-cell:hover .avatar-swatch-ring { transform: scale(1.08); box-shadow: 0 0 14px rgba(255, 178, 56, 0.5); }
.avatar-swatch-ring input[type="color"] {
  width: 100%;
  height: 100%;
  border: 2px solid #0d1420;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}
.avatar-swatch-ring input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.avatar-swatch-ring input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.avatar-swatch-ring input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }
.avatar-color-label { font-size: 11px; color: var(--ink-dim); text-align: center; }

.avatar-style-row { margin-bottom: 14px; }
.avatar-style-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.avatar-style-btn {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.avatar-style-btn:hover { transform: translateY(-1px); border-color: var(--accent-2); }
.avatar-style-btn.active {
  background: linear-gradient(180deg, #ff9a3e, #d9490f);
  border-color: var(--gold);
  color: #1a0f06;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(255, 178, 56, 0.4);
}

@media (max-width: 480px) {
  .avatar-color-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
}

/* Waiting-room fighter cards */
.fighter-slot { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.fighter-slot.is-ready { border-color: var(--good); box-shadow: var(--shadow-soft), 0 0 20px rgba(74, 222, 128, 0.3); }
.fighter-avatar-canvas { border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.12); }
@keyframes waitPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.fighter-waiting { animation: waitPulse 1.8s ease-in-out infinite; }
.vs-divider {
  flex: 0 0 auto;
  align-self: center;
  font-family: "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 0 0 16px var(--accent), 0 0 30px rgba(255, 122, 26, 0.5);
  padding: 6px 4px;
}

/* ---- community panel (online players, lobbies, chat) ---- */
.com-title { font-weight: 800; color: var(--gold); margin: 14px 0 6px; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; }
.com-box { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; padding-right: 4px; }
.com-chat { height: 220px; max-height: none; background: rgba(0, 0, 0, 0.22); border-radius: 10px; padding: 8px; gap: 4px; }
.com-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.com-click { cursor: pointer; }
.com-click:hover { background: rgba(255, 178, 56, 0.14); }
.com-grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.com-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.35; }
.com-msg.dm { background: rgba(120, 90, 255, 0.16); border-radius: 8px; padding: 3px 6px; }
.com-time { color: var(--ink-dim); font-size: 11px; }

/* ---- main page layout: header, tab bar, tab pages ---- */
.wrap.wide { max-width: 1100px; }
.site-head { display: flex; align-items: center; justify-content: flex-start; gap: 18px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.site-head .site-logo { width: 84px; height: 84px; object-fit: contain; flex-shrink: 0; }
.site-head h1.title { margin: 0; text-align: left; font-size: clamp(26px, 5vw, 40px); letter-spacing: 2px; }
.site-head .subtitle { margin: 6px 0 0; text-align: left; }
.main-nav { position: sticky; top: 0; z-index: 30; display: flex; gap: 2px; margin: 0 0 24px; padding: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); background: rgba(8, 20, 34, 0.94); overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.nav-btn { flex: 0 0 auto; padding: 14px 20px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--ink-dim); font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; cursor: pointer; white-space: nowrap; transition: color .12s, border-color .12s, background .12s; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.nav-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.nav-badge:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 2px; background: var(--accent); color: #1a0f06; font-size: 11px; line-height: 18px; text-align: center; letter-spacing: 0; }
.tab-page { display: none; }
.tab-page.active { display: block; animation: tabIn .25s ease both; }
@keyframes tabIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: start; }
.com-cols { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0 22px; }
.how-details { cursor: default; }
.how-details > summary { cursor: pointer; padding: 2px 0; }
.how-details[open] > summary { margin-bottom: 12px; }
body.no-user .needs-user { display: none !important; }
@media (max-width: 820px) {
  .grid2, .com-cols { grid-template-columns: 1fr; }
  .site-head .site-logo { width: 60px; height: 60px; }
  .nav-btn { padding: 10px 12px; font-size: 14px; }
}

/* the "who am I" strip: one compact row */
#playPanel > .plate-panel { padding: 12px 16px; }
#playPanel > .plate-panel > .plate-header { display: none; }
#playPanel .row { flex-wrap: nowrap; align-items: center; gap: 14px; }
#playPanel .row > .col { min-width: 0; flex: 1 1 auto; }
#playPanel .row > .col:last-child { flex: 0 0 auto; }
#whoamiPics img { width: 56px !important; height: 56px !important; }
@media (max-width: 480px) {
  #playPanel .row { flex-direction: row; }
  #playPanel .row > .col { width: auto; }
}

/* camera chooser */
.cam-pick { max-width: 100%; padding: 3px 6px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(8, 20, 34, 0.92); color: var(--ink); font: 12px "Segoe UI", sans-serif; }

.site-foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 12.5px; text-align: left; }
.site-foot a { color: var(--ink-dim); }

/* phones: the language switch and the settings gear are fixed in the top-right corner -- give the header its own row below them */
@media (max-width: 600px) {
  .site-head { margin-top: 46px; gap: 12px; }
  .site-head .site-logo { width: 52px; height: 52px; }
  .site-head h1.title { font-size: clamp(22px, 7vw, 30px); letter-spacing: 1px; }
  #fxGear { top: 8px !important; right: 8px !important; width: 32px !important; height: 32px !important; }
  #nfdLang { top: 11px !important; right: 48px !important; }
  #nfdLang button { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 600px) {
  #whoamiPics img { width: 42px !important; height: 42px !important; }
  #playPanel .row { gap: 10px; }
  #playPanel .btn { padding: 9px 12px; font-size: 13px; }
}
