:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --surface-strong: #eef2ff;
  --text: #111827;
  --muted: #4b5563;
  --soft: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-soft: #dcfce7;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --blue: #3b82f6;
  --map-route-color: #facc15;
  --map-route-outline: #111827;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 22px 45px rgba(15, 23, 42, 0.14);
  --radius: 8px;
}

html.dark {
  color-scheme: dark;
  --bg: #111827;
  --surface: #1f2937;
  --surface-muted: #111827;
  --surface-strong: #172033;
  --text: #f3f4f6;
  --muted: #d1d5db;
  --soft: #9ca3af;
  --border: #374151;
  --border-strong: #4b5563;
  --primary: #22c55e;
  --primary-hover: #4ade80;
  --primary-soft: rgba(34, 197, 94, 0.14);
  --danger: #f87171;
  --danger-hover: #ef4444;
  --blue: #60a5fa;
  --map-route-color: #fde047;
  --map-route-outline: #020617;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 50px rgba(0, 0, 0, 0.45);
}

/* Shared design tokens and shell follow the Japan site. Existing page utilities
   remain supported so game, planning and administration forms keep their layout. */
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-padding-top: 5rem; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.page-shell, .nav-inner, .footer-inner, .flash-wrap, .admin-workspace-inner { width: 100%; max-width: 1152px; margin-inline: auto; padding-inline: 1rem; }
.page-shell { flex: 1; min-width: 0; padding-block: 1.5rem 2.5rem; }
.page-shell h1 { letter-spacing: -.025em; }
.site-nav { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.nav-inner { min-height: 64px; display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; padding-block: .65rem; }
.brand-link { display: inline-flex; align-items: center; gap: .6rem; font-size: 1.15rem; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: var(--radius); background: var(--primary); color: #052e16; }
.nav-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; order: 3; }
.nav-links { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.nav-links a, .theme-toggle, .navbar-toggle, .account-menu summary, .admin-workspace-links a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .5rem .65rem; border-radius: var(--radius); font-size: .875rem; font-weight: 600; text-decoration: none; }
.nav-links a:hover, .theme-toggle:hover, .account-menu summary:hover, .admin-workspace-links a:hover { background: var(--surface-muted); }
.nav-links a[aria-current], .admin-workspace-links a[aria-current] { background: var(--primary-soft); color: var(--primary-hover); }
.theme-toggle, .navbar-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.navbar-toggle { display: none; }
.login-nav-button { background: #2563eb; color: white; }
.nav-links .login-nav-button:hover { background: #1d4ed8; }
.account-menu { position: relative; }
.account-panel { position: absolute; right: 0; top: 100%; width: min(19rem, 85vw); padding: .65rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.account-panel a { display: flex; }
.account-email { display: block; padding: .5rem .65rem; color: var(--soft); overflow-wrap: anywhere; font-size: .8rem; }
.site-footer { border-top: 1px solid var(--border); color: var(--soft); font-size: .85rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; }
.flash-wrap { padding-top: 1rem; }
.flash { padding: .85rem 1rem; margin-bottom: .5rem; border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: var(--radius); background: var(--surface); }
.flash-success { border-left-color: var(--primary); }
.flash-error, .flash-danger { border-left-color: var(--danger); }
.dev-banner { padding: .35rem 1rem; text-align: center; background: var(--primary-soft); color: var(--text); font-size: .75rem; }
.admin-workspace-nav { border-bottom: 1px solid var(--border); background: var(--surface); }
.admin-workspace-inner { display: flex; align-items: center; gap: 1.5rem; padding-block: .8rem; }
.admin-workspace-inner strong, .eyebrow { display: block; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; color: var(--soft); }
.admin-workspace-links { display: flex; gap: .25rem; overflow-x: auto; }
.skip-link { position: fixed; top: -5rem; left: 1rem; padding: .75rem 1rem; z-index: 100; background: var(--surface); border: 2px solid var(--primary); }
.skip-link:focus { top: .5rem; }
/* Shared form and data surfaces across public and administrative pages. */
.page-shell :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]), select, textarea) { max-width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); background-color: var(--surface); color: var(--text); }
.page-shell :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select) { min-height: 2.65rem; }
.page-shell :where(input[type=checkbox], input[type=radio]) { accent-color: var(--primary); }
.page-shell :where(table) { width: 100%; font-size: .9rem; }
.page-shell :where(th) { color: var(--muted); font-weight: 650; background: var(--surface-muted); }
.page-shell :where(th, td) { border-color: var(--border); }
.page-shell :where(tbody tr:hover) { background-color: var(--primary-soft); }
.page-shell :where(.bg-white, .dark\:bg-gray-800) { background-color: var(--surface); }
.page-shell :where(.shadow, .shadow-md, .shadow-lg) { box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.page-shell :where(.rounded-lg, .rounded-xl, .rounded-2xl) { border-radius: var(--radius); }
.page-intro { margin-bottom: 1.5rem; }
.page-intro h1 { margin: .25rem 0 .5rem; font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 750; }
.page-intro p { color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
.feature-card, .data-panel { display: block; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.feature-card { text-decoration: none; transition: border-color .15s ease; }
.feature-card:hover { border-color: var(--primary); }
.feature-card h2 { margin-bottom: .5rem; font-size: 1.1rem; font-weight: 700; }
.feature-card p { color: var(--muted); font-size: .9rem; }
.feature-card .card-link { display: block; margin-top: 1.25rem; color: var(--primary-hover); font-weight: 650; font-size: .875rem; }
@media (max-width: 1100px) {
  .nav-actions { order: 0; }
  .navbar-toggle { display: inline-flex; }
  .nav-links { display: none; width: 100%; margin: 0; align-items: stretch; flex-direction: column; padding-block: .5rem; }
  .nav-links.is-open { display: flex; max-height: calc(100dvh - 5rem); overflow-y: auto; }
  .account-panel { position: static; width: 100%; box-shadow: none; }
  .admin-workspace-inner { align-items: flex-start; flex-direction: column; gap: .5rem; }
  .admin-workspace-links { max-width: 100%; }
  .admin-workspace-links a { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.chart-container { position: relative; height: clamp(220px, 35vw, 360px); }
