/* ==========================================================================
   ブレモン・コネクト～ブレイブ・モンスターズ公式～
   Accessible Stylesheet (WCAG 2.1 AA/AAA準拠・レスポンシブ・高コントラスト対応)
   ========================================================================== */

:root {
  --bg-page: #0b1020;
  --bg-surface: #131b33;
  --bg-elevated: #1a2647;
  --bg-header: #080c18;
  --text-main: #f5f8ff;
  --text-muted: #d0dcf5;
  --accent-primary: #ffd86b;
  --accent-secondary: #82cfff;
  --link-color: #8ad4ff;
  --link-hover: #ffffff;
  --btn-primary-bg: #ffd86b;
  --btn-primary-text: #0b1020;
  --btn-primary-hover: #ffe699;
  --btn-secondary-bg: #1a2647;
  --btn-secondary-text: #f5f8ff;
  --btn-secondary-border: #82cfff;
  --badge-beta-bg: #2a1f05;
  --badge-beta-border: #ffd86b;
  --badge-beta-text: #ffe596;
  --border-subtle: #3d5285;
  --focus-ring: #ffea85;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
  --max-width: 1120px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

html[data-theme="light"] {
  --bg-page: #f4f7fc;
  --bg-surface: #ffffff;
  --bg-elevated: #eaf0fa;
  --bg-header: #ffffff;
  --text-main: #101828;
  --text-muted: #293852;
  --accent-primary: #704200;
  --accent-secondary: #00449e;
  --link-color: #00449e;
  --link-hover: #00275e;
  --btn-primary-bg: #0f3d8a;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #092a63;
  --btn-secondary-bg: #ffffff;
  --btn-secondary-text: #0f3d8a;
  --btn-secondary-border: #0f3d8a;
  --badge-beta-bg: #fff6db;
  --badge-beta-border: #8a5300;
  --badge-beta-text: #5c3700;
  --border-subtle: #788ba8;
  --focus-ring: #c44d00;
  --shadow-card: 0 4px 16px rgba(16, 24, 40, 0.08);
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

html[data-font-scale="large"] {
  font-size: 115%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Meiryo", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.85;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}

/* Visually hidden utility for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 700;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  text-decoration: underline;
  box-shadow: var(--shadow-card);
}

.skip-link:focus {
  top: 1rem;
}

/* Focus indicator */
a:focus-visible,
button:focus-visible,
audio:focus-visible,
summary:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--link-hover);
}

/* Layout containers */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Navigation */
.site-header {
  background-color: var(--bg-header);
  border-bottom: 2px solid var(--border-subtle);
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 700;
}

.site-brand:hover {
  color: var(--accent-primary);
}

.site-brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
}

.site-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.site-brand-main {
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.site-brand-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Accessibility toolbar */
.a11y-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-elevated);
  color: var(--text-main);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.tool-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-main);
  text-decoration: underline;
}

.tool-btn[aria-pressed="true"] {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}

/* Global Navigation */
.global-nav {
  border-top: 1px solid var(--border-subtle);
  padding: 0.5rem 0;
}

.global-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.global-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1.5px solid transparent;
}

.global-nav-link:hover {
  background-color: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-main);
  text-decoration: underline;
}

.global-nav-link[aria-current="page"] {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
  text-decoration: none;
}

/* Breadcrumb */
.breadcrumb {
  padding: 0.9rem 0 0.2rem;
  font-size: 0.94rem;
}

.breadcrumb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-muted);
}

.breadcrumb-list li + li::before {
  content: "›";
  content: "›" / "";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.breadcrumb-list a[aria-current="page"] {
  color: var(--text-main);
  font-weight: 700;
  text-decoration: none;
}

/* Main Content */
main {
  padding: 2rem 0 4rem;
}

/* Hero Section */
.hero {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2.75rem;
}

.status-banner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--badge-beta-bg);
  color: var(--badge-beta-text);
  border: 1.5px solid var(--badge-beta-border);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  line-height: 1.35;
}

.hero-en-title {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-lead {
  font-size: 1.15rem;
  max-width: 68ch;
  margin: 0 0 1.5rem;
}

.hero-visual {
  margin: 1.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border-subtle);
  background-color: #0b1020;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.btn-primary:hover {
  background-color: var(--btn-primary-hover);
  color: var(--btn-primary-text);
  text-decoration: underline;
}

.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}

.btn-secondary:hover {
  background-color: var(--bg-elevated);
  color: var(--text-main);
  text-decoration: underline;
}

/* Page Header (Subpages) */
.page-header {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.page-header h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.35;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
  max-width: 70ch;
}

/* Page Table of Contents */
.page-toc {
  background-color: var(--bg-elevated);
  border-left: 5px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
}

.page-toc-title {
  margin: 0 0 0.65rem;
  font-size: 1.08rem;
  font-weight: 700;
}

.page-toc ul {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.4rem;
}

@media (min-width: 720px) {
  .page-toc ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
  }
}

/* Sections & Headings */
.content-section {
  margin-bottom: 3rem;
}

.content-section h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.4;
  margin: 0 0 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-subtle);
  color: var(--accent-primary);
}

.content-section h3 {
  font-size: 1.22rem;
  line-height: 1.45;
  margin: 1.6rem 0 0.65rem;
  color: var(--text-main);
}

.content-section p {
  max-width: 74ch;
  margin: 0 0 1.1rem;
}

/* Cards & Grids */
.card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .card-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card h3 {
  margin-top: 0;
  color: var(--accent-primary);
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

/* Character & Monster Media Cards */
.character-card {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  align-items: start;
  margin-bottom: 1.75rem;
}

@media (min-width: 720px) {
  .character-card {
    grid-template-columns: 240px 1fr;
  }
}

.character-portrait {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border-subtle);
  background-color: #070a14;
  max-width: 260px;
  margin: 0 auto;
}

.character-portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.role-tag {
  display: inline-block;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

.monster-card img {
  display: block;
  width: 176px;
  height: 176px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  margin: 0 auto 1rem;
}

.voice-box {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.voice-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.voice-box audio {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
}

/* Evolution strip */
.evo-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .evo-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.evo-step {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.evo-step img {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.65rem;
}

/* Definition Lists (Replaces tables for clear linear reading) */
.spec-list {
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.spec-item {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.spec-item dt {
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.spec-item dd {
  margin: 0;
}

/* News list */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.news-item {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.news-tag {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
  padding: 0.1rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
}

/* Callout Box */
.callout {
  background-color: var(--bg-elevated);
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin: 1.5rem 0;
}

.callout-title {
  margin: 0 0 0.45rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-primary);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Ordered Region List */
.region-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .region-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.region-item {
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.35rem;
}

.region-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1.12rem;
  color: var(--accent-primary);
}

.region-item p {
  margin: 0;
  font-size: 0.98rem;
}

/* Footer */
.site-footer {
  background-color: var(--bg-header);
  border-top: 2px solid var(--border-subtle);
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-nav-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.footer-meta p {
  margin: 0.35rem 0;
}

/* Homepage sharing and aggregate access count */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.share-tools [hidden], .visit-counter[hidden] {
  display: none !important;
}

.share-note {
  color: var(--text-muted);
  font-size: 0.9rem;
}

#share-url {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 36rem;
  padding: 0.75rem;
  background: var(--bg-page);
  color: var(--text-main);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font: inherit;
}

.visit-counter {
  margin-bottom: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.visit-counter p {
  margin: 0.35rem 0;
}

/* Beta application: native controls, visible labels and keyboard focus. */
.beta-application {
  padding-bottom: 3rem;
}

.beta-form {
  max-width: 52rem;
}

.form-field {
  margin: 1.5rem 0;
}

.form-field > label, .form-field legend {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.form-field input[type="text"], .form-field input[type="email"], .form-field textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

fieldset.form-field {
  padding: 1rem;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.form-choice {
  display: flex !important;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0;
  font-weight: 400 !important;
}

.form-choice input {
  flex: 0 0 auto;
  margin-top: 0.35rem;
  width: 1.25rem;
  height: 1.25rem;
}

.form-errors {
  border: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--bg-elevated);
}

.beta-application .spec-item dd {
  overflow-wrap: anywhere;
}
