:root {
  --cream-bg: #FBF3E7;
  --cream-card: #FFFAF0;
  --cream-deep: #F5E9D3;
  --terracotta: #C9663F;
  --terracotta-light: #E07A57;
  --terracotta-dark: #A04C2A;
  --text-dark: #3B2A1F;
  --text-mid: #6B5547;
  --text-light: #8B7568;
  --border: #E8D9C0;
  --shadow: 0 2px 12px rgba(180, 120, 80, 0.08);
  --sidebar-w: 220px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body.portal {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--cream-bg);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--cream-deep);
  border-right: 1px solid var(--border);
  padding: 20px 0 24px;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--text-mid);
  cursor: pointer;
}
.sidebar-brand {
  padding: 0 18px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.sidebar-brand .brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--terracotta-dark);
}
.sidebar-brand .brand-tag {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px 4px;
}
.nav-item {
  display: block;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-mid);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  background: var(--terracotta);
  color: #fff;
  border-left-color: var(--terracotta-dark);
}
.main-content {
  margin-left: var(--sidebar-w);
  padding: 32px 36px 60px;
  min-width: 0;
}
.page-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--terracotta);
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--terracotta-dark);
  margin-bottom: 6px;
}
.page-header p { font-size: 13px; color: var(--text-light); }
.badge-count {
  display: inline-block;
  background: var(--terracotta);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}
.section { margin-bottom: 40px; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--terracotta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.filter-search {
  width: calc(100% - 36px);
  margin: 8px 18px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.char-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.char-card {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.15s;
  height: 100%;
}
.char-card:hover {
  box-shadow: 0 4px 20px rgba(180, 120, 80, 0.15);
  transform: translateY(-2px);
}
.char-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.char-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cream-deep);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--terracotta-dark);
  flex-shrink: 0;
  overflow: hidden;
}
.char-icon img { width: 100%; height: 100%; object-fit: cover; }
.char-name { font-size: 16px; font-weight: 700; color: var(--text-dark); margin-bottom: 2px; }
.char-folder {
  font-size: 11px;
  color: var(--text-light);
  font-family: monospace;
  background: var(--cream-deep);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
}
.char-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}
.gender-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.gender-f { background: #fce4ec; color: #c2185b; }
.gender-m { background: #e3f2fd; color: #1565c0; }
.gender-n { background: var(--cream-deep); color: var(--text-light); }
.char-genre {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.sub-text { font-size: 11px; color: var(--text-light); display: block; margin-top: 2px; }
.ops-teaser {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.ops-teaser h2 {
  font-size: 16px;
  color: var(--terracotta-dark);
  margin-bottom: 8px;
}
.ops-teaser p {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 14px;
}
.ops-teaser ul {
  font-size: 13px;
  color: var(--text-mid);
  padding-left: 18px;
  margin-bottom: 16px;
}
.ops-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--terracotta);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.ops-link:hover { background: var(--terracotta-dark); }
.build-meta {
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-light);
}
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--cream-deep);
  border-bottom: 1px solid var(--border);
}
.mobile-topbar .mtop-name { font-weight: 800; color: var(--terracotta-dark); font-size: 15px; }
.mtop-burger {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(59, 42, 31, 0.35);
  z-index: 90;
}
@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  body.portal { padding-top: 48px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    top: 48px;
    height: calc(100vh - 48px);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-backdrop.is-visible { display: block; }
  .main-content { margin-left: 0; padding: 20px 16px 48px; }
}
@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px 12px 40px; }
}
@media (max-width: 400px) {
  .page-header h1 { font-size: 20px; }
}
