nav {
  position: relative;
  width: 100%;
  height: 72px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding-top: 9px;
  margin-top: 38px;
}
nav button {
  font-size: 20px;
  color: var(--muted);
  min-width: 80px;
}
nav button.active {
  color: var(--coral);
}
nav small {
  display: block;
  font: 10px monospace;
  color: var(--muted);
  margin-top: 4px;
}
.site-footer {
  margin: 28px 0 0;
  padding: 16px 0 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
@media (min-width: 600px) {
  .app-shell {
    margin: 20px auto;
    min-height: calc(100vh - 40px);
    box-shadow: 0 12px 50px #7775;
    border-radius: 8px;
  }
  nav {
    border-radius: 0 0 8px 8px;
  }
}
.hero-art {
  height: 126px;
  margin: -10px -22px 24px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
  padding-right: 52px;
  position: relative;
  background: linear-gradient(125deg, #30264f, #d85f78 52%, #f6c85f);
  transform: rotate(-1deg);
  box-shadow: inset 0 -8px 0 #1d1d1b33;
}
.hero-art span,
.hero-art b {
  display: grid;
  place-items: center;
  width: 38px;
  height: 48px;
  border: 2px solid #fff9f0;
  border-radius: 8px;
  background: #fff9f0;
  color: #30264f;
  font: 900 24px monospace;
  box-shadow: 0 5px 0 #211a36;
  transform: rotate(var(--tilt, 0deg));
  animation: hero-tile-float 3.5s ease-in-out infinite;
}
.hero-art span:nth-child(2n) { --tilt: 4deg; animation-delay: -0.8s; }
.hero-art span:nth-child(3n) { --tilt: -5deg; animation-delay: -1.7s; }
.hero-art b {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lime);
  color: #30264f;
  font-size: 17px;
  animation-delay: -2.4s;
}
.hero-art .avatar {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 1;
  width: 38px;
  height: 38px;
  border: 2px solid #fff9f0;
  box-shadow: 0 3px 0 #211a36;
  font-size: 18px;
  transform: translateY(-50%);
}
.hero-art .avatar:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}
@keyframes hero-tile-float {
  0%, 100% { transform: translateY(2px) rotate(var(--tilt, 0deg)); }
  50% { transform: translateY(-6px) rotate(var(--tilt, 0deg)); }
}
.mode-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: #ebe9e2;
  padding: 14px;
  margin: 20px 0 28px;
}
.mode-panel div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mode-panel small {
  font: 10px monospace;
  color: var(--coral);
  letter-spacing: 1px;
}
.mode-panel strong {
  font-size: 13px;
}
.mode-panel span {
  font-size: 11px;
  color: var(--muted);
}
.mode-panel button {
  font-size: 25px;
  color: var(--coral);
}
.random-start {
  font: 700 11px monospace;
  color: var(--ink) !important;
  background: var(--lime);
  padding: 9px 11px !important;
  white-space: nowrap;
}
.mode-panel {
  gap: 8px;
}
.mode-panel button:hover {
  transform: none;
}

.game-mode-stack {
  display: grid;
  gap: 12px;
  margin: 14px 0 28px;
}
.game-mode-card {
  position: relative;
  width: 100%;
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 18px;
  text-align: left;
  color: #201a34;
  border: 2px solid var(--mode-edge, #fff8cc);
  border-radius: 18px;
  background: linear-gradient(120deg, var(--mode-start), var(--mode-end));
  box-shadow: 0 6px 0 var(--mode-shadow, #5c4b7d);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.game-mode-card:hover,
.game-mode-card:focus-visible {
  transform: translateY(-3px) rotate(-0.3deg);
  box-shadow: 0 9px 0 var(--mode-shadow, #5c4b7d);
}
.game-mode-card:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--mode-shadow, #5c4b7d);
}
.game-mode-card > span {
  width: 48px;
  font-size: 36px;
  text-align: center;
  filter: drop-shadow(0 2px 0 #ffffff99);
}
.game-mode-card > div {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}
.game-mode-card small {
  font: 900 11px/1.1 monospace;
  letter-spacing: 0.06em;
}
.game-mode-card strong {
  font-size: 18px;
  line-height: 1.1;
}
.game-mode-card em {
  color: inherit;
  font-size: 13px;
  line-height: 1.1;
  font-style: normal;
  opacity: 0.78;
}
.game-mode-card > b {
  font-size: 29px;
}
.mode-classic { --mode-start: #b7f5ff; --mode-end: #80b9ff; --mode-edge: #e7fbff; --mode-shadow: #5682bb; }
.mode-daily { --mode-start: #ffe88b; --mode-end: #ffab72; --mode-edge: #fff5be; --mode-shadow: #c97848; }
.mode-echo { --mode-start: #d7c6ff; --mode-end: #a6b8ff; --mode-edge: #f2edff; --mode-shadow: #7469b8; }
.mode-curse { --mode-start: #c5d8ff; --mode-end: #8297e9; --mode-edge: #edf2ff; --mode-shadow: #596db7; }
.mode-bounty { --mode-start: #fff0a1; --mode-end: #d9a7ff; --mode-edge: #fff7ce; --mode-shadow: #9b69c8; }
.mode-heist { --mode-start: #b5f4db; --mode-end: #67c9bf; --mode-edge: #e5fff4; --mode-shadow: #418c88; }
.mode-relay { --mode-start: #ffd4e3; --mode-end: #f19ab9; --mode-edge: #fff0f6; --mode-shadow: #b56d8b; }
.mode-daily.is-featured {
  min-height: 104px;
  border-width: 3px;
}
.mode-random { --mode-start: #e2ff84; --mode-end: #7fe5a6; --mode-edge: #f6ffc4; --mode-shadow: #48956b; }
.mode-random.is-featured {
  min-height: 110px;
  border-width: 3px;
  box-shadow: 0 5px 0 var(--mode-shadow);
}
.mode-random.is-featured::before {
  content: "★ FEATURED";
  position: absolute;
  top: 8px;
  right: 64px;
  color: #326448;
  font: 900 9px monospace;
  letter-spacing: 0.12em;
}
.mode-sudden { --mode-start: #ffe16b; --mode-end: #ff9f65; --mode-edge: #fff3af; --mode-shadow: #c9743d; }
.mode-dirty { --mode-start: #e9b7ff; --mode-end: #d77bc7; --mode-edge: #f8dbff; --mode-shadow: #985184; }
.mode-race { --mode-start: #ffb0bc; --mode-end: #ff6f81; --mode-edge: #ffe0e5; --mode-shadow: #bd4b60; }
.mode-minimum { --mode-start: #b7f0d0; --mode-end: #67d5cf; --mode-edge: #ddfff1; --mode-shadow: #459c9a; }
.mode-blitz { --mode-start: #fff16b; --mode-end: #ff8d67; --mode-edge: #fff8bd; --mode-shadow: #c75d42; }
.mode-longhaul { --mode-start: #d5c4ff; --mode-end: #9a83e8; --mode-edge: #eee7ff; --mode-shadow: #6650ae; }
.mode-scoreattack { --mode-start: #ffd0a3; --mode-end: #ff8f72; --mode-edge: #ffebd5; --mode-shadow: #bb5f4c; }
.mode-chain { --mode-start: #b9f2dc; --mode-end: #68c9b3; --mode-edge: #e2fff4; --mode-shadow: #458c7d; }
.mode-custom { --mode-start: #c3c8ff; --mode-end: #8e93f5; --mode-edge: #ebecff; --mode-shadow: #6368b9; }
.mode-dictionary { --mode-start: #ffd3a8; --mode-end: #f7a568; --mode-edge: #ffebd6; --mode-shadow: #bd7140; }
.mode-random #reroll {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: #ffffff80;
  color: inherit;
  font-size: 24px;
}
@media (max-width: 380px) {
  .hero-art { gap: 3px; padding-right: 44px; }
  .hero-art span { width: 28px; height: 38px; font-size: 18px; }
  .hero-art b { width: 24px; height: 24px; font-size: 13px; }
  .hero-art .avatar { top: 50%; right: 6px; width: 34px; height: 34px; font-size: 16px; }
  .game-mode-card { min-height: 88px; gap: 11px; padding: 12px 13px; }
  .game-mode-card > span { width: 38px; font-size: 30px; }
  .game-mode-card small { font-size: 10px; }
  .game-mode-card strong { font-size: 16px; }
  .game-mode-card em { font-size: 12px; }
  .game-mode-card > b { font-size: 25px; }
}

html[data-theme="dark"] .mode-panel {
  background: #292e28;
}

html[data-theme="dark"] .hero-art {
  background: #292e28;
}

html[data-theme="dark"] nav {
  background: rgba(27, 29, 26, 0.97);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .mode-panel {
    background: #292e28;
  }
  html:not([data-theme="light"]) nav {
    background: rgba(27, 29, 26, 0.97);
  }
}

#homeScreen.active .hero-art {
  margin-bottom: 12px;
}
.home-stats {
  margin: 10px 0;
  padding: 15px 10px;
  border: 2px solid #2c1c37;
  border-radius: 18px;
  background: linear-gradient(120deg, #e3c8ff, #b7f5ff);
  box-shadow: 0 5px 0 #2c1c37;
}
#homeScreen.active .home-stats {
  margin-bottom: 10px;
}
.home-stats div { border-color: rgba(44, 28, 55, .3); }
.home-stats b { color: #5b2d7f; }
.home-friends {
  margin: 0 0 10px;
  padding: 0;
  border: 2px solid #5b2d7f;
  border-radius: 20px;
  background: linear-gradient(145deg, #fff9f0, #f5ddff);
  box-shadow: 0 5px 0 #5b2d7f;
  overflow: hidden;
}
#homeScreen.active .home-friends {
  margin-bottom: 10px;
}
.home-friends-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.home-friends-heading::-webkit-details-marker { display: none; }
.home-friends-heading::after {
  content: "→";
  color: #5b2d7f;
  font-size: 1.6rem;
  line-height: 1;
  transition: transform .18s ease;
}
.home-friends[open] .home-friends-heading::after {
  transform: rotate(90deg);
}
.home-friends-title {
  color: #5b2d7f;
  font-size: 1.25rem;
  font-weight: 800;
}
.home-friends-content {
  padding: 0 14px 14px;
}
.home-friends .multiplayer-banner {
  margin: 0 0 10px;
  box-shadow: 0 3px 0 #2c1c37;
}
.home-friends .room {
  cursor: pointer;
  border: 2px dashed #dd5f58;
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
  padding: 11px;
}
.home-friends .room:focus-visible {
  outline: 3px solid #f6c85f;
  outline-offset: 3px;
}
.home-friends .room i {
  background: #f6c85f;
  color: #5b2d7f;
  font-weight: 900;
}
.home-friends .room b { color: #2c1c37; }
.home-friends .room small { color: #6e6374; }
.home-friends .room .round {
  background: #5b2d7f;
  color: #f6c85f;
  box-shadow: 0 3px 0 #2c1c37;
}

.mode-group {
  display: grid;
  overflow: hidden;
  border: 2px solid #5b2d7f;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff9f0, #f5ddff);
  box-shadow: 0 5px 0 #5b2d7f;
}
.mode-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 16px;
  color: #5b2d7f;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 900;
  list-style: none;
}
.mode-group-heading::-webkit-details-marker { display: none; }
.mode-group-heading b {
  font-size: 1.7rem;
  line-height: 1;
  transition: transform .18s ease;
}
.mode-group[open] .mode-group-heading {
  border-bottom: 2px solid rgba(91, 45, 127, .2);
}
.mode-group[open] .mode-group-heading b {
  transform: rotate(45deg);
}
.mode-group-list {
  display: grid;
  gap: 12px;
  padding: 12px 10px 14px;
}
#homeScreen.active .game-mode-stack {
  gap: 10px;
  margin: 0;
}

nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: auto;
  gap: 10px;
  padding: 5px 0 0;
  border-top: 0;
  background: transparent;
}
nav button {
  display: flex;
  position: relative;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 82px;
  min-width: 0;
  padding: 10px 8px 9px;
  border: 2px solid #2c1c37;
  border-radius: 15px;
  background-color: #b7f5ff;
  color: #2c1c37;
  box-shadow: 0 4px 0 #2c1c37;
  font-size: 26px;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
nav button:nth-child(1) {
  background-image: linear-gradient(180deg, rgba(183, 245, 255, .05), rgba(255, 249, 240, .94)), url("assets/nav/home.webp");
  background-position: center;
  background-size: cover;
}
nav button:nth-child(2) {
  background-color: #f6c85f;
  background-image: linear-gradient(180deg, rgba(246, 200, 95, .05), rgba(255, 249, 240, .94)), url("assets/nav/stats.webp");
  background-position: center;
  background-size: cover;
}
nav button:nth-child(3) {
  background-color: #e3c8ff;
  background-image: linear-gradient(180deg, rgba(227, 200, 255, .05), rgba(255, 249, 240, .94)), url("assets/nav/progress.webp");
  background-position: center;
  background-size: cover;
}
nav button:hover,
nav button:focus-visible {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 0 6px 0 #2c1c37;
}
nav button.active {
  color: #2c1c37;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2c1c37;
}
nav small {
  position: relative;
  z-index: 1;
  color: inherit;
  margin-top: 0;
  padding: 4px 8px 3px;
  border-radius: 8px;
  background: rgba(255, 249, 240, .78);
  font: 900 12px monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}
body:has(#homeScreen.active) nav {
  margin-top: 3px;
}
body:has(#homeScreen.active) .site-footer {
  margin-top: 12px;
}
.site-footer {
  display: none;
  margin: 14px 0 0;
  padding: 14px 8px 4px;
  border-top: 2px solid #5b2d7f;
  color: #6e6374;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
body:has(#homeScreen.active) .site-footer,
body:has(#statsScreen.active) .site-footer,
body:has(#achievementsScreen.active) .site-footer,
.content-document .site-footer {
  display: block;
}
.content-screen,
.content-page {
  padding-bottom: 10px;
}
.content-page {
  padding-top: 35px;
}
.content-screen .game-head,
.content-page .game-head {
  align-items: center;
  margin-bottom: 22px;
}
.content-screen .game-head h1,
.content-page .game-head h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.65rem);
  line-height: .95;
  letter-spacing: -.065em;
}
.content-back {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
}
.content-lede {
  margin: 0 0 18px;
  color: #5e5266;
  font-size: 1rem;
  line-height: 1.55;
}
.content-cta {
  text-decoration: none;
  margin-bottom: 30px;
}
.content-section {
  margin: 30px 0 0;
  padding-top: 24px;
  border-top: 2px solid rgba(91, 45, 127, .18);
}
.content-section h2 {
  margin: 0 0 12px;
  color: #2c1c37;
  font-size: 1.35rem;
  letter-spacing: -.035em;
}
.content-section p,
.content-section li {
  color: #5e5266;
  font-size: .92rem;
  line-height: 1.55;
}
.content-section p { margin: 0 0 12px; }
.content-section a {
  color: #5b2d7f;
  font-weight: 800;
}
.faq-list {
  display: grid;
  gap: 18px;
}
.faq-list h3 {
  margin: 0 0 5px;
  color: #2c1c37;
  font-size: 1rem;
  letter-spacing: -.02em;
}
.faq-list p { margin: 0; }
.how-to-play-steps,
.how-to-play-rule-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.35rem;
}
.how-to-play-steps strong,
.how-to-play-rule-list strong { color: #2c1c37; }
.how-to-play-example {
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #2c1c37;
  border-radius: 14px;
  background: linear-gradient(120deg, #eaf9d2, #b7f5ff);
  box-shadow: 0 4px 0 #2c1c37;
}
.how-to-play-example strong {
  display: block;
  color: #2c1c37;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.how-to-play-example p { margin: 6px 0 0; color: #2c1c37; }
.how-to-play-example b { white-space: nowrap; }
.content-note {
  color: #6e6374 !important;
  font-size: .8rem !important;
}
.content-mode-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.content-mode-list article {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid #d1c1d8;
  border-radius: 10px;
  background: #fff9f0;
}
.content-mode-list strong {
  color: #2c1c37;
  font-size: .88rem;
}
.content-mode-list span {
  color: #6e6374;
  font-size: .76rem;
  line-height: 1.4;
}
html[data-theme="dark"] .content-lede,
html[data-theme="dark"] .content-section p,
html[data-theme="dark"] .content-section li { color: #d1c1d8; }
html[data-theme="dark"] .content-section h2,
html[data-theme="dark"] .how-to-play-steps strong,
html[data-theme="dark"] .how-to-play-rule-list strong,
html[data-theme="dark"] .content-mode-list strong,
html[data-theme="dark"] .faq-list h3 { color: #fff9f0; }
html[data-theme="dark"] .content-mode-list article { background: #242823; border-color: #555b53; }
html[data-theme="dark"] .content-mode-list span,
html[data-theme="dark"] .content-note { color: #aaa99f !important; }
html[data-theme="dark"] .content-section a { color: #f6c85f; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .content-lede,
  html:not([data-theme="light"]) .content-section p,
  html:not([data-theme="light"]) .content-section li { color: #d1c1d8; }
  html:not([data-theme="light"]) .content-section h2,
  html:not([data-theme="light"]) .how-to-play-steps strong,
  html:not([data-theme="light"]) .how-to-play-rule-list strong,
  html:not([data-theme="light"]) .content-mode-list strong,
  html:not([data-theme="light"]) .faq-list h3 { color: #fff9f0; }
  html:not([data-theme="light"]) .content-mode-list article { background: #242823; border-color: #555b53; }
  html:not([data-theme="light"]) .content-mode-list span,
  html:not([data-theme="light"]) .content-note { color: #aaa99f !important; }
  html:not([data-theme="light"]) .content-section a { color: #f6c85f; }
}
.mode-overview-list {
  display: grid;
  gap: 10px;
}
.mode-overview-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 13px;
  border: 1px solid #d1c1d8;
  border-radius: 12px;
  background: #fff9f0;
}
.mode-overview-card > div { min-width: 0; }
.mode-overview-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mode-overview-heading h3 {
  margin: 0;
  color: #2c1c37;
  font-size: 1rem;
  letter-spacing: -.02em;
}
.mode-overview-heading span {
  padding: 3px 6px;
  border-radius: 99px;
  background: #eaf9d2;
  color: #2c1c37;
  font-size: .67rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}
.mode-overview-card p { margin: 0; font-size: .82rem; }
.content-section .mode-overview-play {
  flex: none;
  padding: 7px 9px;
  border: 1px solid #5b2d7f;
  border-radius: 8px;
  text-decoration: none;
  font-size: .78rem;
}
html[data-theme="dark"] .mode-overview-card { background: #242823; border-color: #555b53; }
html[data-theme="dark"] .mode-overview-heading h3 { color: #fff9f0; }
html[data-theme="dark"] .mode-overview-heading span { background: #3f5239; color: #fff9f0; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .mode-overview-card { background: #242823; border-color: #555b53; }
  html:not([data-theme="light"]) .mode-overview-heading h3 { color: #fff9f0; }
  html:not([data-theme="light"]) .mode-overview-heading span { background: #3f5239; color: #fff9f0; }
}
