/* Naruto: Card Densetsu - website styles.
   Built from the game's own UI: wood bar, scroll buttons, parchment panels, the spiral menu pattern,
   orange outlined titles and the Sumi Kaze Brush font. */

@font-face {
  font-family: "Sumi Kaze Brush";
  src: url("../fonts/SumiKazeBrush-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper-text: #38210f;
  --button-text: #211709;
  --title-top: #ffde40;
  --title-bottom: #f56b14;
  --title-outline: #3d1405;
  --gold: #f2c14e;
  --night: #0e1420;
  --attack: #d94738;
  --defense: #4080d9;
  --chakra: #33b3d9;
  --item: #e6b333;
  --assist: #66bf59;
  --reverse: #9959cc;
  --wildcard: #f28026;
  --brush: "Sumi Kaze Brush", "Segoe Print", cursive;
  --heading: "Arial Black", "Arial Bold", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--brush);
  font-size: 20px;
  line-height: 1.45;
  color: #fff;
  background-color: #1d4466;
  background-image: url("../images/ui/ui_menu_pattern.png");
  background-size: 200px 200px;
  animation: pattern-drift 60s linear infinite;
  overflow-x: hidden;
}

/* A soft dark shade and vignette over the pattern, like the menu. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(4, 6, 14, 0.05) 30%, rgba(4, 6, 14, 0.7) 100%),
    rgba(4, 6, 14, 0.22);
  z-index: 0;
}

@keyframes pattern-drift {
  from { background-position: 0 0; }
  to { background-position: 400px 200px; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .cutin *, .cutin, .hero-bg { animation: none !important; }
  .cutin { transform: none; }
  .cutin .fighter, .cutin .attack-name { transform: none; }
  .hero-copy { opacity: 1; }
}

a { color: inherit; }

img { max-width: 100%; display: block; }

main, header, footer { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ header: the wood bar */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  border-style: solid;
  border-width: 18px;
  border-image: url("../images/ui/ui_wood_bar.png") 18 fill / 18px stretch;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.nav-side { display: flex; gap: 14px; }
.nav-side.left { justify-content: flex-end; }
.nav-side.right { justify-content: flex-start; }

.logo { display: block; }
.logo img { height: 70px; width: auto; max-width: none; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); }

/* Header buttons: the scroll ends already give them width, so only a little padding inside. */
.site-header .scroll-btn { min-width: 130px; padding: 4px 12px; }

/* ------------------------------------------------------------------ scroll buttons */

.scroll-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 60px;
  padding: 4px 34px;
  border-style: solid;
  border-width: 20px 36px;
  border-image: url("../images/ui/ui_scroll_button.png") 24 44 fill / 20px 36px stretch;
  font-family: var(--brush);
  font-size: 26px;
  line-height: 1;
  color: var(--button-text);
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  background: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.scroll-btn:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.08) sepia(0.15); }
.scroll-btn:active { transform: translateY(1px) scale(0.98); filter: brightness(0.8); }
.scroll-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }

/* The page you are on: a warm glow and the gold arrow under it. */
.scroll-btn.active { filter: drop-shadow(0 0 8px rgba(255, 210, 90, 0.9)); position: relative; }
.scroll-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -30px;
  width: 22px;
  height: 22px;
  transform: translateX(-50%) rotate(180deg);
  background: url("../images/ui/ui_gold_arrow.png") center / contain no-repeat;
}

.scroll-btn.big { min-width: 240px; min-height: 76px; font-size: 32px; }
.scroll-btn.locked { filter: grayscale(1) brightness(0.8); cursor: default; }
.scroll-btn.locked:hover { transform: none; }
/* A button that looks like a link, inside running text (e.g. "Log in" on the Play page). */
.link-button { padding: 0; border: none; background: none; font: inherit; color: #8c2a0c; text-decoration: underline; cursor: pointer; }
.link-button:disabled { cursor: default; opacity: 0.6; }

/* ------------------------------------------------------------------ titles: orange with a thick dark outline */

.title {
  margin: 0 0 18px;
  font-family: var(--heading);
  font-weight: 900;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--title-top) 15%, var(--title-bottom) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(1.5px 0 0 rgba(255, 255, 255, 0.85)) drop-shadow(-1.5px 0 0 rgba(255, 255, 255, 0.85))
    drop-shadow(0 3px 0 var(--title-outline)) drop-shadow(0 -3px 0 var(--title-outline))
    drop-shadow(3px 0 0 var(--title-outline)) drop-shadow(-3px 0 0 var(--title-outline))
    drop-shadow(3px 4px 2px rgba(0, 0, 0, 0.5));
}
.title.small { font-size: clamp(22px, 3vw, 32px); margin-bottom: 10px; }

/* ------------------------------------------------------------------ panels */

main { max-width: 1180px; margin: 0 auto; padding: 36px 16px 60px; }

section { margin-bottom: 48px; }

.paper {
  border-style: solid;
  border-width: 26px;
  border-image: url("../images/ui/ui_paper_panel.png") 30 fill / 26px stretch;
  color: var(--paper-text);
  padding: 6px 10px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.paper p { margin: 0 0 12px; }
.paper p:last-child { margin-bottom: 0; }
.paper strong { color: #8c2a0c; }

.wood {
  border-style: solid;
  border-width: 18px;
  border-image: url("../images/ui/ui_wood_bar.png") 18 fill / 18px stretch;
  padding: 4px 8px;
}

.grid { display: grid; gap: 24px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ------------------------------------------------------------------ hero: an attack cut-in */

.hero {
  position: relative;
  margin: 0 -16px 48px;
  padding: 34px 0 34px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  background: #1a2433;
  border-bottom: 4px solid rgba(0, 0, 0, 0.5);
}

/* The scrolling village. The strip is the picture plus its mirror image, so it joins up seamlessly; two strips
   side by side slide left by half their width (exactly one strip), then the loop starts again unnoticed. */
.hero-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: max-content;
  animation: hero-scroll 90s linear infinite;
  z-index: 0;
}
.hero-bg img { height: 100%; width: auto; max-width: none; flex: none; }
@keyframes hero-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* A dark fade over the village so the text stays readable. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 10, 20, 0.2), rgba(8, 10, 20, 0.8));
  z-index: 1;
  pointer-events: none;
}

.cutin {
  --band-y: 0;
  position: relative;
  width: 100%;
  height: clamp(240px, 32vw, 400px);
  transform: translateY(var(--band-y)) scaleY(0);
  background: linear-gradient(90deg, rgba(120, 30, 12, 0.95), rgba(40, 14, 10, 0.92));
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.6), 0 12px 40px rgba(0, 0, 0, 0.7);
  animation: band-open 0.35s 0.2s ease-out forwards;
  overflow: hidden;
  z-index: 2;
}
/* Sasuke's colour: a blue fade instead of the red-orange one. */
.cutin.blue { background: linear-gradient(90deg, rgba(28, 78, 170, 0.95), rgba(8, 16, 44, 0.92)); }

/* Speed lines: a strip and its mirror image side by side, so the pattern repeats without a seam.
   It scrolls by exactly one strip width per cycle, so every loop ends where the next one starts. */
.cutin::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/ui/speedlines_loop.webp") 0 0 / 1600px 100% repeat-x;
  opacity: 0.5;
  animation: lines 1.2s linear infinite;
}
.cutin .fighter {
  position: absolute;
  left: 2%;
  bottom: -6%;
  height: 118%;
  width: auto;
  max-width: none;
  transform: translateX(-120%);
  animation: fly-in 0.55s 0.45s cubic-bezier(0.2, 1.3, 0.5, 1) forwards;
  filter: drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.35));
}
.cutin .attack-name {
  position: absolute;
  right: 4%;
  bottom: 10%;
  margin: 0;
  font-family: var(--brush);
  font-size: clamp(34px, 5.5vw, 76px);
  color: #fff;
  text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  transform: translateX(140%);
  animation: name-in 0.4s 0.8s ease-out forwards;
}

@keyframes band-open { to { transform: translateY(var(--band-y)) scaleY(1); } }
@keyframes fly-in { to { transform: translateX(0); } }
@keyframes name-in { to { transform: translateX(0); } }
@keyframes lines { from { background-position: 0 0; } to { background-position: 1600px 0; } }

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(760px, 92%);
  margin: 26px auto 0;
  text-align: center;
  opacity: 0;
  animation: fade-up 0.5s 1.2s ease-out forwards;
}
.hero-copy .tagline { margin: 0 0 18px; font-size: 26px; text-shadow: 2px 2px 0 #000; }
.hero-copy .buttons { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ card types */

.type-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.type {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: start;
}
.type img { width: 52px; height: 52px; }
.type h3 { margin: 0 0 4px; font-family: var(--heading); font-size: 17px; text-transform: uppercase; }
.type p { margin: 0; font-size: 17px; line-height: 1.3; }

/* ------------------------------------------------------------------ cards, like the in-game card view */

.cards { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; }
.card {
  --type: var(--attack);
  position: relative;
  width: 190px;
  aspect-ratio: 0.7;
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--type) 85%, #fff 15%), color-mix(in srgb, var(--type) 70%, #000 30%));
  box-shadow: 0 0 0 3px #1a1410, 0 10px 22px rgba(0, 0, 0, 0.55);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-8px) rotate(-1deg); }
.card .name {
  font-size: 18px;
  line-height: 1.1;
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  min-height: 2.2em;
  display: grid;
  place-items: center;
}
.card .art { border-radius: 6px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.6); }
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card .stats { display: flex; justify-content: space-between; gap: 6px; }
.card .stat {
  flex: 1;
  border-radius: 6px;
  background: rgba(10, 8, 6, 0.75);
  text-align: center;
  font-size: 16px;
  padding: 2px 0;
}
.card .stat b { font-family: var(--heading); font-size: 20px; color: var(--title-top); }
.card .type-badge { position: absolute; top: -12px; right: -12px; width: 40px; height: 40px; filter: drop-shadow(0 2px 2px #000); }
.card.ultimate { box-shadow: 0 0 0 3px #1a1410, 0 0 22px 6px rgba(255, 200, 60, 0.6), 0 10px 22px rgba(0, 0, 0, 0.55); }

/* ------------------------------------------------------------------ characters (like the Story screen tiles) */

.roster { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px; }
.tile { text-align: center; }
.tile .face { background: #d9ccad; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.35); }
.tile .face img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.tile .who { margin-top: 8px; font-size: 22px; }
.tile .status { line-height: 1.2; }
.tile .status { font-size: 16px; color: var(--gold); }
.tile.locked .face img { filter: brightness(0); }
.tile.locked .who { opacity: 0.8; }

/* ------------------------------------------------------------------ news */

.news-item { margin-bottom: 26px; }
.news-item .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 17px; }
.tag {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: #8c2a0c;
  color: #fff3d6;
  font-size: 15px;
  text-shadow: none;
}
.news-item h2 { margin: 0 0 8px; font-family: var(--heading); font-size: clamp(20px, 2.6vw, 28px); color: #8c2a0c; text-transform: uppercase; }
.news-item ul { margin: 0 0 12px; padding-left: 22px; }
/* A smaller follow-up update inside a post (e.g. 0.0.9b under 0.0.9). */
.news-item .sub-post { clear: both; margin-top: 18px; padding-top: 14px; border-top: 2px dashed rgba(56, 33, 15, 0.35); }
.news-item .sub-post .tag { background: #b5571e; }
.news-item .sub-post h3 { margin: 0 0 6px; font-family: var(--heading); font-size: clamp(17px, 2vw, 21px); color: #8c2a0c; text-transform: uppercase; }
.news-item .art { float: right; width: min(260px, 40%); margin: 0 0 10px 18px; }

/* ------------------------------------------------------------------ support: FAQ as scrolls */

.faq details { margin-bottom: 16px; }
.faq summary {
  list-style: none;
  cursor: pointer;
  border-style: solid;
  border-width: 20px 36px;
  border-image: url("../images/ui/ui_scroll_button.png") 24 44 fill / 20px 36px stretch;
  color: var(--button-text);
  font-size: 22px;
  padding: 0 10px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: " +"; }
.faq details[open] summary::after { content: " -"; }
.faq summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.faq .answer { margin: 8px 18px 0; }

kbd {
  display: inline-block;
  padding: 0 8px;
  border-radius: 5px;
  background: #3a2614;
  color: #ffe9b8;
  font-family: var(--heading);
  font-size: 15px;
  text-shadow: none;
  box-shadow: 0 2px 0 #1a1008;
}

/* ------------------------------------------------------------------ play */

.play-panel { text-align: center; }
.play-panel .art { width: 100%; max-width: 520px; margin: -20px auto 0; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6)); }
.play-panel .buttons { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin: 18px 0 8px; }
.note { font-size: 16px; opacity: 0.85; }

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: 12px; margin-bottom: 12px; align-items: start; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #8c2a0c;
  color: #fff3d6;
  font-family: var(--heading);
  text-shadow: none;
}

/* ------------------------------------------------------------------ footer */

.site-footer { text-align: center; padding: 20px 16px 40px; font-size: 16px; color: rgba(255, 255, 255, 0.8); }
.site-footer .wood { max-width: 900px; margin: 0 auto; }
/* "Support me here:" with the Buy me a coffee plate. */
.support-me { margin: 0 auto 22px; text-align: center; }
.support-me p { margin: 0 0 8px; font-size: 24px; color: #fff; text-shadow: 2px 2px 0 #000; }
.support-me a { display: inline-block; transition: transform 0.12s ease, filter 0.12s ease; }
.support-me a:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.08) drop-shadow(0 0 10px rgba(255, 210, 90, 0.6)); }
.support-me a:active { transform: scale(0.98); }
.support-me a:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 8px; }
.support-me img { width: min(320px, 80vw); height: auto; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)); }

/* ------------------------------------------------------------------ login: a wooden tag hanging under the header */

.account-tab {
  position: absolute;
  right: 22px;
  bottom: -46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  min-height: 40px;
  padding: 2px 6px;
  border-style: solid;
  border-width: 12px;
  border-image: url("../images/ui/ui_wood_bar.png") 18 fill / 12px stretch;
  font-family: var(--brush);
  font-size: 19px;
  line-height: 1;
  color: #fff3d6;
  text-shadow: 1px 1px 0 #000;
  background: none;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease, filter 0.12s ease;
}
/* The two little ropes the tag hangs from. */
.account-tab::before, .account-tab::after {
  content: "";
  position: absolute;
  top: -22px;
  width: 4px;
  height: 14px;
  background: #c79a4a;
  border-radius: 2px;
}
.account-tab::before { left: 10px; }
.account-tab::after { right: 10px; }
.account-tab:hover { transform: translateY(2px); filter: brightness(1.12); }
.account-tab:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.account-tab:disabled { opacity: 0.6; cursor: default; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--title-top), var(--title-bottom));
  color: var(--title-outline);
  font-family: var(--heading);
  font-size: 15px;
  text-shadow: none;
  box-shadow: 0 0 0 2px var(--title-outline);
}
.account-badge.big { width: 56px; height: 56px; font-size: 28px; }
.account-badge { overflow: hidden; }
.account-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-badge.big { width: 72px; height: 72px; }

/* Profile picture picker in the account panel. */
.auth-pictures { margin: 6px 0 4px; }
.auth-label { margin: 0 0 2px; font-size: 18px; }
.auth-hint { margin: 0 0 8px; font-size: 14px; opacity: 0.8; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.avatar-option {
  position: relative;
  padding: 0;
  border: 3px solid #6b4a26;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1410;
  cursor: pointer;
  aspect-ratio: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.avatar-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-option:hover { transform: translateY(-2px); }
.avatar-option:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.avatar-option.chosen { border-color: var(--gold); box-shadow: 0 0 0 3px #8c2a0c, 0 0 14px rgba(255, 200, 60, 0.8); }
.avatar-option:disabled { cursor: wait; }
/* Locked: needs an achievement from the game. */
.avatar-option .lock { display: none; }
.avatar-option.locked { border-color: #4a443d; cursor: help; }
.avatar-option.locked img { filter: grayscale(1) brightness(0.35); }
.avatar-option.locked .lock {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 1px 3px #000;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 14, 0.7);
}
.auth-panel { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-x: hidden; overflow-y: auto; }
.auth-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #8c2a0c;
  color: #fff3d6;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 #3d1405;
}
.auth-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.auth-panel .title.small { padding-right: 40px; }
.auth-form { display: grid; gap: 12px; }
.auth-form .scroll-btn { justify-self: center; }
.auth-field { display: grid; gap: 4px; font-size: 18px; }
.auth-field input {
  font: inherit;
  font-family: var(--heading);
  font-size: 16px;
  padding: 10px 12px;
  border: 2px solid #6b4a26;
  border-radius: 6px;
  background: #fffaf0;
  color: var(--paper-text);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.12);
}
.auth-field input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.auth-message { min-height: 1.2em; margin: 0; font-size: 17px; color: #b3261e; }
.auth-message.ok { color: #2e7d32; }
.auth-message:empty { display: none; }
.auth-links { margin: 14px 0 0; text-align: center; font-size: 17px; }
.auth-panel .link {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: #8c2a0c;
  text-decoration: underline;
  cursor: pointer;
}
.auth-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.auth-profile strong { font-size: 22px; }
.auth-verify { font-size: 17px; }
.auth-actions { display: flex; justify-content: center; margin-top: 12px; }

/* The menu that drops from the account tab when you're logged in: Profile, Achievements, Log out. */
.account-menu {
  position: absolute;
  right: 22px;
  top: calc(100% + 54px);
  z-index: 30;
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 2px;
  border-width: 14px;
  border-image-width: 14px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6);
  transform-origin: top;
  animation: menu-drop 0.14s ease-out;
}
@keyframes menu-drop { from { transform: scaleY(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
.account-menu-item {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: none;
  font-family: var(--brush);
  font-size: 20px;
  color: #fff3d6;
  text-align: left;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
}
.account-menu-item:hover, .account-menu-item:focus-visible { background: rgba(255, 210, 90, 0.18); color: var(--gold); outline: none; }

/* ------------------------------------------------------------------ achievements page */

.achievement-count { margin: -6px 0 18px; text-align: center; font-family: var(--brush); font-size: 24px; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.achievement-list { display: grid; gap: 16px; max-width: 900px; margin: 0 auto; padding: 0; list-style: none; }
.achievement { display: flex; align-items: center; gap: 22px; }
.achievement-text { min-width: 0; }
.achievement-text .title.small { margin: 0 0 4px; }
.achievement-date { margin: 0 0 6px !important; font-family: var(--brush); font-size: 18px; }
.achievement.unlocked .achievement-date { color: #2e7d32; }
.achievement.locked .achievement-date { color: #6b6560; }
.achievement-description { margin: 0 !important; }
.achievement.locked { filter: saturate(0.6); }

/* The icon: the picture inside a frame (the frame is the padding, so the shine can cross both). */
.achievement-icon {
  position: relative;
  flex: none;
  width: 112px;
  aspect-ratio: 1;
  padding: 9px;
  border-radius: 10px;
  overflow: hidden;
}
.achievement-icon img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 3px; image-rendering: pixelated; }
/* Unlocked: polished gold with a glow and a light sweeping across now and then. */
.achievement.unlocked .achievement-icon {
  background: linear-gradient(135deg, #fff7c9 0%, #f6d465 22%, #d99a18 52%, #ffe28a 70%, #8f5b06 100%);
  box-shadow: 0 0 16px rgba(255, 200, 60, 0.75), 0 4px 10px rgba(0, 0, 0, 0.45),
              inset 1px 1px 0 rgba(255, 255, 255, 0.8), inset -1px -1px 0 rgba(90, 50, 0, 0.8);
}
.achievement.unlocked .achievement-icon img { box-shadow: 0 0 0 2px rgba(110, 65, 0, 0.75); }
.achievement.unlocked .achievement-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 252, 230, 0.8) 50%, transparent 62%);
  transform: translateX(-130%);
  animation: achievement-shine 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes achievement-shine { 0% { transform: translateX(-130%); } 22%, 100% { transform: translateX(130%); } }
/* Locked: rough grey stone, the picture a dark carving in it. */
.achievement.locked .achievement-icon {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18) 0 1.5px, transparent 2.5px) 0 0 / 9px 9px,
    radial-gradient(circle at 60% 70%, rgba(0, 0, 0, 0.22) 0 2px, transparent 3px) 0 0 / 13px 13px,
    linear-gradient(135deg, #b0b0ac 0%, #7d7d79 50%, #4f4f4c 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 1px 1px 0 rgba(255, 255, 255, 0.35), inset -1px -1px 0 rgba(0, 0, 0, 0.5);
}
.achievement.locked .achievement-icon img { filter: grayscale(1) brightness(0.4) contrast(1.15); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4); }
.achievements-signin { max-width: 640px; margin: 0 auto; text-align: center; }
.achievement-share { margin: -8px 0 18px; text-align: center; font-size: 17px; color: #fff3d6; text-shadow: 1px 1px 0 #000; }
.achievement-share a, .auth-public a { color: var(--gold); }
.auth-public { margin: -4px 0 10px; font-size: 16px; }
.auth-public a { color: #8c2a0c; }

/* ------------------------------------------------------------------ public profile (/user/<name>) */

.public-profile { display: flex; align-items: center; gap: 26px; max-width: 900px; margin: 0 auto 28px; }
.public-picture {
  display: grid;
  place-items: center;
  flex: none;
  width: 150px;
  aspect-ratio: 1;
  border: 6px solid #6b4a26;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1410;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}
.public-picture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.public-letter { font-family: var(--heading); font-size: 72px; color: #fff3d6; }
.public-info { min-width: 0; }
.public-info .title { margin: 0 0 4px; font-size: clamp(30px, 5vw, 48px); overflow-wrap: anywhere; }
.public-info p { margin: 0 0 4px !important; }
.public-handle { font-size: 20px; color: #8c2a0c; }
.public-since, .public-count { font-size: 18px; }
.public-message { max-width: 640px; margin: 0 auto; text-align: center; }
#profile > .title { max-width: 900px; margin: 0 auto 18px; }
.public-record { font-size: 18px; }

/* Stats from the game: a grid of small parchment tiles, the number big, its name under it. */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-width: 900px; margin: 0 auto 28px; padding: 0; list-style: none; }
.stat { text-align: center; padding: 16px 10px !important; }
.stat-value { margin: 0 !important; font-family: var(--brush); font-size: 30px; line-height: 1.1; color: #8c2a0c; overflow-wrap: anywhere; }
.stat-label { margin: 4px 0 0 !important; font-size: 16px; }
.stat.wide { grid-column: span 2; }
@media (prefers-reduced-motion: reduce) {
  .achievement.unlocked .achievement-icon::after, .account-menu { animation: none; }
}

/* ------------------------------------------------------------------ friends page (friends.html) */

.friends-invite { max-width: 900px; margin: 0 auto 18px; }
.friends-invite label { display: block; margin-bottom: 8px; font-family: var(--brush); font-size: 22px; }
.friends-invite-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.friends-invite-row input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid #8b6a3e;
  border-radius: 6px;
  background: #fffaf0;
  font: inherit;
  font-size: 18px;
  color: var(--paper-text);
}
.friends-invite-row input:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.friends-message { min-height: 1.2em; margin: 8px 0 0 !important; font-size: 17px; color: #b3261e; }
.friends-message.ok { color: #2e7d32; }
.friends-message:empty { display: none; }
.friends-tabs { display: flex; justify-content: center; gap: 10px; max-width: 900px; margin: 0 auto 14px; }
.friends-tab {
  padding: 8px 20px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(20, 14, 8, 0.65);
  font-family: var(--brush);
  font-size: 22px;
  color: #fff3d6;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
}
.friends-tab:hover { color: var(--gold); }
.friends-tab.active { background: var(--gold); color: #2a1a08; text-shadow: none; }
.friends-tab:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.friends-panel { max-width: 900px; margin: 0 auto; }
.friends-panel > div > .title.small { margin: 18px 0 10px; }
.friends-empty { padding: 14px; text-align: center; color: #fff3d6; text-shadow: 1px 1px 0 #000; }
.friend-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.friend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.friend-who { display: flex; flex: 1 1 220px; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; }
a.friend-who:hover .friend-name { text-decoration: underline; }
.friend-picture {
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border: 3px solid #6b4a26;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1410;
  font-family: var(--heading);
  font-size: 26px;
  color: #fff3d6;
}
.friend-picture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.friend-name { display: flex; flex-direction: column; min-width: 0; font-family: var(--brush); font-size: 22px; overflow-wrap: anywhere; }
.friend-name small { font-size: 15px; color: #8c2a0c; }
.friend-record, .friend-rate { display: flex; flex-direction: column; align-items: center; min-width: 90px; }
.friend-record b, .friend-rate b { font-size: 22px; }
.friend-record small, .friend-rate small { font-size: 14px; opacity: 0.8; }
.friend-actions { display: flex; align-items: center; gap: 14px; }
.scroll-btn.small { min-width: 0; min-height: 44px; padding: 0 8px; border-width: 13px 24px; border-image-width: 13px 24px; font-size: 19px; }

/* ------------------------------------------------------------------ smaller screens */

/* Not enough room for logo and four buttons in one row: logo on top, the buttons below it. */
@media (max-width: 1200px) {
  .header-inner { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; }
  .logo { order: -1; flex: 0 0 100%; display: flex; justify-content: center; }
  .logo img { height: auto; width: min(420px, 82vw); }
  .nav-side, .nav-side.left, .nav-side.right { display: contents; }
  .site-header .scroll-btn { min-width: 0; padding: 4px 14px; }
}

@media (max-width: 980px) {
  .type-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 18px; }
  .site-header { padding: 6px 4px; border-width: 14px; border-image-width: 14px; }
  .header-inner { gap: 8px 6px; }
  .logo img { width: min(320px, 82vw); }
  .scroll-btn { min-width: 0; min-height: 44px; padding: 0 2px; border-width: 13px 21px; border-image-width: 13px 21px; font-size: 18px; }
  .scroll-btn.big { min-width: 0; min-height: 56px; font-size: 22px; border-width: 16px 28px; border-image-width: 16px 28px; }
  .scroll-btn.active::after { bottom: -20px; width: 14px; height: 14px; }
  .hero { padding: 26px 0 28px; }
  .cutin { height: 260px; }
  .hero-copy { margin-top: 22px; }
  .grid.two, .grid.three, .grid.four, .type-list { grid-template-columns: minmax(0, 1fr); }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { width: 150px; }
  .account-tab { right: 12px; bottom: -42px; font-size: 17px; }
  .account-menu { right: 12px; top: calc(100% + 48px); }
  .achievement { gap: 14px; }
  .achievement-icon { width: 80px; padding: 7px; }
  .public-profile { flex-direction: column; text-align: center; gap: 14px; }
  .public-picture { width: 120px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .friend-record, .friend-rate { min-width: 70px; }
  .friends-tab { font-size: 19px; padding: 8px 14px; }
  .stat-value { font-size: 24px; }
  .play-panel .art { max-width: 220px; margin-top: -10px; }
  .news-item .art { float: none; width: 100%; margin: 0 0 10px; }
}
