/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

/* ===== iOS App Safe Area Insets ===== */
html {
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

/* ===== CSS Custom Properties (Theme) ===== */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #161b22;
  --bg-tertiary: #0d1117;
  --bg-card: rgba(22,27,34,.7);
  --bg-header: rgba(10,14,23,.82);
  --bg-header-scrolled: rgba(10,14,23,.95);
  --text-primary: #e6edf3;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --text-faint: #484f58;
  --border-primary: rgba(48,54,61,.6);
  --border-secondary: rgba(48,54,61,.3);
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-bg: rgba(88,166,255,.1);
  --accent-bg-strong: rgba(88,166,255,.15);
  --green: #7ee787;
  --green-bg: rgba(126,231,135,.12);
  --red: #f85149;
  --red-bg: rgba(248,81,73,.12);
  --yellow: #d29922;
  --yellow-bg: rgba(210,153,34,.12);
  --purple: #a78bfa;
  --purple-bg: rgba(167,139,250,.12);
  --bg-overlay-light: rgba(22,27,34,.3);
  --bg-overlay: rgba(22,27,34,.5);
  --bg-overlay-strong: rgba(22,27,34,.8);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #f0f3f6;
  --bg-card: rgba(255,255,255,.9);
  --bg-header: rgba(255,255,255,.92);
  --bg-header-scrolled: rgba(255,255,255,.98);
  --text-primary: #1f2328;
  --text-secondary: #424a53;
  --text-muted: #656d76;
  --text-faint: #8b949e;
  --border-primary: rgba(208,215,222,.8);
  --border-secondary: rgba(208,215,222,.5);
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-bg: rgba(9,105,218,.08);
  --accent-bg-strong: rgba(9,105,218,.12);
  --green: #1a7f37;
  --green-bg: rgba(26,127,55,.08);
  --red: #cf222e;
  --red-bg: rgba(207,34,46,.08);
  --yellow: #9a6700;
  --yellow-bg: rgba(154,103,0,.08);
  --purple: #8250df;
  --purple-bg: rgba(130,80,223,.08);
  --bg-overlay-light: rgba(208,215,222,.15);
  --bg-overlay: rgba(208,215,222,.3);
  --bg-overlay-strong: rgba(208,215,222,.5);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

/* ===== iOS Safe Area (Notch / Dynamic Island) ===== */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .site-header {
    padding-top: env(safe-area-inset-top);
  }
  .header-inner {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }
  .site-footer {
    padding-bottom: max(2.5rem, calc(2.5rem + env(safe-area-inset-bottom)));
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }
}

/* iOS standalone mode: prevent overscroll bounce */
@media (display-mode: standalone) {
  html { overscroll-behavior: none; }
  body { -webkit-overflow-scrolling: touch; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

/* ===== Skip Link (Accessibility) ===== */
.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: .75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: 0 0 8px 8px;
  transition: top .2s;
}
.skip-link:focus {
  top: 0;
  outline: none;
}

/* ===== Focus Visible (Accessibility) ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .3rem .5rem;
  transition: border-color .2s, background .2s;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-bg); }

/* ===== Scroll Progress Bar ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  z-index: 9999;
  transition: width .1s linear;
  pointer-events: none;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Header (Glassmorphism) ===== */
.site-header {
  background: var(--bg-header);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border-primary);
  padding: var(--sat) 0 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background .3s, box-shadow .3s;
}
.site-header.scrolled {
  background: var(--bg-header-scrolled);
  box-shadow: 0 4px 30px rgba(0,0,0,.3);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-logo {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.02em;
  transition: transform .2s;
  white-space: nowrap;
}
.site-logo:hover { transform: scale(1.03); color: var(--text-primary); }
.site-logo .wolf-icon { font-size: 1.5rem; filter: drop-shadow(0 0 8px rgba(88,166,255,.3)); }

/* Nav */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: .15rem;
  flex-wrap: wrap;
}
.main-nav a {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  transition: background .2s, color .2s, transform .15s, border-color .2s;
  position: relative;
  white-space: nowrap;
  border-left: 2px solid transparent;
}
.main-nav a .nav-icon {
  font-size: .85rem;
  flex-shrink: 0;
  line-height: 1;
}
.main-nav a:hover {
  background: var(--accent-bg);
  color: var(--accent);
  transform: translateY(-1px);
}
.main-nav a.active {
  background: var(--accent-bg-strong);
  color: var(--accent);
}
.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Header Search Button */
.header-search-btn {
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: .3rem .6rem;
  transition: border-color .2s, background .2s, color .2s;
  min-width: 40px;
  min-height: 40px;
}
.header-search-btn:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: .3rem .6rem;
  transition: border-color .2s, background .2s;
}
.nav-toggle:hover { border-color: var(--accent); background: var(--accent-bg); }

@media (max-width: 1023px) {
  .nav-toggle {
    display: block;
    min-width: 44px;
    min-height: 44px;
    position: relative;
    z-index: 102;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .main-nav {
    display: none;
    width: 100%;
    flex-basis: 100%;
    flex-shrink: 0;
    order: 3;
  }
  .main-nav.open {
    display: block;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-top: 1px solid var(--border-primary);
    padding-bottom: .5rem;
    animation: fadeIn .25s ease;
  }
  .main-nav ul { flex-direction: column; gap: 0; padding-top: .5rem; }
  .main-nav a {
    padding: .65rem 1rem;
    border-radius: 8px;
    font-size: .88rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: .5rem;
    border-left-width: 3px;
  }
  .main-nav a .nav-icon { font-size: 1rem; }
  .main-nav a:hover,
  .main-nav a:active {
    background: var(--accent-bg, rgba(88,166,255,.08));
  }
  .main-nav a.active {
    background: var(--accent-bg, rgba(88,166,255,.08));
    color: var(--accent);
    font-weight: 700;
  }
  .main-nav a.active::after { display: none; }
  .header-inner { flex-wrap: wrap; }
}

/* ===== Hero ===== */
.hero {
  position: relative;
  background: linear-gradient(135deg, #0f0a1e 0%, #0a0e17 40%, #081428 100%);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  border-bottom: 1px solid var(--border-primary);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(167,139,250,.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(88,166,255,.06) 0%, transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(126,231,135,.04) 0%, transparent 50%);
  animation: gradient-shift 15s ease infinite;
  background-size: 200% 200%;
  pointer-events: none;
}
.hero-bg-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 100%;
  width: auto;
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
  filter: grayscale(0.3);
}
.hero h1 {
  position: relative;
  font-size: 2.6rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #58a6ff, #7ee787);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .6rem;
  letter-spacing: -.03em;
  line-height: 1.3;
}
.hero p {
  position: relative;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ===== Page Layout (centered) ===== */
.page-layout {
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== Section ===== */
.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.02em;
}

/* ===== Cards Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  padding: 1.5rem;
  transition: transform .3s cubic-bezier(.22,1,.36,1), border-color .3s, box-shadow .3s;
  position: relative;
  overflow: hidden;
}
a.card { text-decoration: none; color: inherit; }
.card--center { text-align: center; }
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,166,255,.3), transparent);
  opacity: 0;
  transition: opacity .3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(88,166,255,.4);
  box-shadow: 0 8px 32px rgba(88,166,255,.08), 0 4px 16px rgba(0,0,0,.2);
}
.card:hover::before { opacity: 1; }
.card h3 {
  font-size: 1.1rem;
  margin-bottom: .5rem;
  color: var(--text-primary);
  font-weight: 700;
}
.card p { color: var(--text-muted); font-size: .9rem; line-height: 1.7; }
.card .card-icon {
  font-size: 2rem;
  margin-bottom: .75rem;
  display: inline-block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
}

/* ===== Role Badge ===== */
.role-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  margin: .15rem;
  letter-spacing: .02em;
}
.role-badge.village { background: rgba(126,231,135,.12); color: #7ee787; border: 1px solid rgba(126,231,135,.25); }
.role-badge.werewolf { background: rgba(248,81,73,.12); color: #f85149; border: 1px solid rgba(248,81,73,.25); }
.role-badge.fox { background: rgba(210,153,34,.12); color: #d29922; border: 1px solid rgba(210,153,34,.25); }
.role-badge.lovers { background: rgba(219,127,247,.12); color: #db7ff7; border: 1px solid rgba(219,127,247,.25); }
.role-badge.other { background: rgba(139,148,158,.12); color: var(--text-muted); border: 1px solid rgba(139,148,158,.25); }
.role-badge.devil { background: rgba(235,87,87,.12); color: #eb5757; border: 1px solid rgba(235,87,87,.25); }
.role-badge.chicken { background: rgba(247,181,56,.12); color: #f7b538; border: 1px solid rgba(247,181,56,.25); }

/* ===== Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  font-size: .88rem;
}
.data-table th, .data-table td {
  padding: .7rem .9rem;
  border: 1px solid var(--border-primary);
  text-align: left;
}
.data-table th {
  background: var(--bg-overlay-strong);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table tr:nth-child(even) { background: var(--bg-overlay-light); }
.data-table tr:hover { background: rgba(88,166,255,.04); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .5rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: background .2s, color .2s;
  font-family: inherit;
}
.tab-btn.active,
.tab-btn:hover {
  background: var(--bg-overlay-strong);
  color: var(--accent);
  border-bottom-color: var(--bg-overlay-strong);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Accordion ===== */
.accordion-item {
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  margin-bottom: .5rem;
  overflow: hidden;
  transition: border-color .3s;
}
.accordion-item:hover { border-color: rgba(88,166,255,.2); }
.accordion-item.open { border-color: rgba(88,166,255,.3); }
.accordion-header {
  width: 100%;
  padding: .9rem 1.2rem;
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: none;
  text-align: left;
  font-size: .93rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .2s;
  font-family: inherit;
}
.accordion-header:hover { background: rgba(28,33,41,.8); }
.accordion-header::after { content: '\25BC'; font-size: .7rem; transition: transform .3s; color: #484f58; }
.accordion-item.open .accordion-header::after { transform: rotate(180deg); color: var(--accent); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  background: rgba(10,14,23,.5);
}
.accordion-body-inner { padding: 1rem 1.2rem; }

/* ===== Tips Box ===== */
.tip-box {
  background: rgba(88,166,255,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  backdrop-filter: blur(4px);
}
.tip-box.warning {
  background: rgba(210,153,34,.06);
  border-left-color: #d29922;
}
.tip-box.danger {
  background: rgba(248,81,73,.06);
  border-left-color: #f85149;
}

/* ===== Filter / Search ===== */
.search-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: .6rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: rgba(10,14,23,.6);
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.filter-btn {
  padding: .5rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: all .2s;
  font-family: inherit;
}
.filter-btn.active,
.filter-btn:hover {
  background: var(--bg-overlay-strong);
  color: var(--accent);
  border-color: rgba(88,166,255,.4);
}

/* ===== Footer ===== */
.site-footer {
  background: rgba(13,17,23,.8);
  border-top: 1px solid var(--border-secondary);
  padding: 2.5rem 1.5rem calc(2.5rem + var(--sab));
  text-align: center;
  color: #484f58;
  font-size: .82rem;
  margin-top: 3rem;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,166,255,.2), rgba(167,139,250,.2), transparent);
}
.footer-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto 1.5rem;
  text-align: left;
}
.footer-columns h4 {
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .6rem;
}
.footer-columns a {
  display: block;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 2;
  transition: color .2s;
}
.footer-columns a:hover { color: var(--accent); }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-links a {
  color: var(--text-muted);
  font-size: .82rem;
  transition: color .2s;
}
.footer-links a:hover { color: var(--accent); }

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-overlay-strong);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-primary);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s, visibility .3s, transform .3s, background .2s, color .2s, border-color .2s;
  z-index: 90;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: rgba(88,166,255,.15);
  color: var(--accent);
  border-color: rgba(88,166,255,.4);
}

/* ===== Simulator specific ===== */
.sim-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}
.sim-control label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
  font-weight: 600;
}
.sim-control select, .sim-control input[type="number"] {
  padding: .5rem .8rem;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  background: rgba(10,14,23,.6);
  color: var(--text-primary);
  font-size: .88rem;
  font-family: inherit;
  transition: border-color .2s;
}
.sim-control select:focus, .sim-control input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}
.btn {
  padding: .55rem 1.2rem;
  border: none;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #238636, #2ea043);
  color: #fff;
  box-shadow: 0 2px 12px rgba(35,134,54,.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2ea043, #3fb950);
  box-shadow: 0 4px 20px rgba(35,134,54,.3);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(33,38,45,.8);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}
.btn-secondary:hover {
  background: var(--bg-overlay-strong);
  border-color: rgba(88,166,255,.3);
}

.role-pool {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: 1rem;
  border: 1px dashed var(--border-primary);
  border-radius: 10px;
  min-height: 60px;
  margin-bottom: 1rem;
  transition: border-color .2s;
}
.role-pool:hover { border-color: rgba(88,166,255,.3); }

/* ===== Breadcrumb ===== */
.breadcrumb {
  font-size: .82rem;
  color: #484f58;
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .4rem; }

/* ===== Table Scroll Wrapper ===== */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}
.table-scroll .data-table { margin-bottom: 0; }

/* ===== Responsive Images ===== */
img { max-width: 100%; height: auto; }

/* ===== PC Layout (1024px+) ===== */
@media (min-width: 1024px) {
  /* Offset for fixed right banner (120px) */
  body {
    padding-right: 130px;
  }
  .site-header {
    padding-right: 130px;
  }
  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }
  .card-grid.card-grid--contents {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* ===== Responsive: Tablet (below 1024px) ===== */
@media (max-width: 1023px) {
  .hero h1 { font-size: 2.1rem; }
  .hero { padding: 4rem 1.2rem 3rem; }
  .container { padding: 2rem 1.2rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .sim-controls { gap: .75rem; }
  .site-footer { padding: 2rem 1.2rem; }
}

@media (max-width: 1023px) {
  .footer-columns { grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
}

/* ===== Responsive: Small Tablet / Large Phone (768px) ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: .95rem; }
  .hero { padding: 3.5rem 1rem 2.5rem; }
  .container { padding: 1.5rem 1rem; }

  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
  .card { padding: 1.2rem; }

  .section-title { font-size: 1.2rem; }
  .data-table { font-size: .82rem; }
  .data-table th, .data-table td { padding: .5rem .6rem; }

  .tabs { gap: .2rem; }
  .tab-btn { padding: .4rem .7rem; font-size: .78rem; }

  .search-bar { flex-direction: column; }
  .search-input { min-width: 100%; }

  .sim-controls { flex-direction: column; align-items: stretch; }

  .footer-links { gap: 1rem; }

  .exclusion-table { font-size: .65rem; }
  .exclusion-table th, .exclusion-table td { padding: .25rem .2rem; min-width: 28px; }
  .exclusion-table thead th span { font-size: .65rem; max-height: 70px; }
  .exclusion-table tbody th { font-size: .65rem; padding-right: .4rem; }
}

/* ===== Responsive: Phone (375px~) ===== */
@media (max-width: 600px) {
  body { font-size: 15px; line-height: 1.65; }

  .hero h1 { font-size: 1.5rem; letter-spacing: -.01em; }
  .hero p { font-size: .9rem; line-height: 1.7; }
  .hero { padding: 2.5rem .8rem 2rem; }

  .container { padding: 1.2rem .8rem; }

  .card-grid { grid-template-columns: 1fr; gap: .8rem; }
  .card { padding: 1rem; border-radius: 10px; }
  .card h3 { font-size: 1rem; }
  .card p { font-size: .85rem; }

  .section-title { font-size: 1.1rem; gap: .4rem; }

  .data-table { font-size: .78rem; }
  .data-table th, .data-table td { padding: .4rem .5rem; }

  .tabs { gap: .15rem; }
  .tab-btn { padding: .35rem .55rem; font-size: .75rem; }

  .accordion-header { padding: .75rem 1rem; font-size: .88rem; }
  .accordion-body-inner { padding: .8rem 1rem; }

  .tip-box { padding: .8rem 1rem; font-size: .85rem; }

  .filter-btn { padding: .4rem .7rem; font-size: .78rem; }
  .btn { padding: .5rem 1rem; font-size: .85rem; }

  .back-to-top { bottom: 1rem; right: 1rem; width: 40px; height: 40px; border-radius: 10px; }

  .site-footer { padding: 1.5rem .8rem; margin-top: 2rem; }
  .footer-links { gap: .8rem; font-size: .78rem; }
  .footer-links a { font-size: .78rem; }

  .breadcrumb { font-size: .78rem; }

  .role-badge { font-size: .7rem; padding: .15rem .5rem; }

  .sim-controls { gap: .5rem; }
  .sim-control select, .sim-control input[type="number"] { font-size: .85rem; padding: .45rem .6rem; }

  .site-logo { font-size: 1.1rem; }
  .site-logo .wolf-icon { font-size: 1.3rem; }

  /* Nav in mobile */
  .main-nav a { padding: .55rem .8rem; font-size: .85rem; }
}

/* ===== iPhone 14 / modern phones (390px) ===== */
@media (max-width: 414px) {
  .card-grid { gap: .7rem; }
  .card { padding: .9rem; }
  .card h3 { font-size: .95rem; }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: .88rem; }
  .section-title { font-size: 1.05rem; }
  .accordion-header { font-size: .85rem; }
  .tab-btn { font-size: .72rem; padding: .3rem .5rem; }
  .role-badge { font-size: .68rem; }
}

/* ===== iPhone SE / Very small phones (375px-) ===== */
@media (max-width: 374px) {
  body { font-size: 14px; }
  .hero h1 { font-size: 1.2rem; }
  .hero p { font-size: .82rem; }
  .hero { padding: 2rem .6rem 1.5rem; }
  .container { padding: .8rem .6rem; }
  .card { padding: .7rem; }
  .card h3 { font-size: .9rem; }
  .card p { font-size: .8rem; }
  .section-title { font-size: 1rem; }
  .timer-display { font-size: 3rem !important; }
  .site-logo { font-size: 1rem; }
  .data-table { font-size: .72rem; }
  .data-table th, .data-table td { padding: .3rem .4rem; }
  .footer-links { grid-template-columns: 1fr; }
}

/* ===== SP Touch Targets ===== */
@media (max-width: 1023px) {
  /* Ensure all interactive elements meet 44px minimum */
  .btn, .filter-btn, .tab-btn, button {
    min-height: 44px;
  }
  .main-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  /* Table horizontal scroll indicator */
  .table-scroll {
    position: relative;
  }
  .table-scroll::after {
    content: '\2192 \30B9\30AF\30ED\30FC\30EB';
    display: block;
    text-align: right;
    font-size: .7rem;
    color: #484f58;
    padding: .3rem .5rem 0;
  }
  /* Footer links as grid on mobile */
  .footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
    text-align: left;
  }
  .footer-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: .3rem .5rem;
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    justify-content: center;
  }
}

/* ===== Game Screenshots ===== */
.screenshot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
  margin: 1.2rem 0;
}
.screenshot-item {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .3s, transform .2s;
}
.screenshot-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.screenshot-item img {
  width: 100%;
  height: auto;
  display: block;
}
.screenshot-item .screenshot-caption {
  padding: .7rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
}
.screenshot-single {
  max-width: 400px;
  margin: 1.2rem auto;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  overflow: hidden;
}
.screenshot-single img {
  width: 100%;
  height: auto;
  display: block;
}
.screenshot-single .screenshot-caption {
  padding: .7rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 600px) {
  .screenshot-gallery {
    grid-template-columns: 1fr;
  }
  .screenshot-single {
    max-width: 100%;
  }
}

/* ===== Selection ===== */
::selection {
  background: rgba(88,166,255,.25);
  color: var(--text-primary);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ===== Window Controls Overlay (Desktop PWA) ===== */
@media (display-mode: window-controls-overlay) {
  .site-header {
    padding-top: env(titlebar-area-y, 0);
  }
  .header-inner {
    padding-left: max(1.5rem, env(titlebar-area-x, 1.5rem));
    padding-right: calc(100% - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100%) + 1rem);
  }
  .site-header {
    -webkit-app-region: drag;
    app-region: drag;
  }
  .site-header a,
  .site-header button,
  .site-header nav {
    -webkit-app-region: no-drag;
    app-region: no-drag;
  }
}

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 9998;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.22,1,.36,1);
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 20px rgba(0,0,0,.3);
}
.pwa-install-banner.show {
  transform: translateY(0);
}
.pwa-install-banner-text {
  font-size: .88rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.pwa-install-banner-text strong {
  color: var(--text-primary);
}
.pwa-install-btn {
  padding: .5rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
}
.pwa-install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(88,166,255,.3);
}
.pwa-install-dismiss {
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .8rem;
  cursor: pointer;
  padding: .4rem .8rem;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
}
.pwa-install-dismiss:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}
@media (max-width: 600px) {
  .pwa-install-banner {
    flex-wrap: wrap;
    gap: .6rem;
    padding: .7rem 1rem;
  }
  .pwa-install-banner-text {
    font-size: .82rem;
    flex-basis: 100%;
    text-align: center;
  }
}

/* ===== Standalone/PWA mode adjustments ===== */
@media (display-mode: standalone) {
  .pwa-install-banner { display: none !important; }
}

/* Sidebar styles: see css/sidebar.css */

/* ===== Affiliate Banner ===== */
.affiliate-banner {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--bg-overlay);
  border-top: 1px solid var(--border-secondary);
}

/* ===== Auto Table of Contents ===== */
.auto-toc {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.auto-toc summary {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
}
.auto-toc summary::-webkit-details-marker { display: none; }
.auto-toc summary::before { content: '\25B6'; margin-right: .5rem; font-size: .7rem; transition: transform .2s; display: inline-block; }
.auto-toc[open] summary::before { transform: rotate(90deg); }
.auto-toc ol {
  margin: .75rem 0 0;
  padding-left: 1.5rem;
}
.auto-toc li { line-height: 2; font-size: .9rem; }
.auto-toc a { color: var(--text-secondary); }
.auto-toc a:hover { color: var(--accent); }

/* ===== Video Embed ===== */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.video-embed iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border-radius: 10px;
}

/* ===== V3 Announcement ===== */
.tip-box--purple {
  background: rgba(167,139,250,.1);
  border-left-color: #a78bfa;
  margin-bottom: 2rem;
}
.tip-box--purple a { color: #a78bfa; font-weight: 700; }

/* ===== Print Styles ===== */
@media print {
  .site-header, .site-footer, .nav-toggle, .back-to-top,
  .affiliate-banner, .page-sidebar, .hero, .search-bar, .filter-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .container { max-width: 100%; padding: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Quick Search Modal ===== */
.qs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.qs-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.qs-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  overflow: hidden;
}
.qs-input {
  width: 100%;
  padding: .9rem 1.2rem;
  border: none;
  border-bottom: 1px solid var(--border-primary);
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.qs-input::placeholder { color: var(--text-muted); }
.qs-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: .4rem 0;
}
.qs-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem 1.2rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: background .15s;
}
.qs-item:hover, .qs-item.active {
  background: var(--accent-bg);
}
.qs-item.active { color: var(--text-primary); }
.qs-icon { font-size: 1.2rem; width: 1.5rem; text-align: center; flex-shrink: 0; }
.qs-text { display: flex; flex-direction: column; min-width: 0; }
.qs-title { font-weight: 600; font-size: .92rem; }
.qs-desc { font-size: .78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-hint {
  padding: .5rem 1.2rem;
  font-size: .72rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border-secondary);
  text-align: center;
}

/* ===== Toast Notification ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: .8rem 1.5rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--error {
  background: var(--red-bg);
  border: 1px solid var(--red);
  color: var(--red);
}
.toast--success {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: var(--green);
}
.toast--info {
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ===== Affiliate Banner Responsive ===== */
.af-pc { display: none; }
.af-pc img { max-width: 100%; height: auto; }
.af-sp { display: inline; }
@media (min-width: 768px) {
  .af-pc { display: inline; }
  .af-sp { display: none; }
}
