/* ============================================
   TMGS4 English Guide - Retro Neocities Style
   with game assets integration
   ============================================ */

/* --- Fonts --- */
@font-face {
  font-family: 'Nunito';
  src: url('/assets/fonts/Nunito-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: 'MaruGothic';
  src:
    url('/assets/fonts/DF-FutoMaruGothic-W9-CAB-18277f51d7ae7c3bd42f53247de2bb48--4329643920678357007.woff2') format('woff2'),
    url('/assets/fonts/DF-FutoMaruGothic-W9-CAB-18277f51d7ae7c3bd42f53247de2bb48--4329643920678357007.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'MaruGothic';
  src:
    url('/assets/fonts/DF-HeiSeiMaruGothic-W4-CAB-18277f51d7ae7c3bd42f53247de2bb48-2057771419379400601.woff2') format('woff2'),
    url('/assets/fonts/DF-HeiSeiMaruGothic-W4-CAB-18277f51d7ae7c3bd42f53247de2bb48-2057771419379400601.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

/* --- CSS Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Color Palette --- */
:root {
  --pink: #e8829a;
  --pink-light: #fce7ef;
  --pink-dark: #c9536e;
  --gold: #c9a04e;
  --gold-light: #f5e6c8;
  --gold-dark: #a07830;
  --purple: #b86850;
  --cream: #fffbf5;
  --peach: #f2d6b0;
  --text: #5c4a3a;
  --text-light: #8b7a68;
  --white: #ffffff;
  --border: #e8d5c4;
  --shadow: rgba(180, 140, 80, 0.12);
  --body-bg: #f5ede4;
  --body-dot: #e8d4c0;
  --body-dot-2: #e8d0c0;
  --chrome: #e8b4a8;
  --paper-bg: #fffbf5;
  --rule: rgba(210, 160, 148, 0.08);
  --heading-stroke: #b87820;
}

html[data-theme="dark"] {
  --pink: #ee8ca4;
  --pink-light: #39222d;
  --pink-dark: #ffadc0;
  --gold: #d9b86a;
  --gold-light: #3a3020;
  --gold-dark: #f0cd83;
  --purple: #d59a86;
  --cream: #1e1a17;
  --peach: #3b2c24;
  --text: #f0dfce;
  --text-light: #c5ad99;
  --white: #26211d;
  --border: #5b493c;
  --shadow: rgba(0, 0, 0, 0.34);
  --body-bg: #151210;
  --body-dot: #352b24;
  --body-dot-2: #2d2520;
  --chrome: #4f3d35;
  --paper-bg: #211c18;
  --rule: rgba(220, 184, 146, 0.1);
  --heading-stroke: #d99a46;
  color-scheme: dark;
}

body.game-tmgs2 {
  --tmgs2-blue: #6c93ad;
  --tmgs2-blue-light: #d1dde7;
  --tmgs2-blue-dark: #354f78;
  --tmgs2-blue-ink: #273853;
  --tmgs2-purple-ink: #443958;
  --tmgs2-coral: #bd7977;
  --tmgs2-shell: #d8d2e5;
  --tmgs2-sand: #e1dfeb;
  --tmgs2-lilac: #847792;
  --tmgs2-haze: #e6e7f1;
  --pink: var(--tmgs2-blue);
  --pink-light: #e8f0f3;
  --pink-dark: var(--tmgs2-blue-dark);
  --gold: var(--tmgs2-lilac);
  --gold-light: var(--tmgs2-haze);
  --gold-dark: #5d5275;
  --purple: var(--tmgs2-lilac);
  --cream: #f2f5f6;
  --peach: var(--tmgs2-sand);
  --text: var(--tmgs2-purple-ink);
  --text-light: #6f667f;
  --white: #f7f9fa;
  --border: #adbfce;
  --shadow: rgba(58, 76, 112, 0.17);
  --body-bg: #d7e0e8;
  --body-dot: #bac9d5;
  --body-dot-2: #c9d4de;
  --chrome: #849fb6;
  --paper-bg: #f6f7f6;
  --rule: rgba(108, 147, 173, 0.14);
  --heading-stroke: #394e74;
}

html[data-theme="dark"] body.game-tmgs2 {
  --tmgs2-blue: #779fba;
  --tmgs2-blue-light: #1e3344;
  --tmgs2-blue-dark: #bfd0df;
  --tmgs2-blue-ink: #dce5ef;
  --tmgs2-purple-ink: #e1d6ed;
  --tmgs2-coral: #d58f8b;
  --tmgs2-shell: #40384f;
  --tmgs2-sand: #2e3340;
  --tmgs2-lilac: #b9aacd;
  --tmgs2-haze: #232b3b;
  --pink: var(--tmgs2-blue);
  --pink-light: #1d3a47;
  --pink-dark: var(--tmgs2-blue-dark);
  --gold: var(--tmgs2-lilac);
  --gold-light: var(--tmgs2-haze);
  --gold-dark: #d5c6e7;
  --purple: var(--tmgs2-lilac);
  --cream: #111920;
  --peach: #202d38;
  --text: var(--tmgs2-purple-ink);
  --text-light: #bdb2cd;
  --white: #17242d;
  --border: #435766;
  --shadow: rgba(0, 0, 0, 0.36);
  --body-bg: #101820;
  --body-dot: #232f3d;
  --body-dot-2: #1b2733;
  --chrome: #344b61;
  --paper-bg: #151f29;
  --rule: rgba(119, 159, 186, 0.12);
  --heading-stroke: #9baacb;
}

/* --- Background --- */
body {
  background-color: var(--body-bg);
  background-image:
    radial-gradient(circle, var(--body-dot) 1px, transparent 1px),
    radial-gradient(circle, var(--body-dot-2) 0.8px, transparent 0.8px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Scrollbar (pen-style) --- */
main::-webkit-scrollbar {
  width: 22px;
}
main::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar {
  width: 0;
}
main::-webkit-scrollbar-thumb {
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 120' preserveAspectRatio='xMidYMid meet'%3E%3Crect x='2' y='10' width='18' height='100' rx='4' fill='%23e8a030' stroke='%23c88020' stroke-width='1.5'/%3E%3Crect x='4.5' y='12' width='13' height='96' rx='3' fill='%23f0b840'/%3E%3Cg transform='translate(11,26)'%3E%3Cpolygon points='0,-6 2.5,-1.5 0,0 -2.5,-1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,-6 -2.5,-1.5 0,0 2.5,-1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='6,0 1.5,-2.5 0,0 1.5,2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='6,0 1.5,2.5 0,0 1.5,-2.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='0,6 -2.5,1.5 0,0 2.5,1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,6 2.5,1.5 0,0 -2.5,1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='-6,0 -1.5,2.5 0,0 -1.5,-2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='-6,0 -1.5,-2.5 0,0 -1.5,2.5' fill='white' opacity='0.5'/%3E%3C/g%3E%3Cg transform='translate(11,46)'%3E%3Cpolygon points='0,-6 2.5,-1.5 0,0 -2.5,-1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,-6 -2.5,-1.5 0,0 2.5,-1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='6,0 1.5,-2.5 0,0 1.5,2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='6,0 1.5,2.5 0,0 1.5,-2.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='0,6 -2.5,1.5 0,0 2.5,1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,6 2.5,1.5 0,0 -2.5,1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='-6,0 -1.5,2.5 0,0 -1.5,-2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='-6,0 -1.5,-2.5 0,0 -1.5,2.5' fill='white' opacity='0.5'/%3E%3C/g%3E%3Cg transform='translate(11,66)'%3E%3Cpolygon points='0,-6 2.5,-1.5 0,0 -2.5,-1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,-6 -2.5,-1.5 0,0 2.5,-1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='6,0 1.5,-2.5 0,0 1.5,2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='6,0 1.5,2.5 0,0 1.5,-2.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='0,6 -2.5,1.5 0,0 2.5,1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,6 2.5,1.5 0,0 -2.5,1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='-6,0 -1.5,2.5 0,0 -1.5,-2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='-6,0 -1.5,-2.5 0,0 -1.5,2.5' fill='white' opacity='0.5'/%3E%3C/g%3E%3Cg transform='translate(11,86)'%3E%3Cpolygon points='0,-6 2.5,-1.5 0,0 -2.5,-1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,-6 -2.5,-1.5 0,0 2.5,-1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='6,0 1.5,-2.5 0,0 1.5,2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='6,0 1.5,2.5 0,0 1.5,-2.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='0,6 -2.5,1.5 0,0 2.5,1.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='0,6 2.5,1.5 0,0 -2.5,1.5' fill='white' opacity='0.5'/%3E%3Cpolygon points='-6,0 -1.5,2.5 0,0 -1.5,-2.5' fill='white' opacity='0.85'/%3E%3Cpolygon points='-6,0 -1.5,-2.5 0,0 -1.5,2.5' fill='white' opacity='0.5'/%3E%3C/g%3E%3Ccircle cx='11' cy='8' r='6' fill='%23f0a020' stroke='%23d08818' stroke-width='1'/%3E%3Ccircle cx='9.5' cy='6.5' r='2' fill='white' opacity='0.35'/%3E%3Crect x='1' y='12' width='20' height='3' rx='1' fill='%23c88020' stroke='%23a06818' stroke-width='0.5'/%3E%3Cpolygon points='5,110 11,120 17,110' fill='%23c88020' stroke='%23a06818' stroke-width='0.8'/%3E%3Cpolygon points='9,112 11,120 13,112' fill='%238b6518'/%3E%3C/svg%3E");
  background-size: 20px 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: none;
  border-radius: 0;
}
main::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.08);
}

body.game-tmgs2 main::-webkit-scrollbar-thumb {
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--tmgs2-blue-light) 0%, var(--tmgs2-blue) 52%, var(--tmgs2-blue-dark) 100%);
  background-size: 10px calc(100% - 18px);
  background-position: center 9px;
  background-repeat: no-repeat;
  border: none;
  border-radius: 8px;
}

/* --- Selection --- */
::selection {
  background: var(--pink-light);
  color: var(--pink-dark);
}

/* --- Header Mascot (animated GIF) --- */
.header-mascot {
  position: absolute;
  top: 50%;
  left: 120px;
  transform: translateY(-62%);
  height: 90%;
  width: auto;
  opacity: 0.65;
  z-index: 0;
  pointer-events: none;
  object-fit: contain;
}

.game-tmgs2 .header-mascot {
  top: 54%;
  left: 210px;
  height: 76%;
  transform: translateY(-55%);
  opacity: 0.82;
}

/* --- Background Pinwheels --- */
.bg-pinwheels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-pinwheels img {
  position: absolute;
  opacity: 0.08;
  animation: spin 20s linear infinite;
}

.tmgs2-seagulls {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.tmgs2-seagull {
  position: absolute;
  left: 0;
  top: var(--top);
  width: var(--size);
  height: calc(var(--size) * 0.6667);
  opacity: var(--opacity, 0.42);
  animation: seagullFly var(--duration) linear infinite;
  animation-delay: var(--delay);
  filter: drop-shadow(0 2px 2px rgba(42, 141, 169, 0.08));
}

.tmgs2-seagull::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/assets/ui/seagull0.png') center/contain no-repeat;
  animation: seagullFlap var(--flap, 980ms) steps(1, end) infinite;
}

.tmgs2-seagull.sg-1 {
  --top: 8%;
  --size: 78px;
  --duration: 34s;
  --delay: -7s;
  --arc: -18px;
  --flap: 960ms;
}

.tmgs2-seagull.sg-2 {
  --top: 19%;
  --size: 56px;
  --duration: 48s;
  --delay: -28s;
  --arc: 20px;
  --opacity: 0.32;
  --flap: 1120ms;
}

.tmgs2-seagull.sg-3 {
  --top: 36%;
  --size: 92px;
  --duration: 58s;
  --delay: -39s;
  --arc: -28px;
  --opacity: 0.24;
  --flap: 1240ms;
}

.tmgs2-seagull.sg-4 {
  --top: 64%;
  --size: 64px;
  --duration: 52s;
  --delay: -14s;
  --arc: 16px;
  --opacity: 0.26;
  --flap: 1080ms;
}

/* --- Container --- */
#container {
  max-width: 960px;
  margin: 0 auto 30px;
  padding: 0;
  position: relative;
  z-index: 1;
  border: 5px solid var(--chrome);
  border-top: none;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--paper-bg) 92%, #fff6ea) 0%, color-mix(in srgb, var(--paper-bg) 96%, #fff2e3) 100%);
  box-shadow: 0 8px 24px rgba(180, 140, 80, 0.18);
}

.window-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  width: min(960px, calc(100% - 28px));
  margin: 24px auto 0;
  padding: 14px 22px 0;
  background: var(--chrome);
  border: 5px solid var(--chrome);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  position: relative;
  z-index: 2;
}

.window-tab {
  --accent: #e85a8e;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  max-width: 160px;
  height: 54px;
  padding: 6px 14px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 8%, #fffdf6) 0%,
    color-mix(in srgb, var(--accent) 3%, #fbf2e2) 100%);
  border: 2px solid color-mix(in srgb, var(--accent) 70%, #d8c2af);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  text-decoration: none;
  box-shadow: inset 0 1px 0 #ffffff, 0 -2px 6px rgba(180, 140, 80, 0.08);
  transition: height 200ms ease, background 160ms ease, border-color 160ms ease;
}

.window-tab img {
  display: block;
  max-width: 100%;
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.window-tab .tab-label {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  filter: brightness(0.75);
  letter-spacing: 0.03em;
}

.window-tab:hover,
.window-tab:focus-visible {
  height: 62px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 18%, #fffdf6) 0%,
    color-mix(in srgb, var(--accent) 8%, #fbf2e2) 100%);
  border-color: var(--accent);
  outline: none;
}

.window-tab-active {
  height: 60px;
}

/* Dynamic "coming soon": any series tab whose link is still a dead "#" (or empty)
   is grayed + non-interactive. Give it a real href and it un-grays automatically. */
a.window-tab[href="#"],
a.window-tab[href=""],
a.window-tab:not([href]) {
  filter: grayscale(1);
  opacity: 0.5;
  pointer-events: none;
}

.appearance-bar {
  position: absolute;
  right: 10px;
  bottom: -40px;
  z-index: 5;
}

.theme-toggle {
  width: 40px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--white) 82%, var(--cream));
  color: var(--text-light);
  font: 700 1.05rem 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--pink);
  color: var(--pink-dark);
  background: var(--pink-light);
  outline: none;
}

.theme-icon {
  line-height: 1;
}

.theme-icon-dark,
html[data-theme="dark"] .theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: inline;
}

/* --- Guide Header (TMGS4 chibi + logo block) --- */
.guide-header {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(210, 160, 148, 0.12) 27px, rgba(210, 160, 148, 0.12) 28px),
    linear-gradient(135deg, var(--pink-light) 0%, var(--gold-light) 50%, color-mix(in srgb, var(--gold-light) 55%, var(--cream)) 100%);
  border-radius: 9px 9px 0 0;
  padding: 22px 30px 18px;
  overflow: hidden;
  text-align: center;
  border: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.05);
  position: relative;
}

/* Decorative pinwheels in header */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes bubbleRiseNear {
  from {
    background-position:
      8% 110%, 26% 126%, 49% 116%, 72% 132%, 92% 118%,
      14% 170%, 38% 186%, 64% 176%, 84% 192%,
      3% 232%, 21% 218%, 34% 244%, 57% 226%, 76% 252%, 96% 236%;
  }
  to {
    background-position:
      8% -24%, 26% -8%, 49% -18%, 72% -2%, 92% -16%,
      14% 36%, 38% 52%, 64% 42%, 84% 58%,
      3% 98%, 21% 84%, 34% 110%, 57% 92%, 76% 118%, 96% 102%;
  }
}

@keyframes bubbleRiseFar {
  from {
    background-position:
      4% 130%, 19% 154%, 44% 138%, 69% 166%, 88% 146%,
      30% 214%, 56% 196%, 78% 224%,
      10% 256%, 24% 284%, 47% 268%, 63% 292%, 82% 274%, 94% 306%;
  }
  to {
    background-position:
      4% -30%, 19% -6%, 44% -22%, 69% 6%, 88% -14%,
      30% 54%, 56% 36%, 78% 64%,
      10% 96%, 24% 124%, 47% 108%, 63% 132%, 82% 114%, 94% 146%;
  }
}

@keyframes seagullFly {
  from { transform: translate3d(-22vw, 0, 0); }
  45% { transform: translate3d(44vw, var(--arc, -16px), 0); }
  to { transform: translate3d(122vw, 0, 0); }
}

@keyframes seagullFlap {
  0%, 100% { background-image: url('/assets/ui/seagull0.png'); }
  33% { background-image: url('/assets/ui/seagull1.png'); }
  66% { background-image: url('/assets/ui/seagull2.png'); }
}

.guide-header .header-pinwheel {
  position: absolute;
  opacity: 0.35;
  pointer-events: none;
  animation: spin 20s linear infinite;
}
/* Individual pinwheel positions set via inline styles in template */


.guide-header h1 {
  position: relative;
  line-height: 1;
}

.header-logo {
  width: auto;
  max-width: 100%;
  height: 92px;
  transform: rotate(-1deg);
}

.game-tmgs2 .header-logo {
  height: 108px;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.8));
}

.guide-header .subtitle {
  font-size: 0.85em;
  color: var(--gold-dark);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  letter-spacing: 1.5px;
  margin-top: -2px;
  position: relative;
}

/* --- Guide Sub-Nav (folder tabs) --- */
.guide-subnav {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 28px 0;
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(210, 160, 148, 0.1) 27px, rgba(210, 160, 148, 0.1) 28px),
    color-mix(in srgb, var(--paper-bg) 88%, #fff3e4);
  border-bottom: 1px solid var(--border);
}

.guide-subnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 180px;
  text-align: center;
  line-height: 1.14;
  white-space: normal;
  height: 62px;
  padding: 8px 12px 7px;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--pink) 38%, #d8c2af);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 8%, #fffdf6) 0%,
    color-mix(in srgb, var(--pink) 3%, #fbf2e2) 100%);
  color: #fff8ee;
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 1.35px #b87820;
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(120, 70, 10, 0.22);
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 -2px 6px rgba(180, 140, 80, 0.08);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.guide-subnav a.is-active,
.guide-subnav a[aria-current="page"] {
  height: 66px;
  padding-top: 10px;
  padding-bottom: 8px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 18%, #fffdf6) 0%,
    color-mix(in srgb, var(--pink) 8%, #fbf2e2) 100%);
  border-color: color-mix(in srgb, var(--pink) 78%, #d8c2af);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -3px 8px rgba(180, 140, 80, 0.14);
}

.guide-subnav a:hover,
.guide-subnav a:focus-visible {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 16%, #fffdf6) 0%,
    color-mix(in srgb, var(--pink) 7%, #fbf2e2) 100%);
  border-color: color-mix(in srgb, var(--pink) 72%, #d8c2af);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 -3px 8px rgba(180, 140, 80, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.guide-subnav img {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  object-fit: contain;
  image-rendering: auto;
}
.guide-subnav-label-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.02;
}
.guide-subnav-label-stack > span:nth-child(2) {
  font-size: 0.88em;
}
.guide-subnav-pinwheel {
  animation: spin 16s linear infinite;
  filter: drop-shadow(0 2px 3px rgba(120, 70, 10, 0.18));
}
.guide-subnav-pinwheel-orange {
  animation-duration: 18s;
}
.guide-subnav-pinwheel-coral {
  animation-duration: 14s;
  animation-direction: reverse;
}

/* --- Top Navigation --- */
.topnav {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0;
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(210, 160, 148, 0.1) 27px, rgba(210, 160, 148, 0.1) 28px),
    var(--cream);
  border-left: 3px solid #e8b4a8;
  border-right: 3px solid #e8b4a8;
  border-bottom: 2px dashed rgba(200, 160, 130, 0.3);
}

.topnav a {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 0.5px;
  border: none;
  background: none;
  border-right: 1px dotted rgba(200, 160, 130, 0.4);
  transition: background 0.2s, color 0.15s;
  position: relative;
}

.topnav a:last-child {
  border-right: none;
}

.topnav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: transparent;
  transition: background 0.2s;
}

.topnav a:hover {
  background: rgba(252, 228, 232, 0.5);
  color: var(--pink-dark);
}

.topnav a:hover::after {
  background: var(--pink);
}

.topnav a:active {
  background: rgba(252, 228, 232, 0.7);
}

/* --- Layout (Sidebar + Main) --- */
#layout {
  display: flex;
  gap: 0;
  border-left: 3px solid var(--chrome);
  border-right: 3px solid var(--chrome);
  background: var(--cream);
  box-shadow: 0 4px 20px var(--shadow);
  min-height: 500px;
  overflow: visible;
  position: relative;
}

#layout::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 0;
  bottom: 0;
  width: 36px;
  z-index: 4;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='150'%3E%3C!-- Coil 1 --%3E%3Cpath d='M36 5 C28 5 16 9 10 16 C5 22 3 28 3 28 C3 28 5 34 10 40 C16 47 28 51 36 51' fill='none' stroke='%23a08878' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M36 5 C28 5 16 9 10 16 C5 22 3 28 3 28 C3 28 5 34 10 40 C16 47 28 51 36 51' fill='none' stroke='%23d8c4b0' stroke-width='1.2'/%3E%3C!-- Coil 2 (wider) --%3E%3Cpath d='M36 55 C26 55 14 59 8 66 C3 72 1 78 1 78 C1 78 3 84 8 90 C14 97 26 101 36 101' fill='none' stroke='%23a08878' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M36 55 C26 55 14 59 8 66 C3 72 1 78 1 78 C1 78 3 84 8 90 C14 97 26 101 36 101' fill='none' stroke='%23d8c4b0' stroke-width='1.2'/%3E%3C!-- Coil 3 (tighter) --%3E%3Cpath d='M36 105 C30 105 20 108 14 113 C8 118 6 123 6 123 C6 123 8 128 14 133 C20 138 30 141 36 141' fill='none' stroke='%23a08878' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M36 105 C30 105 20 108 14 113 C8 118 6 123 6 123 C6 123 8 128 14 133 C20 138 30 141 36 141' fill='none' stroke='%23d8c4b0' stroke-width='1.2'/%3E%3C/svg%3E") repeat-y;
}

/* --- Sidebar --- */
.sidebar {
  width: 210px;
  min-width: 210px;
  background:
    linear-gradient(to right, transparent 14px, rgba(220, 120, 120, 0.25) 14px, rgba(220, 120, 120, 0.25) 15px, transparent 15px),
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(210, 160, 148, 0.3) 27px, rgba(210, 160, 148, 0.3) 28px),
    color-mix(in srgb, var(--paper-bg) 90%, #fff3e8);
  border-right: 2px dashed var(--border);
  padding: 16px 12px 16px 24px;
  overflow-y: auto;
  max-height: 700px;
  position: relative;
}



.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section h3 {
  font-family: 'Nunito', sans-serif;
  font-size: 1em;
  font-weight: 700;
  color: var(--pink-dark);
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 2px dotted var(--border);
  text-align: center;
}

/* Protagonist chibi at bottom of sidebar */
.sidebar-mascot {
  text-align: center;
  padding: 12px 0 4px;
  opacity: 0.85;
}

.sidebar-mascot img {
  width: 90px;
  height: auto;
}

/* --- Character Navigation --- */
.char-nav {
  list-style: none;
}

.char-nav li {
  margin-bottom: 2px;
}

.char-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85em;
  border-bottom: 1px solid rgba(184, 120, 32, 0.12);
  transition: color 0.2s, transform 0.2s, border-color 0.2s, background 0.2s;
}

.char-nav a:hover {
  background: transparent;
  color: var(--pink-dark);
  border-bottom-color: rgba(221, 127, 156, 0.34);
  transform: translateX(3px);
}

.char-nav img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  transition: border-color 0.2s;
}

.char-nav a:hover img {
  border-color: var(--pink);
}

.char-nav .coming-soon span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  background: transparent;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.85em;
  opacity: 0.55;
  border-bottom: 1px solid rgba(184, 120, 32, 0.1);
}

.char-nav .coming-soon img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  filter: grayscale(1);
}

/* --- Updates --- */
.updates {
  list-style: none;
  font-size: 0.8em;
}

.updates li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--border);
}

.updates .date {
  font-weight: 700;
  color: var(--purple);
  margin-right: 4px;
}

/* --- Sidebar Doodle --- */
.sidebar-doodle {
  text-align: center;
  padding: 12px 0 4px;
  margin-top: auto;
}

.sidebar-doodle img {
  width: 130px;
  height: 100px;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.45;
  transition: opacity 0.3s;
}

.sidebar-doodle img:hover {
  opacity: 0.8;
}

/* --- Main Content --- */
main {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  max-height: 700px;
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--rule) 27px, var(--rule) 28px),
    color-mix(in srgb, var(--cream) 68%, transparent);
}

/* Section headers with pinwheel icon */
main h2 {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1.5em;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff8ee;
  -webkit-text-stroke: 2px var(--heading-stroke);
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(120, 70, 10, 0.3);
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

main h2 .section-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

main h3 {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1.3em;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff8ee;
  -webkit-text-stroke: 2px var(--heading-stroke);
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(120, 70, 10, 0.3);
  letter-spacing: 0.04em;
  margin-top: 20px;
  margin-bottom: 8px;
}

.date-collapse {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}
.date-collapse summary {
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9em;
  color: #b87820;
  background: rgba(245, 226, 200, 0.3);
  list-style: none;
}
.date-collapse summary::before {
  content: '▸ ';
}
.date-collapse[open] summary::before {
  content: '▾ ';
}
.date-collapse summary::-webkit-details-marker {
  display: none;
}
.date-collapse ul {
  padding: 8px 14px 8px 28px;
  margin: 0;
}
.date-collapse li {
  font-size: 0.88em;
  padding: 2px 0;
}
/* Alternative requirement paths for an ending, laid out side by side to use the
   horizontal space; they wrap to fewer columns on narrow screens. */
.ending-paths {
  display: flex;
  flex-wrap: nowrap;          /* all paths share one row */
  align-items: stretch;
  padding: 4px 0;
}
.ending-path {
  flex: 1 1 0;                /* equal columns that shrink to fit */
  min-width: 0;              /* allow text to wrap instead of forcing a new row */
  margin: 0;
}
/* "OR" divider sitting vertically centred between the path columns */
.ending-or {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #b87820;
  text-transform: uppercase;
  border-left: 1px solid var(--border);    /* thin rule between columns */
}

/* ---- Date Answers --------------------------------------------------------- */
.da-legend {
  font-size: 0.78em;
  margin: 6px 14px;
  color: #8a7a66;
}
.da-spot {                /* a per-location folder nested in the Date Answers folder */
  margin: 6px 8px;
}
.da-area {
  margin: 8px;
  border-color: rgba(201, 160, 78, 0.45);
}
.da-area > summary {
  background: rgba(201, 160, 78, 0.12);
}
.da-area .da-spot {
  margin: 6px 8px 8px 16px;
}
.da-media {
  margin: 10px 14px 12px;
  max-width: 560px;
}
.da-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf2;
}
.da-prompt {
  font-weight: 700;
  font-size: 0.88em;
  margin: 10px 14px 2px;
  color: #b87820;
}
.da-answers {
  margin: 0 0 8px;
  padding-left: 30px;
  list-style: none;
}
.da-answers li {
  font-size: 0.88em;
  padding: 3px 0;
}
.da-cond {
  color: #8a7a66;
  font-size: 0.92em;
}
.da-r {                   /* rating symbol pill, coloured best→worst */
  display: inline-block;
  min-width: 1.3em;
  text-align: center;
  font-weight: 700;
  margin-right: 2px;
}
.da-r.r5 { color: #1a9e4b; }
.da-r.r4 { color: #5fb43a; }
.da-r.r3 { color: #b39800; }
.da-r.r2 { color: #d08a1e; }
.da-r.r1 { color: #d85f2a; }
.da-r.r0 { color: #cc3333; }
/* Date-spot preference lists can be long; flow them into responsive columns. */
.datespot-list {
  column-width: 16em;
  column-gap: 24px;
}
.datespot-list li {
  break-inside: avoid;
}

.cutscene-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin: 8px 0;
}
.cutscene-table th {
  background: rgba(245, 226, 200, 0.4);
  color: #b87820;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.cutscene-table td {
  padding: 6px 10px;
  border-bottom: 1px dotted var(--border);
  vertical-align: top;
}
.cutscene-table tr:hover td {
  background: rgba(245, 226, 200, 0.15);
}
.cutscene-table td:first-child {
  font-weight: 700;
  color: var(--pink-dark);
  text-align: center;
  width: 30px;
}
.cutscene-note {
  font-style: italic;
  color: var(--text-light);
  font-size: 0.92em;
  padding: 4px 10px !important;
  background: rgba(245, 226, 200, 0.1);
  border-bottom: 1px dotted var(--border) !important;
}
/* Hidden gallery StillId column — kept in the markup for cross-referencing the
   data dump (kazama_cgs.txt etc.), not shown to readers. */
.cutscene-table .cutscene-id {
  display: none;
}

.stat-raising-guide {
  display: grid;
  gap: 18px;
}
.stat-raising-subnav {
  position: static;
  z-index: auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(184, 120, 32, 0.18);
  border-radius: 14px;
  border-bottom-width: 1px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.94), rgba(248, 239, 229, 0.9));
  box-shadow: 0 8px 18px rgba(164, 122, 62, 0.08);
}
.stat-raising-subnav a {
  padding: 7px 13px;
  font-size: 0.92em;
  border: 1px solid rgba(184, 120, 32, 0.18);
  border-right: 1px solid rgba(184, 120, 32, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}
.stat-raising-subnav a:last-child {
  border-right: 1px solid rgba(184, 120, 32, 0.18);
}
.stat-raising-subnav a:hover,
.stat-raising-subnav a:focus-visible {
  background: rgba(255, 240, 244, 0.92);
  border-color: rgba(221, 127, 156, 0.34);
  color: var(--pink-dark);
  outline: none;
}
.stat-raising-feature {
  display: grid;
  gap: 12px;
  padding: 14px 16px 14px;
  border: 1px solid rgba(184, 120, 32, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(255, 246, 238, 0.78));
  box-shadow: 0 10px 24px rgba(164, 122, 62, 0.08);
}
.stat-raising-section {
  display: grid;
  gap: 0;
  padding: 14px 16px 16px;
  border: 1px solid rgba(184, 120, 32, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.92), rgba(255, 246, 238, 0.78));
  box-shadow: 0 10px 24px rgba(164, 122, 62, 0.08);
}
.stat-section-title {
  margin: 0;
  font-size: 1.05em;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 14px 0 0;
}
.stat-band-title {
  margin: 0;
  font-size: 0.98em;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 12px 0 0;
}
.stat-guide-note {
  margin: 8px 0 10px;
  color: var(--text-light);
  font-size: 0.95em;
}
.horoscope-success-chart {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.horoscope-lucky-item-note {
  margin: 0;
  font-size: 0.8em;
  color: #8d7860;
}
.horoscope-success-key {
  font-size: 0.82em;
  font-weight: 800;
  color: #8d7860;
  white-space: nowrap;
}
.horoscope-success-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(184, 120, 32, 0.24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 238, 226, 0.92));
  box-shadow: 0 4px 10px rgba(164, 122, 62, 0.07);
}
.horoscope-success-face {
  margin-right: 0;
}
.horoscope-success-rate {
  font-weight: 700;
  white-space: nowrap;
}
.horoscope-board-tool {
  display: grid;
  gap: 8px;
}
.horoscope-board-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 10px;
  align-items: end;
}
.horoscope-board-field {
  display: grid;
  gap: 3px;
  font-size: 0.8em;
  color: var(--text-light);
}
.horoscope-board-field span {
  font-weight: 700;
}
.horoscope-board-field select {
  min-width: 0;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(184, 120, 32, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.horoscope-board-field select:focus {
  outline: none;
  border-color: rgba(221, 127, 156, 0.7);
  box-shadow: 0 0 0 3px rgba(232, 130, 154, 0.16);
}
.horoscope-board-surface {
  margin-top: 0;
  padding: 8px 0 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.horoscope-board {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  margin-bottom: 0;
}
.horoscope-board thead th {
  padding: 0 3px 4px;
  border: 0;
  background: none;
}
.horoscope-board thead th:first-child {
  width: 72px;
}
.horoscope-board-header {
  display: block;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: center;
  color: #404040;
  box-shadow: none;
  font-size: 0.88em;
}
.horoscope-board-header-study {
  background: #ffd37d;
}
.horoscope-board-header-fun {
  background: #9af0a5;
}
.horoscope-board-header-health {
  background: #a7ddff;
}
.horoscope-board-header-love {
  background: #f6a0b0;
}
.horoscope-board-rowlabel,
.horoscope-board-cell {
  background: transparent;
  border: 0;
  background-clip: padding-box;
  transition: box-shadow 0.12s ease, background-color 0.12s ease, opacity 0.12s ease;
}
.horoscope-board-row + .horoscope-board-row .horoscope-board-rowlabel,
.horoscope-board-row + .horoscope-board-row .horoscope-board-cell {
  border-top: 1px solid rgba(113, 151, 172, 0.26);
}
.horoscope-board-rowlabel {
  padding: 8px 8px;
  text-align: center;
  color: #355163;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.88em;
  background: transparent;
}
.horoscope-board-cell {
  padding: 7px 5px;
  text-align: center;
  border-left: 2px dotted rgba(55, 55, 55, 0.45);
  background: transparent;
}
.horoscope-board-face {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(255, 255, 255, 0.55));
}
.horoscope-board-row-now .horoscope-board-rowlabel,
.horoscope-board-row-now .horoscope-board-cell {
  background: transparent;
  box-shadow: none;
}
.horoscope-board-row-now .horoscope-board-rowlabel {
  color: #2d4858;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
}
.horoscope-board-row-now .horoscope-board-face {
  width: 34px;
  height: 34px;
}
.horoscope-board-cell.is-best {
  background: transparent;
}
.horoscope-board-row:hover .horoscope-board-rowlabel,
.horoscope-board-row:hover .horoscope-board-cell {
  box-shadow: none;
}
.horoscope-command-label {
  padding: 10px 8px 8px;
  border: 0;
  background: transparent;
  color: #2d4858;
  font-weight: 800;
  font-size: 0.76em;
  line-height: 1.1;
  text-align: center;
  vertical-align: top;
}
.horoscope-command-cell {
  min-width: 0;
  min-height: 116px;
  padding: 8px 8px 8px;
  background: transparent;
  border-left: 2px dotted rgba(55, 55, 55, 0.45);
  background-clip: padding-box;
  vertical-align: top;
}
.horoscope-command-cell.is-best {
  background: transparent;
  box-shadow: none;
}
.horoscope-command-cell .command-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  justify-content: flex-start;
  width: 100%;
}
.horoscope-command-cell .command-chip {
  max-width: 100%;
  min-height: 22px;
  padding: 3px 7px;
  font-size: 0.72em;
  line-height: 1.05;
  box-shadow: none;
}
.horoscope-success-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
}
.horoscope-success-band-inline {
  margin: 0 0 4px;
}
.horoscope-success-band .horoscope-success-chart {
  justify-content: center;
  margin: 0;
}
.stat-raising-table td:first-child {
  text-align: left;
  width: auto;
}
.stat-raising-table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
}
.stat-raising-table thead th:first-child {
  border-top-left-radius: 13px;
}
.stat-raising-table thead th:last-child {
  border-top-right-radius: 13px;
}
.stat-raising-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 13px;
}
.stat-raising-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 13px;
}
.stat-raising-table thead th {
  background: transparent;
}
.stat-raising-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.26);
}
.stat-raising-table tbody tr:nth-child(even) td {
  background: rgba(250, 242, 232, 0.38);
}
.stat-raising-table tbody tr:hover td {
  background: rgba(255, 244, 232, 0.9);
}
.stat-raising-data-table td,
.stat-raising-groups-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}
.stat-table-scroll {
  width: 100%;
}
.stat-raising-data-table td:last-child {
  line-height: 1.9;
}
.stat-delta {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}
.stat-delta.up {
  color: #267a35;
}
.stat-delta.down {
  color: #b64646;
}
.stat-relative {
  display: inline-block;
  margin: 0 8px 8px 0;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.95em;
}
.stat-relative.up {
  color: #267a35;
  background: rgba(76, 175, 80, 0.1);
  border-color: rgba(76, 175, 80, 0.18);
}
.stat-relative.down {
  color: #b64646;
  background: rgba(224, 87, 87, 0.1);
  border-color: rgba(224, 87, 87, 0.18);
}
.command-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fortune-tag,
.command-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #404040;
  font-family: 'Nunito', sans-serif;
  font-size: 0.86em;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.fortune-tag {
  white-space: nowrap;
}
.fortune-study {
  background: #ffd37d;
  color: #404040;
}
.fortune-fun {
  background: #9af0a5;
  color: #404040;
}
.fortune-health {
  background: #a7ddff;
  color: #404040;
}
.fortune-love {
  background: #f6a0b0;
  color: #404040;
}
.fortune-none {
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-light);
}

.spoiler {
  background: var(--text);
  color: transparent;
  border-radius: 3px;
  padding: 0 4px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.spoiler:hover,
.spoiler.revealed {
  background: transparent;
  color: var(--text);
}

.skinship-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin: 10px 0;
}
.skinship-table th {
  background: rgba(245, 226, 200, 0.4);
  color: #b87820;
  font-weight: 700;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.skinship-table td {
  padding: 6px 10px;
  border-bottom: 1px dotted var(--border);
  vertical-align: middle;
}
.skinship-table td:first-child {
  font-weight: 700;
  white-space: nowrap;
}
.bubble-icon {
  height: 18px;
  width: 18px;
  vertical-align: middle;
  margin-right: 4px;
}
.verdict-best {
  color: #4a9e4a;
  font-weight: 700;
}
.verdict-ok {
  color: #b8860b;
  font-weight: 700;
}
.verdict-risky {
  color: #d05050;
  font-weight: 700;
}

.skinship-situations {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.situation-card {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.82em;
  line-height: 1.4;
  border-left: 4px solid;
}
.situation-card.bad {
  background: rgba(232, 130, 154, 0.1);
  border-color: var(--pink);
}
.situation-card.good {
  background: rgba(201, 160, 78, 0.1);
  border-color: var(--gold);
}
.situation-card.cold {
  background: rgba(232, 130, 154, 0.06);
  border-color: rgba(232, 130, 154, 0.5);
}
.situation-card.beach {
  background: rgba(201, 160, 78, 0.06);
  border-color: rgba(201, 160, 78, 0.5);
}
.situation-card.best {
  background: rgba(201, 160, 78, 0.12);
  border-color: var(--gold);
}
.situation-card.warn {
  background: rgba(232, 130, 154, 0.08);
  border-color: rgba(232, 130, 154, 0.6);
}

/* --- Skinship icon-bar charts (zone x level/mood reaction dots) --- */
.sk-title {
  font-weight: 700;
  color: #b87820;
  font-size: 0.9em;
  margin: 14px 0 2px;
}
.sk-title small {
  font-weight: 400;
  color: var(--text-light);
}
.sk-face {
  height: 22px;
  width: auto;
  vertical-align: middle;
}
.skinship-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.skinship-chart {
  flex: 1 1 300px;
  margin: 4px 0 8px;
  font-size: 0.85em;
}
.sk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px dotted var(--border);
}
.sk-row.sk-head {
  border-bottom: 2px solid var(--border);
  color: #b87820;
  font-weight: 700;
  font-size: 0.85em;
}
.sk-zone {
  flex: 0 0 52px;
  font-weight: 700;
}
.sk-cells {
  flex: 1;
  display: flex;
  gap: 5px;
}
.sk-cells > .sk-col {
  flex: 1;
  text-align: center;
}
.sk-cell {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.8em;
  color: var(--text);
}
/* reaction tiers: s5 loves -> s1 dislikes — soft warm pastels to match the site,
   a green -> gold -> clay gradient that still reads good -> bad. */
.sk-cell.s5 { background: #a6d3a0; }
.sk-cell.s4 { background: #cbdf9c; }
.sk-cell.s3 { background: #f0d795; }
.sk-cell.s2 { background: #f1c193; }
.sk-cell.s1 { background: #e3a78f; }
.sk-cell.s0 { background: #ece2d4; color: var(--text-light); }
html[data-theme="dark"] .sk-cell { color: #f3ece2; }
html[data-theme="dark"] .sk-cell.s5 { background: #4a7a55; }
html[data-theme="dark"] .sk-cell.s4 { background: #61803f; }
html[data-theme="dark"] .sk-cell.s3 { background: #8a6d33; }
html[data-theme="dark"] .sk-cell.s2 { background: #95593a; }
html[data-theme="dark"] .sk-cell.s1 { background: #8f4a48; }
html[data-theme="dark"] .sk-cell.s0 { background: #3a322a; color: var(--text-light); }
.sk-legend {
  font-size: 0.78em;
  color: var(--text-light);
  margin: 4px 8px 12px;
  line-height: 2;
}
.sk-legend .sk-cell {
  width: auto;
  padding: 0 8px;
  height: 20px;
  font-size: 0.9em;
  vertical-align: middle;
  border-radius: 5px;
}
.sk-summary {
  font-size: 0.85em;
  color: var(--text-light);
  margin: 8px 0 12px;
}

.friend-groups {
  display: flex;
  gap: 20px;
  margin: 12px 0;
}
.friend-group {
  text-align: center;
  font-size: 0.88em;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.friend-heads {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}
.friend-heads img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.dialogue {
  font-size: 0.85em;
  color: var(--text-light);
  border-left: 3px solid var(--gold);
  background: rgba(245, 226, 200, 0.2);
  padding: 8px 14px;
  margin: 8px 0 12px;
  border-radius: 0 6px 6px 0;
  line-height: 1.6;
}

main p {
  margin-bottom: 12px;
}

main a {
  color: var(--pink-dark);
  text-decoration: none;
  border-bottom: 1px dashed var(--pink);
  transition: all 0.2s;
}

main a:hover {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

main ul, main ol {
  margin: 8px 0 16px 20px;
}

main li {
  margin-bottom: 4px;
}

/* --- Profile Card (Trading Card Style) --- */
.profile-card {
  background: linear-gradient(rgba(255,255,255,0.55), rgba(255,255,255,0.55)), url('/assets/ui/UImanual_bg.png') center/100% 100% no-repeat;
  border: 2px solid #dcc4b0;
  border-radius: 14px;
  margin: 16px 0;
  overflow: visible;
  position: relative;
  box-shadow: 2px 3px 8px rgba(160, 120, 60, 0.15), 0 1px 2px rgba(160, 120, 60, 0.1);
  transform: rotate(-0.5deg);
}

.game-tmgs2 .profile-card {
  background: linear-gradient(rgba(255,255,255,0.55), rgba(255,255,255,0.55)), url('/assets/ui/UImanual_bg_tmgs2.png') center/100% 100% no-repeat;
}

.profile-card.minimal-profile-card,
.profile-card:has(.pc-header-minimal) {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(255, 246, 235, 0.96));
}

.pc-header.pc-header-minimal {
  border-bottom: 0;
  border-radius: 0 0 12px 12px;
}

.pc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(252,228,232,0.6) 0%, rgba(245,226,200,0.4) 50%, rgba(252,235,212,0.3) 100%);
  border-bottom: 1px dotted rgba(220,180,140,0.4);
  position: relative;
  overflow: hidden;
  border-radius: 0;
}

.pc-watermark {
  position: absolute;
  right: -10px;
  top: -10px;
  width: 100px;
  opacity: 0.1;
  pointer-events: none;
}

.pc-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--pink);
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(200, 100, 120, 0.2);
}

.pc-identity {
  flex: 1;
  min-width: 0;
  position: relative;
}

.pc-identity h2 {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1.2em;
  color: #fff8ee;
  -webkit-text-stroke: 1.5px #b87820;
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(120, 70, 10, 0.3);
  margin: 0;
  padding: 0;
  border: none;
  display: block;
  line-height: 1.3;
}

.pc-jp {
  font-size: 0.75em;
  font-weight: 400;
  -webkit-text-stroke: 1px #b87820;
}

.pc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  font-size: 0.78em;
  color: var(--text);
  margin-top: 2px;
}

.pc-stats b {
  color: #b87820;
  font-weight: 700;
  font-size: 0.95em;
}

.mini-icon {
  color: #b87820;
  vertical-align: middle;
  margin-left: 6px;
  margin-right: 2px;
}

.day-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 2px;
  font-size: 0.85em;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
}
.day-dots span {
  color: #e0d0c0;
  font-size: 0.85em;
}
.day-dots span.on {
  color: #b87820;
  font-weight: 800;
}

.pc-logo {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.3em;
  opacity: 0.8;
}

.pc-fashion-row {
  margin-top: 5px;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}

/* "Matching Clothes:" row — small clickable pair-look icons → catalogue */
.pc-matching-row { flex-wrap: wrap; }
.pc-match {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  background: var(--white); border: 1.5px solid var(--border);
  transition: border-color .12s, transform .1s;
}
.pc-match img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pc-match:hover { border-color: var(--pink); transform: translateY(-1px); }

/* Gold cookie-style text label (mimics game logo assets) */
.gold-label {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff8ee;
  -webkit-text-stroke: 2px #b87820;
  paint-order: stroke fill;
  text-shadow: 0 2px 3px rgba(120, 70, 10, 0.3);
  white-space: nowrap;
}

.pc-fashion-row > .gold-label {
  font-size: 0.82em;
  margin-right: 3px;
  -webkit-text-stroke: 1.5px #b87820;
}

.pc-fashion-row .tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 12px;
  font-size: 0.72em;
  white-space: nowrap;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
}

.pc-fashion-row .tag-icon {
  height: 12px;
  width: auto;
}

.pc-fashion-row .tag.dislike {
  position: relative;
}
.pc-fashion-row .tag.dislike::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), rgba(224,80,80,0.4) calc(50% - 1px), rgba(224,80,80,0.4) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(224,80,80,0.4) calc(50% - 1px), rgba(224,80,80,0.4) calc(50% + 1px), transparent calc(50% + 1px));
  border-radius: 12px;
}

.pc-fashion-row .color-tag {
  margin-left: 0;
  color: var(--text-light);
}

.pc-school-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-top: 4px;
  font-size: 0.78em;
  color: var(--text);
}

.pc-school-row b {
  color: var(--pink-dark);
  font-weight: 700;
}

.color-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 2px;
}

/* Card body — 2-column grid for data sections */
.pc-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.pc-body-minimal {
  grid-template-columns: 1fr;
}

.pc-section {
  padding: 8px 14px 6px;
  border-bottom: 1px dashed var(--border);
  border-right: 1px dashed var(--border);
  min-width: 0;
}

.pc-body-minimal .pc-section {
  border-right: none;
}

.pc-section:nth-child(even) {
  border-right: none;
}

.pc-section:nth-last-child(-n+2) {
  border-bottom: none;
}

/* Warm alternating tints with ruled-line notebook texture */
.pc-section:nth-child(1),
.pc-section:nth-child(4) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, rgba(210, 160, 148, 0.2) 21px, rgba(210, 160, 148, 0.2) 22px),
    rgba(252, 231, 239, 0.3);
}
.pc-section:nth-child(2),
.pc-section:nth-child(3) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, rgba(190, 160, 100, 0.2) 21px, rgba(190, 160, 100, 0.2) 22px),
    rgba(245, 230, 200, 0.3);
}

.pc-section-label {
  font-size: 0.82em;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px dotted var(--gold);
  -webkit-text-stroke: 1.5px #b87820;
  text-shadow: 0 1px 2px rgba(120, 70, 10, 0.25);
}

.pc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}

.pc-table td {
  padding: 2px 0;
  vertical-align: top;
  line-height: 1.4;
}

.pc-table td:last-child {
  min-width: 0;
  overflow-wrap: break-word;
}

.pc-table td:first-child {
  font-weight: 700;
  color: var(--pink-dark);
  white-space: nowrap;
  padding-right: 8px;
  width: 1%;
}

.pc-year-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}

.pc-year-value b {
  font-size: 0.86em;
  color: var(--pink-dark);
}

.pc-detail-years td:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.pc-memo-only td:first-child {
  width: auto;
  padding-right: 0;
  color: var(--text);
  font-weight: 400;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.face-icon {
  height: 20px;
  width: auto;
  vertical-align: middle;
  margin-right: 2px;
}

.face-x {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  color: #e05050;
  font-size: 1.1em;
  font-weight: 800;
  vertical-align: middle;
  margin-right: 2px;
}

.profile-sub-logo {
  height: 28px;
  width: auto;
}

.sidebar-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
}

/* --- Fashion Tags --- */
.fashion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fashion-tags .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
}

.tag-icon {
  height: 20px;
  width: auto;
}

.fashion-color {
  font-size: 0.85em;
  margin-top: 8px;
  color: var(--text-light);
}

/* --- Compact Lists --- */
.compact-list {
  margin-left: 18px;
  font-size: 0.88em;
}

.compact-list li {
  margin-bottom: 2px;
}

details.info-box {
  padding: 0;
}

details.info-box summary {
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--purple);
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.info-box summary::-webkit-details-marker { display: none; }

details.info-box summary::after {
  content: '▸';
  transition: transform 0.2s;
}

details[open].info-box summary::after {
  transform: rotate(90deg);
}

details[open].info-box summary {
  border-bottom: 1px dotted var(--border);
  margin-bottom: 0;
}

details.info-box > :not(summary) {
  padding: 0 16px;
}

details.info-box > :nth-child(2) {
  padding-top: 12px;
}

details.info-box > :last-child {
  padding-bottom: 14px;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.stat-table td {
  padding: 6px 10px;
  border-bottom: 1px dotted var(--border);
}

.stat-table td:first-child {
  font-weight: 700;
  color: var(--purple);
  width: 140px;
}

/* --- Character Grid (Homepage) --- */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.char-card {
  text-align: center;
  padding: 14px 10px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s;
}

.char-card:hover {
  border-color: var(--pink);
  transform: translateY(-4px);
  box-shadow: 0 6px 16px var(--shadow);
}

.char-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.char-card:hover img {
  border-color: var(--pink);
}

.char-card .name {
  font-weight: 700;
  font-size: 0.85em;
  display: block;
}

.char-card .desc {
  font-size: 0.72em;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

/* Coming-soon characters: grayed out, not clickable (page doesn't exist yet). */
.char-card.coming-soon {
  cursor: default;
  opacity: 0.55;
  border-style: dashed;
}
.char-card.coming-soon:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}
.char-card.coming-soon img {
  filter: grayscale(1);
}
.char-card.coming-soon:hover img {
  border-color: var(--border);
}
.char-card.coming-soon .desc {
  font-style: italic;
  color: var(--gold-dark);
}
/* Sidebar coming-soon entries mirror the link layout but aren't clickable. */
.char-nav li.coming-soon span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  color: var(--text);
  opacity: 0.5;
  cursor: default;
}
.char-nav li.coming-soon img {
  filter: grayscale(1);
}

/* --- Link Table (JP guide style section grids) --- */
.link-table {
  margin: 16px 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.link-table-header {
  background: linear-gradient(135deg, var(--pink-dark) 0%, var(--gold-dark) 100%);
  color: var(--white);
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  font-size: 1em;
  padding: 8px 16px;
  text-align: center;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.link-table-header img {
  width: 22px;
  height: 22px;
}

.link-table-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--white);
}

.link-table-grid a {
  padding: 8px 14px;
  color: var(--pink-dark);
  text-decoration: none;
  font-size: 0.88em;
  font-weight: 600;
  border-bottom: 1px dotted var(--border);
  transition: all 0.15s;
}

.link-table-grid a:nth-child(odd) {
  border-right: 1px dotted var(--border);
}

.link-table-grid a:hover {
  background: var(--pink-light);
  color: var(--purple);
}

.link-table-grid a::before {
  content: "\25B8 ";
  color: var(--gold);
}

/* --- Character Sub-Nav (folder tabs) --- */
.char-subnav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 2px 0;
  border-bottom: 1px dotted var(--border);
  position: relative;
}

.char-subnav a {
  padding: 3px 9px;
  text-decoration: none;
  font-family: 'Nunito', sans-serif;
  font-size: 0.7em;
  font-weight: 700;
  color: #b87820;
  border: none;
  background: none;
  transition: all 0.15s;
  border-right: 1px dotted rgba(184, 120, 32, 0.3);
}

.char-subnav a:last-child {
  border-right: none;
}

.char-subnav a:hover {
  color: var(--pink-dark);
}

.game-tmgs2 .char-subnav {
  border-bottom-color: color-mix(in srgb, var(--tmgs2-blue) 42%, transparent);
}

.game-tmgs2 .char-subnav a {
  color: var(--tmgs2-purple-ink);
  border-right-color: color-mix(in srgb, var(--tmgs2-blue) 34%, transparent);
}

.game-tmgs2 .char-subnav a:hover {
  color: var(--gold-dark);
}

.subnav-deco {
  position: absolute;
  width: auto;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(1px 2px 2px rgba(120, 80, 30, 0.25));
}

.subnav-deco:first-child {
  height: 55px;
  left: -20px;
  top: -12px;
  transform: rotate(-12deg);
}

.subnav-deco.flip {
  height: 42px;
  right: -14px;
  top: -8px;
  transform: scaleX(-1) rotate(-6deg);
}

.game-tmgs2 .subnav-deco {
  filter: drop-shadow(1px 2px 2px rgba(75, 64, 95, 0.24));
}


/* --- Decorative Divider with pinwheel --- */
.divider {
  text-align: center;
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
}

.divider img {
  width: 24px;
  height: 24px;
  opacity: 0.6;
}

/* --- Welcome Banner (Chibis) --- */
.welcome-banner {
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, var(--pink-light) 0%, var(--gold-light) 100%);
  position: relative;
  height: 210px;
}

.banner-pinwheel {
  position: absolute;
  pointer-events: none;
  animation: spin 20s linear infinite;
}

.banner-chibi {
  position: absolute;
  bottom: 0;
  filter: drop-shadow(2px 3px 4px rgba(0,0,0,0.12));
}

.banner-chibi.protagonist {
  height: 180px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.banner-chibi.friend-left {
  height: 150px;
  left: 14%;
  bottom: 5px;
  z-index: 2;
}

.banner-chibi.friend-right {
  height: 140px;
  right: 16%;
  bottom: 5px;
  z-index: 2;
}

/* --- Welcome Box --- */
.resource-links { list-style: none; padding: 0; margin: 12px 0 0; }
.resource-links li { margin: 10px 0; line-height: 1.5; color: var(--text-light); }
.resource-links a { font-size: 1.1rem; font-weight: 700; color: var(--pink-dark); text-decoration: none; }
.resource-links a:hover { text-decoration: underline; }

.welcome-box {
  background: linear-gradient(135deg, var(--pink-light) 0%, var(--gold-light) 100%);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
}

.welcome-box p {
  margin: 0;
  position: relative;
}

.welcome-chibi {
  float: right;
  width: 100px;
  height: 80px;
  object-fit: contain;
  object-position: center bottom;
  margin: -4px -4px 0 12px;
  position: relative;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 24px;
}

.character-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  min-height: 68px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--white) 86%, var(--pink-light));
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 8px var(--shadow);
}

.character-card img {
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
}

.character-card span {
  min-width: 0;
  font-weight: 800;
  color: var(--pink-dark);
  line-height: 1.15;
}

.character-card small {
  min-width: 0;
  color: var(--text-light);
  line-height: 1.2;
}

a.character-card:hover,
a.character-card:focus-visible {
  border-color: var(--pink);
  background: var(--pink-light);
  transform: translateY(-1px);
  outline: none;
}

.character-card.coming-soon {
  opacity: 0.52;
}

.character-card.coming-soon img {
  filter: grayscale(1);
}

.tmgs2-profile-shell {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 6px 2px;
}

.tmgs2-profile-shell img {
  width: 88px;
  height: 88px;
  border: 3px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
  background: var(--white);
}

.tmgs2-profile-shell h2 {
  margin: 0 0 4px;
  color: var(--pink-dark);
}

/* --- TMGS2 visual skin ---------------------------------------------------- */
.game-tmgs2 .guide-header {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, color-mix(in srgb, var(--tmgs2-blue) 22%, transparent) 27px, color-mix(in srgb, var(--tmgs2-blue) 22%, transparent) 28px),
    linear-gradient(135deg, #cfd9e7 0%, #f0f2f7 54%, #ddd7ea 100%);
}

.game-tmgs2 .guide-header h1 {
  margin-bottom: -8px;
}

.game-tmgs2 .guide-header .subtitle {
  color: var(--pink-dark);
  margin-top: -8px;
}

.game-tmgs2 .sidebar {
  background:
    linear-gradient(to right, transparent 14px, color-mix(in srgb, var(--tmgs2-lilac) 28%, transparent) 14px, color-mix(in srgb, var(--tmgs2-lilac) 28%, transparent) 15px, transparent 15px),
    repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--rule) 27px, var(--rule) 28px),
    var(--white);
}

.game-tmgs2 .date-collapse summary,
.game-tmgs2 .da-prompt,
.game-tmgs2 .ending-or,
.game-tmgs2 .cutscene-table th,
.game-tmgs2 .skinship-table th,
.game-tmgs2 .sk-title,
.game-tmgs2 .sk-row.sk-head {
  color: var(--pink-dark);
}

.game-tmgs2 .date-collapse summary,
.game-tmgs2 .cutscene-table th,
.game-tmgs2 .skinship-table th {
  background: color-mix(in srgb, var(--tmgs2-blue) 18%, transparent);
}

.game-tmgs2 .da-area {
  border-color: color-mix(in srgb, var(--tmgs2-blue) 44%, var(--border));
}

.game-tmgs2 .da-area > summary {
  background: color-mix(in srgb, var(--tmgs2-blue) 22%, transparent);
}

.game-tmgs2 .da-legend,
.game-tmgs2 .da-cond {
  color: var(--text-light);
}

.game-tmgs2 .da-media img {
  background: var(--cream);
}

.game-tmgs2 .cutscene-table tr:hover td {
  background: color-mix(in srgb, var(--tmgs2-lilac) 18%, transparent);
}

.game-tmgs2 .cutscene-note,
.game-tmgs2 .dialogue {
  background: color-mix(in srgb, var(--tmgs2-blue-light) 58%, transparent);
}

.game-tmgs2 .dialogue {
  border-left-color: var(--pink);
}

body.game-tmgs2 .bg-pinwheels img,
.game-tmgs2 .guide-header .header-pinwheel,
.game-tmgs2 footer .footer-pinwheel,
.game-tmgs2 .pc-watermark {
  display: none;
}

body.game-tmgs2 .tmgs2-seagulls {
  display: none;
}

body.game-tmgs2 .bg-pinwheels::before,
body.game-tmgs2 .bg-pinwheels::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  pointer-events: none;
  will-change: background-position;
}

body.game-tmgs2 .bg-pinwheels::before {
  opacity: 0.46;
  background-image:
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png');
  background-size:
    34px 34px, 18px 18px, 26px 26px, 13px 13px, 23px 23px,
    16px 16px, 31px 31px, 11px 11px, 21px 21px,
    28px 28px, 15px 15px, 38px 38px, 19px 19px, 24px 24px, 12px 12px;
  background-repeat: no-repeat;
  animation: bubbleRiseNear 42s linear infinite;
}

body.game-tmgs2 .bg-pinwheels::after {
  opacity: 0.24;
  background-image:
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png'),
    url('/assets/ui/bubble_3.png'), url('/assets/ui/bubble_3.png');
  background-size:
    12px 12px, 20px 20px, 15px 15px, 24px 24px,
    10px 10px, 18px 18px, 13px 13px, 22px 22px,
    16px 16px, 8px 8px, 26px 26px, 12px 12px, 19px 19px, 9px 9px;
  background-repeat: no-repeat;
  animation: bubbleRiseFar 64s linear infinite;
}

.game-tmgs2 .profile-card {
  background: linear-gradient(rgba(236, 241, 247, 0.42), rgba(225, 223, 235, 0.42)), url('/assets/ui/UImanual_bg_tmgs2.png') center/100% 100% no-repeat;
  border-color: color-mix(in srgb, var(--tmgs2-blue) 55%, var(--white));
  box-shadow: 2px 3px 8px rgba(49, 95, 120, 0.16), 0 1px 2px rgba(49, 95, 120, 0.12);
}

.game-tmgs2 .pc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tmgs2-blue-light) 82%, transparent) 0%, color-mix(in srgb, var(--tmgs2-haze) 48%, transparent) 52%, color-mix(in srgb, var(--tmgs2-lilac) 34%, transparent) 100%);
  border-bottom-color: color-mix(in srgb, var(--tmgs2-blue) 38%, transparent);
}

.game-tmgs2 .pc-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 1;
  flex: 1;
}

.game-tmgs2 .pc-avatar {
  margin-top: 0;
}

.game-tmgs2 .pc-fashion-row {
  flex-wrap: wrap;
}

.game-tmgs2 .pc-identity h2,
.game-tmgs2 .pc-jp,
.game-tmgs2 .gold-label,
.game-tmgs2 .pc-section-label {
  -webkit-text-stroke-color: var(--heading-stroke);
  text-shadow: 0 2px 3px rgba(75, 64, 95, 0.2);
}

.game-tmgs2 .pc-stats b,
.game-tmgs2 .mini-icon,
.game-tmgs2 .day-dots span.on,
.game-tmgs2 .pc-logo {
  color: var(--pink-dark);
}

.game-tmgs2 .pc-section:nth-child(1),
.game-tmgs2 .pc-section:nth-child(4) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, color-mix(in srgb, var(--tmgs2-blue) 22%, transparent) 21px, color-mix(in srgb, var(--tmgs2-blue) 22%, transparent) 22px),
    color-mix(in srgb, var(--tmgs2-blue-light) 34%, transparent);
}

.game-tmgs2 .pc-section:nth-child(2),
.game-tmgs2 .pc-section:nth-child(3) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, color-mix(in srgb, var(--tmgs2-lilac) 18%, transparent) 21px, color-mix(in srgb, var(--tmgs2-lilac) 18%, transparent) 22px),
    color-mix(in srgb, var(--tmgs2-haze) 28%, transparent);
}

.game-tmgs2 footer {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, color-mix(in srgb, var(--tmgs2-blue) 21%, transparent) 27px, color-mix(in srgb, var(--tmgs2-blue) 21%, transparent) 28px),
    linear-gradient(135deg, #cfd9e7 0%, #f0f2f7 58%, #ddd7ea 100%);
  border-top-color: color-mix(in srgb, var(--tmgs2-blue) 35%, transparent);
}

/* Decorative bubbles scattered in welcome box */
.welcome-box .deco-bubble {
  position: absolute;
  opacity: 0.3;
  pointer-events: none;
}

/* --- Footer --- */
footer {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(210, 160, 148, 0.12) 27px, rgba(210, 160, 148, 0.12) 28px),
    linear-gradient(135deg, #fce4e8 0%, #f5e2c8 50%, #fcebd4 100%);
  color: var(--text);
  text-align: center;
  padding: 14px;
  border-radius: 0 0 18px 18px;
  border: 3px solid var(--chrome);
  border-top: 2px dashed rgba(200, 160, 130, 0.3);
  box-shadow: 0 4px 20px var(--shadow);
  font-size: 0.85em;
  font-family: 'MaruGothic', 'Nunito', sans-serif;
  position: relative;
}

footer .footer-pinwheel {
  position: absolute;
  width: 40px;
  opacity: 0.35;
  pointer-events: none;
}
footer .footer-pinwheel.left {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}
footer .footer-pinwheel.right {
  right: 16px;
  top: 50%;
  transform: translateY(-50%) scaleX(-1);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .window-tabs {
    width: calc(100% - 18px);
    padding-left: 8px;
    gap: 3px;
  }

  .window-tab {
    height: 44px;
    padding: 4px 8px;
  }

  .window-tab img {
    max-height: 32px;
  }

  #container {
    margin: 10px;
  }

  #layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    max-height: none;
    border-right: none;
    border-bottom: 2px dashed var(--border);
  }

  .char-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .char-nav a {
    flex-direction: column;
    text-align: center;
    gap: 4px;
    padding: 6px;
    font-size: 0.75em;
  }

  .guide-header h1 {
    font-size: 1.6em;
  }

  .guide-header .header-pinwheel {
    display: none;
  }

  .sidebar-mascot {
    display: none;
  }
}

/* --- Dark Theme ----------------------------------------------------------- */
html[data-theme="dark"] .window-tab {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 16%, #1f1a17) 0%,
    color-mix(in srgb, var(--accent) 8%, #171310) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 -2px 6px rgba(0,0,0,0.22);
}

html[data-theme="dark"] #container,
html[data-theme="dark"] #layout,
html[data-theme="dark"] main,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .date-collapse,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .friend-group,
html[data-theme="dark"] .welcome-box,
html[data-theme="dark"] .link-table,
html[data-theme="dark"] .link-table-grid {
  background-color: var(--cream);
}

html[data-theme="dark"] .sidebar {
  background:
    linear-gradient(to right, transparent 14px, rgba(220, 160, 130, 0.16) 14px, rgba(220, 160, 130, 0.16) 15px, transparent 15px),
    repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--rule) 27px, var(--rule) 28px),
    var(--white);
}

html[data-theme="dark"] .profile-card {
  background: linear-gradient(rgba(38,33,29,0.82), rgba(38,33,29,0.82)), url('/assets/ui/UImanual_bg.png') center/100% 100% no-repeat;
}

html[data-theme="dark"] .game-tmgs2 .profile-card {
  background: linear-gradient(rgba(21, 31, 41, 0.82), rgba(40, 36, 58, 0.82)), url('/assets/ui/UImanual_bg_tmgs2.png') center/100% 100% no-repeat;
}

html[data-theme="dark"] .profile-card.minimal-profile-card,
html[data-theme="dark"] .profile-card:has(.pc-header-minimal) {
  background: linear-gradient(180deg, rgba(38, 33, 29, 0.94), rgba(31, 27, 24, 0.94));
}

html[data-theme="dark"] .pc-header,
html[data-theme="dark"] .welcome-box,
html[data-theme="dark"] footer {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--rule) 27px, var(--rule) 28px),
    linear-gradient(135deg, var(--pink-light) 0%, var(--gold-light) 100%);
}

html[data-theme="dark"] .pc-section:nth-child(1),
html[data-theme="dark"] .pc-section:nth-child(2),
html[data-theme="dark"] .pc-section:nth-child(3),
html[data-theme="dark"] .pc-section:nth-child(4) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, var(--rule) 21px, var(--rule) 22px),
    color-mix(in srgb, var(--white) 72%, var(--cream));
}

html[data-theme="dark"] .cutscene-table th,
html[data-theme="dark"] .skinship-table th,
html[data-theme="dark"] .date-collapse summary {
  background: color-mix(in srgb, var(--gold-light) 68%, transparent);
  color: var(--gold-dark);
}

html[data-theme="dark"] .cutscene-table tr:hover td {
  background: color-mix(in srgb, var(--gold-light) 40%, transparent);
}

html[data-theme="dark"] .guide-subnav {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, rgba(150, 108, 92, 0.16) 27px, rgba(150, 108, 92, 0.16) 28px),
    linear-gradient(180deg, rgba(39, 32, 28, 0.96), rgba(31, 26, 23, 0.96));
  border-bottom-color: rgba(226, 179, 120, 0.24);
}

html[data-theme="dark"] .guide-subnav a {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 12%, #2d2520) 0%,
    color-mix(in srgb, var(--pink) 6%, #221c18) 100%);
  border-color: color-mix(in srgb, var(--pink) 34%, #6f5949);
  color: #f0c77c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 -2px 6px rgba(0, 0, 0, 0.16);
  text-shadow: none;
}

html[data-theme="dark"] .guide-subnav a.is-active,
html[data-theme="dark"] .guide-subnav a[aria-current="page"] {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 22%, #312722) 0%,
    color-mix(in srgb, var(--pink) 12%, #241d19) 100%);
  border-color: color-mix(in srgb, var(--pink) 68%, #846754);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 -3px 8px rgba(0, 0, 0, 0.22);
  color: #ffe0a6;
}

html[data-theme="dark"] .guide-subnav a:hover,
html[data-theme="dark"] .guide-subnav a:focus-visible {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--pink) 20%, #2d2520) 0%,
    color-mix(in srgb, var(--pink) 11%, #221c18) 100%);
  border-color: color-mix(in srgb, var(--pink) 60%, #7b5f4c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 -3px 8px rgba(0, 0, 0, 0.2);
  color: #ffe0a6;
}

html[data-theme="dark"] .char-nav a {
  padding: 5px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(226, 179, 120, 0.14);
  border-radius: 0;
  box-shadow: none;
}

html[data-theme="dark"] .char-nav a:hover,
html[data-theme="dark"] .char-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.03);
  color: #ffe0a6;
  border-bottom-color: rgba(226, 179, 120, 0.24);
}

html[data-theme="dark"] .char-nav .coming-soon span {
  padding: 5px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(226, 179, 120, 0.1);
  border-radius: 0;
}

html[data-theme="dark"] .stat-raising-feature {
  border-color: rgba(226, 179, 120, 0.18);
  background: linear-gradient(180deg, rgba(39, 32, 28, 0.94), rgba(31, 26, 23, 0.9));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .stat-raising-section {
  border-color: rgba(226, 179, 120, 0.18);
  background: linear-gradient(180deg, rgba(39, 32, 28, 0.94), rgba(31, 26, 23, 0.9));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .stat-raising-subnav {
  border-color: rgba(226, 179, 120, 0.18);
  background: linear-gradient(180deg, rgba(43, 35, 30, 0.96), rgba(35, 29, 25, 0.94));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .stat-raising-subnav a {
  background: linear-gradient(180deg, rgba(65, 53, 46, 0.92), rgba(49, 40, 35, 0.94));
  border-color: rgba(226, 179, 120, 0.2);
  color: #f0c77c;
}

html[data-theme="dark"] .stat-raising-subnav a:hover,
html[data-theme="dark"] .stat-raising-subnav a:focus-visible {
  background: linear-gradient(180deg, rgba(90, 57, 69, 0.96), rgba(69, 45, 53, 0.96));
  border-color: rgba(232, 130, 154, 0.34);
  color: #ffd7e1;
}

html[data-theme="dark"] .horoscope-success-item,
html[data-theme="dark"] .fortune-tag,
html[data-theme="dark"] .command-chip {
  background: linear-gradient(180deg, rgba(60, 88, 101, 0.94), rgba(49, 74, 87, 0.96));
  border-color: rgba(177, 214, 229, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .horoscope-success-rate,
html[data-theme="dark"] .fortune-tag,
html[data-theme="dark"] .command-chip {
  color: #e9f3f7;
}
html[data-theme="dark"] .horoscope-lucky-item-note,
html[data-theme="dark"] .fortune-study {
  color: #d6e7ee;
}
html[data-theme="dark"] .fortune-study {
  background: linear-gradient(180deg, rgba(140, 110, 42, 0.94), rgba(108, 84, 31, 0.96));
  border-color: rgba(255, 216, 138, 0.34);
  color: #ffedbf;
}
html[data-theme="dark"] .fortune-fun {
  background: linear-gradient(180deg, rgba(50, 116, 73, 0.94), rgba(36, 88, 55, 0.96));
  border-color: rgba(154, 240, 165, 0.26);
  color: #d1f8d6;
}
html[data-theme="dark"] .fortune-health {
  background: linear-gradient(180deg, rgba(58, 98, 131, 0.94), rgba(43, 75, 101, 0.96));
  border-color: rgba(167, 221, 255, 0.28);
  color: #d8eeff;
}
html[data-theme="dark"] .fortune-love {
  background: linear-gradient(180deg, rgba(116, 77, 91, 0.94), rgba(89, 58, 70, 0.96));
  border-color: rgba(246, 160, 176, 0.24);
  color: #ffd8e0;
}
html[data-theme="dark"] .fortune-none {
  background: linear-gradient(180deg, rgba(60, 88, 101, 0.94), rgba(49, 74, 87, 0.96));
  border-color: rgba(177, 214, 229, 0.18);
  color: #d7e8ef;
}

html[data-theme="dark"] .horoscope-board-field {
  color: #c7d9e2;
}

html[data-theme="dark"] .horoscope-board-field select {
  background: linear-gradient(180deg, rgba(63, 92, 106, 0.96), rgba(50, 76, 89, 0.96));
  border-color: rgba(177, 214, 229, 0.22);
  color: #eef7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .horoscope-board-field select:focus {
  border-color: rgba(155, 212, 238, 0.52);
  box-shadow: 0 0 0 3px rgba(155, 212, 238, 0.14);
}

html[data-theme="dark"] .horoscope-board-rowlabel,
html[data-theme="dark"] .horoscope-board-cell {
  background: transparent;
}

html[data-theme="dark"] .horoscope-board-row + .horoscope-board-row .horoscope-board-rowlabel,
html[data-theme="dark"] .horoscope-board-row + .horoscope-board-row .horoscope-board-cell {
  border-top-color: rgba(184, 219, 233, 0.14);
}

html[data-theme="dark"] .horoscope-board-rowlabel {
  color: #e7f1f5;
  background: transparent;
}

html[data-theme="dark"] .horoscope-board-header-study {
  background: #f1cd79;
}

html[data-theme="dark"] .horoscope-board-header-fun {
  background: #90e29a;
}

html[data-theme="dark"] .horoscope-board-header-health {
  background: #97d0ef;
}

html[data-theme="dark"] .horoscope-board-header-love {
  background: #d896a8;
}

html[data-theme="dark"] .horoscope-board-surface {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .horoscope-board-cell {
  border-left-color: rgba(201, 227, 237, 0.26);
  background: transparent;
}

html[data-theme="dark"] .horoscope-board-row-now .horoscope-board-rowlabel,
html[data-theme="dark"] .horoscope-board-row-now .horoscope-board-cell {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .horoscope-board-row-now .horoscope-board-rowlabel {
  background: rgba(223, 242, 250, 0.08);
}

html[data-theme="dark"] .horoscope-board-row:hover .horoscope-board-rowlabel,
html[data-theme="dark"] .horoscope-board-row:hover .horoscope-board-cell {
  box-shadow: none;
}

html[data-theme="dark"] .horoscope-command-cell {
  background: transparent;
  border-top-color: rgba(178, 209, 222, 0.16);
  border-left-color: rgba(201, 227, 237, 0.26);
}

html[data-theme="dark"] .horoscope-command-label {
  background: transparent;
  border-top-color: rgba(178, 209, 222, 0.16);
  color: #dcebf1;
}

html[data-theme="dark"] .horoscope-success-key {
  color: #bad2dd;
}

html[data-theme="dark"] .horoscope-command-cell.is-best {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .horoscope-board-cell.is-best {
  background: transparent;
}

html[data-theme="dark"] .horoscope-board-face {
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.12));
}

html[data-theme="dark"] .stat-raising-table thead th {
  background: transparent;
  color: #f0c77c;
}

html[data-theme="dark"] .stat-raising-table {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .stat-raising-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .stat-raising-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .stat-raising-table tbody tr:hover td {
  background: rgba(120, 89, 56, 0.18);
}

html[data-theme="dark"] .stat-relative.up {
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(100, 191, 113, 0.22);
  color: #84d58e;
}

html[data-theme="dark"] .stat-relative.down {
  background: rgba(224, 87, 87, 0.14);
  border-color: rgba(228, 111, 111, 0.22);
  color: #f08d8d;
}

html[data-theme="dark"] .game-tmgs2 .sidebar {
  background:
    linear-gradient(to right, transparent 14px, color-mix(in srgb, var(--tmgs2-lilac) 20%, transparent) 14px, color-mix(in srgb, var(--tmgs2-lilac) 20%, transparent) 15px, transparent 15px),
    repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--rule) 27px, var(--rule) 28px),
    var(--white);
}

html[data-theme="dark"] .game-tmgs2 .guide-header,
html[data-theme="dark"] .game-tmgs2 .pc-header,
html[data-theme="dark"] .game-tmgs2 footer {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 27px, color-mix(in srgb, var(--tmgs2-blue) 18%, transparent) 27px, color-mix(in srgb, var(--tmgs2-blue) 18%, transparent) 28px),
    linear-gradient(135deg, #1c2c40 0%, #151f29 58%, #28243a 100%);
}

html[data-theme="dark"] .game-tmgs2 .date-collapse summary,
html[data-theme="dark"] .game-tmgs2 .cutscene-table th,
html[data-theme="dark"] .game-tmgs2 .skinship-table th,
html[data-theme="dark"] .game-tmgs2 .da-area > summary {
  background: color-mix(in srgb, var(--tmgs2-blue) 18%, transparent);
  color: var(--pink-dark);
}

html[data-theme="dark"] .game-tmgs2 .cutscene-table tr:hover td {
  background: color-mix(in srgb, var(--tmgs2-lilac) 12%, transparent);
}

html[data-theme="dark"] .game-tmgs2 .cutscene-note,
html[data-theme="dark"] .game-tmgs2 .dialogue {
  background: color-mix(in srgb, var(--tmgs2-blue) 11%, transparent);
}

html[data-theme="dark"] .game-tmgs2 .pc-section:nth-child(1),
html[data-theme="dark"] .game-tmgs2 .pc-section:nth-child(2),
html[data-theme="dark"] .game-tmgs2 .pc-section:nth-child(3),
html[data-theme="dark"] .game-tmgs2 .pc-section:nth-child(4) {
  background:
    repeating-linear-gradient(to bottom, transparent, transparent 21px, color-mix(in srgb, var(--tmgs2-blue) 13%, transparent) 21px, color-mix(in srgb, var(--tmgs2-blue) 13%, transparent) 22px),
    color-mix(in srgb, var(--white) 76%, var(--cream));
}

html[data-theme="dark"] .cat-sw,
html[data-theme="dark"] .color-swatch {
  border-color: rgba(255,255,255,0.32) !important;
}

@media (prefers-reduced-motion: reduce) {
  .bg-pinwheels img,
  .guide-header .header-pinwheel,
  .banner-pinwheel,
  .tmgs2-seagull,
  .tmgs2-seagull::before,
  body.game-tmgs2 .bg-pinwheels::before,
  body.game-tmgs2 .bg-pinwheels::after {
    animation: none !important;
  }
}

/* --- Mobile Readability Layer -------------------------------------------- */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.65;
  }

  .bg-pinwheels {
    display: none;
  }

  .window-tabs {
    margin-top: 8px;
    padding: 8px 8px 0;
    border-width: 3px;
  }

  .window-tab,
  .window-tab-active,
  .window-tab:hover,
  .window-tab:focus-visible {
    height: 40px;
  }

  .appearance-bar {
    right: 8px;
    bottom: -39px;
  }

  .theme-toggle {
    width: 42px;
    height: 36px;
  }

  #container {
    margin: 0 8px 16px;
    border-width: 3px;
    border-radius: 0 0 10px 10px;
  }

  #layout {
    border-left-width: 2px;
    border-right-width: 2px;
    box-shadow: none;
  }

  #layout::before {
    display: none;
  }

  .guide-header {
    padding: 12px 14px 10px;
    border-radius: 6px 6px 0 0;
  }

  .header-logo {
    height: 58px;
  }

  .header-mascot {
    display: none;
  }

  .guide-header .subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    margin-top: 1px;
  }

  .game-tmgs2 .guide-header .subtitle {
    margin-top: -5px;
  }

  .guide-subnav {
    justify-content: flex-start;
    overflow-x: auto;
    gap: 4px;
    padding: 7px 10px 0;
    scrollbar-width: thin;
  }

  .guide-subnav a {
    flex: 0 0 auto;
    width: 144px;
    height: 54px;
    gap: 7px;
    padding: 6px 14px 5px;
    font-size: 0.78rem;
  }

  .guide-subnav a.is-active,
  .guide-subnav a[aria-current="page"] {
    height: 58px;
  }

  .guide-subnav img {
    width: 24px;
    height: 24px;
  }

  .sidebar {
    padding: 10px 10px 12px;
    overflow: visible;
  }

  .sidebar-section {
    margin-bottom: 10px;
  }

  .sidebar-section h3 {
    margin-bottom: 8px;
  }

  .sidebar-logo {
    max-width: 150px;
  }

  .char-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .char-nav li {
    flex: 0 0 68px;
  }

  .char-nav a,
  .char-nav li.coming-soon span {
    flex-direction: column;
    text-align: center;
    gap: 4px;
    padding: 6px;
    font-size: 0.75em;
    min-height: 66px;
    justify-content: center;
  }

  .updates {
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
  }

  .sidebar-doodle {
    display: none;
  }

  main {
    padding: 16px 14px 20px;
    max-height: none;
    overflow: visible;
  }

  main h2,
  main h3 {
    white-space: normal;
    line-height: 1.18;
    letter-spacing: 0;
  }

  main h2 {
    font-size: 1.28rem;
  }

  main h3 {
    font-size: 1.16rem;
    margin-top: 18px;
  }

  main ul,
  main ol {
    margin-left: 18px;
  }

  .profile-card {
    margin: 10px 0 16px;
    border-radius: 10px;
    transform: none;
    overflow: hidden;
  }

  .char-subnav {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 8px 8px 6px;
    gap: 4px;
    scrollbar-width: thin;
  }

  .char-subnav .subnav-deco {
    display: none;
  }

  .char-subnav a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--white);
    font-size: 0.76rem;
  }

  .pc-header {
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
  }

  .game-tmgs2 .pc-header {
    display: flex;
  }

  .game-tmgs2 .pc-header-main {
    align-items: flex-start;
    gap: 10px;
  }

  .pc-avatar {
    width: 56px;
    height: 56px;
  }

  .pc-logo {
    display: none;
  }

  .pc-identity h2 {
    font-size: 1.08rem;
  }

  .pc-stats {
    gap: 2px 10px;
    font-size: 0.78rem;
  }

  .pc-fashion-row {
    flex-wrap: wrap;
    gap: 5px;
  }

  .pc-fashion-row > .gold-label {
    flex-basis: 100%;
  }

  .pc-body {
    grid-template-columns: 1fr;
  }

  .pc-section,
  .pc-section:nth-child(even),
  .pc-section:nth-last-child(-n+2) {
    border-right: none;
    border-bottom: 1px dashed var(--border);
  }

  .pc-section:last-child {
    border-bottom: none;
  }

  .pc-table tr {
    display: grid;
    grid-template-columns: minmax(92px, max-content) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 3px 0;
    border-bottom: 1px dotted color-mix(in srgb, var(--border) 70%, transparent);
  }

  .pc-table tr:last-child {
    border-bottom: none;
  }

  .pc-table td {
    display: block;
    padding: 0;
  }

  .pc-table td:first-child,
  .stat-table td:first-child {
    white-space: normal;
  }

  .pc-table td:first-child {
    width: auto;
    padding-right: 0;
  }

  .date-collapse {
    border-radius: 7px;
    margin: 9px 0;
  }

  .date-collapse summary {
    min-height: 40px;
    padding: 10px 12px;
    line-height: 1.3;
  }

  .da-area,
  .da-spot,
  .da-area .da-spot {
    margin-left: 6px;
    margin-right: 6px;
  }

  .da-answers {
    padding-left: 18px;
    padding-right: 10px;
  }

  .datespot-list {
    column-width: auto;
    columns: 1;
  }

  .cutscene-table,
  .skinship-table,
  .stat-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cutscene-table tbody,
  .cutscene-table thead,
  .skinship-table tbody,
  .skinship-table thead,
  .stat-table tbody {
    display: table;
    width: 100%;
    min-width: 520px;
  }

  .stat-table thead {
    display: table;
    width: 100%;
    min-width: 520px;
  }

  .cutscene-table th,
  .cutscene-table td,
  .skinship-table th,
  .skinship-table td,
  .stat-table th,
  .stat-table td {
    padding: 8px 10px;
  }

  .stat-table-scroll {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .stat-table-scroll > .stat-raising-data-table {
    display: table;
    width: max-content;
    min-width: 100%;
  }

  .stat-table-scroll > .stat-raising-data-table thead {
    display: table-header-group;
    width: auto;
    min-width: 0;
  }

  .stat-table-scroll > .stat-raising-data-table tbody {
    display: table-row-group;
    width: auto;
    min-width: 0;
  }

  .ending-paths {
    display: block;
    padding: 8px 12px;
  }

  .ending-path {
    margin: 0 0 8px 18px;
  }

  .ending-or {
    display: block;
    padding: 5px 0;
    border-left: none;
    border-top: 1px solid var(--border);
    text-align: center;
  }

  .friend-groups,
  .skinship-situations {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .friend-group {
    padding: 10px;
  }

  .skinship-charts {
    display: block;
  }

  .skinship-chart {
    overflow-x: auto;
  }

  .sk-row {
    min-width: 330px;
  }

  .welcome-box {
    padding: 16px;
    text-align: left;
  }

  .welcome-chibi {
    width: 76px;
    height: 66px;
  }

  footer {
    padding: 12px 36px;
    border-width: 2px;
  }
}

@media (max-width: 480px) {
  .horoscope-command-cell {
    min-height: 0;
  }

  .window-tab {
    padding: 4px 5px;
  }

  .window-tab img {
    max-height: 27px;
  }

  .header-logo {
    height: 48px;
  }

  main {
    padding: 14px 11px 18px;
  }

  .pc-header {
    flex-wrap: wrap;
  }

  .pc-avatar {
    width: 50px;
    height: 50px;
  }

  .pc-table tr {
    grid-template-columns: minmax(82px, max-content) minmax(0, 1fr);
    gap: 7px;
  }

  .cutscene-table tbody,
  .skinship-table tbody,
  .stat-table tbody {
    min-width: 480px;
  }

  .stat-table-scroll > .stat-raising-data-table {
    min-width: 480px;
  }
}
