/* ============================================
   TMGS4 English Guide - Retro Neocities Style
   with game assets integration
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

@font-face {
  font-family: 'MaruGothic';
  src: url('/assets/fonts/DF-FutoMaruGothic-W9-CAB-18277f51d7ae7c3bd42f53247de2bb48--4329643920678357007.ttf') format('truetype');
  font-weight: 700;
}

@font-face {
  font-family: 'MaruGothic';
  src: url('/assets/fonts/DF-HeiSeiMaruGothic-W4-CAB-18277f51d7ae7c3bd42f53247de2bb48-2057771419379400601.ttf') format('truetype');
  font-weight: 400;
}

/* --- 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;
}

/* --- 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);
}

/* --- 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;
}

/* --- 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;
}

/* --- 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%, var(--white)) 0%, var(--paper-bg) 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); }
}

.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);
}

.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;
}

/* --- 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),
    var(--white);
  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 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85em;
  border-radius: 8px;
  transition: all 0.2s;
}

.char-nav a:hover {
  background: var(--pink-light);
  color: var(--pink-dark);
  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);
}

/* --- 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-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;
}

.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/contain 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);
}

.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);
}

.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-section {
  padding: 8px 14px 6px;
  border-bottom: 1px dashed var(--border);
  border-right: 1px dashed var(--border);
}

.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:first-child {
  font-weight: 700;
  color: var(--pink-dark);
  white-space: nowrap;
  padding-right: 8px;
  width: 1%;
}

.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);
}

.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);
}


/* --- 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;
}

/* 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/contain no-repeat;
}

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"] .cat-sw,
html[data-theme="dark"] .color-swatch {
  border-color: rgba(255,255,255,0.32) !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;
  }

  .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;
  }

  .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,
  .skinship-table tbody,
  .stat-table tbody {
    display: table;
    width: 100%;
    min-width: 520px;
  }

  .cutscene-table th,
  .cutscene-table td,
  .skinship-table th,
  .skinship-table td,
  .stat-table td {
    padding: 8px 10px;
  }

  .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) {
  .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;
  }
}
