@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@300;400;700;900&family=Share+Tech+Mono&display=swap');

/* ===== CSS Variables ===== */
:root {
  --bg: #f5f4f0;
  --bg2: #eceae4;
  --bg3: #e0ddd5;
  --surface: #ffffff;
  --surface2: #f9f8f5;
  --border: #d4d0c8;
  --text: #1a1a1a;
  --text2: #555550;
  --text3: #888880;
  --accent: #1a6b3c;
  --accent2: #0d4a28;
  --warn: #c0392b;
  --warn2: #e74c3c;
  --safe: #27ae60;
  --mono: 'Share Tech Mono', monospace;
  --sans: 'Zen Kaku Gothic New', sans-serif;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 8px;
  --nav-h: 64px;
}

[data-theme="dark"] {
  --bg: #0d0f0d;
  --bg2: #121512;
  --bg3: #1a1e1a;
  --surface: #1e221e;
  --surface2: #252a25;
  --border: #2e352e;
  --text: #e8ede8;
  --text2: #a0ada0;
  --text3: #607060;
  --accent: #3dba6a;
  --accent2: #2d9a55;
  --warn: #e05050;
  --warn2: #ff6b6b;
  --safe: #3dba6a;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-logo span { color: var(--text3); font-size: 0.75rem; font-family: var(--sans); font-weight: 300; }
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 16px;
  list-style: none;
  flex: 1;
}
.nav-links a {
  font-size: 0.8rem;
  color: var(--text2);
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--bg2);
  color: var(--accent);
  text-decoration: none;
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.theme-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  gap: 6px;
}
.theme-btn:hover { background: var(--bg3); color: var(--text); }
.live-badge {
  background: var(--warn);
  color: #fff;
  font-size: 0.65rem;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg) 60%);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '☢';
  position: absolute;
  font-size: 20rem;
  opacity: 0.03;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: spin-slow 60s linear infinite;
}
@keyframes spin-slow {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.hero-tag {
  display: inline-block;
  background: var(--warn);
  color: #fff;
  font-size: 0.65rem;
  font-family: var(--mono);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p {
  font-size: 0.95rem;
  color: var(--text2);
  max-width: 560px;
  margin: 0 auto 32px;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent2); text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg2); color: var(--text); text-decoration: none; }

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat-item {
  padding: 16px 28px;
  text-align: center;
  border-right: 1px solid var(--border);
  flex: 1;
  min-width: 120px;
}
.stat-item:last-child { border-right: none; }
.stat-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  display: block;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text3);
  letter-spacing: 0.05em;
}

/* ===== Container ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== Section ===== */
.section { padding: 48px 0; }
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}
.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-header small {
  font-size: 0.75rem;
  color: var(--text3);
  font-family: var(--mono);
}

/* ===== Map Section ===== */
.map-wrapper {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#japan-map {
  width: 100%;
  height: 500px;
  display: block;
}
.map-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.map-legend h4 { font-size: 0.7rem; color: var(--text3); margin-bottom: 8px; letter-spacing: 0.05em; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text2);
  margin-bottom: 4px;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Data Grid ===== */
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.data-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.data-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-color, var(--safe));
  border-radius: var(--radius) 0 0 var(--radius);
}
.card-region {
  font-size: 0.65rem;
  color: var(--text3);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.card-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.card-value {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--card-color, var(--accent));
}
.card-unit { font-size: 0.7rem; color: var(--text3); }
.card-updated {
  font-size: 0.65rem;
  color: var(--text3);
  margin-top: 6px;
  font-family: var(--mono);
}
.card-status {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--safe);
}
.card-status.warn { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ===== Table ===== */
.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table thead tr {
  background: var(--bg2);
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg2); }
.value-cell {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
}
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.status-normal { background: #dcfce7; color: #166534; }
.status-watch { background: #fef9c3; color: #854d0e; }
.status-alert { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .status-normal { background: #14532d; color: #86efac; }
[data-theme="dark"] .status-watch { background: #713f12; color: #fde047; }
[data-theme="dark"] .status-alert { background: #7f1d1d; color: #fca5a5; }

/* ===== Info Box ===== */
.info-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.7;
}
.info-box h3 { font-size: 0.85rem; color: var(--text); margin-bottom: 8px; }

/* ===== Related Sites ===== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.8rem;
  color: var(--text2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  box-shadow: var(--shadow);
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 0.82rem;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Footer ===== */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 24px 24px;
  margin-top: 64px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand .logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.footer-brand p {
  font-size: 0.75rem;
  color: var(--text3);
  line-height: 1.7;
}
.footer-nav h4, .footer-links-col h4 {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 10px;
}
.footer-nav ul, .footer-links-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-nav a, .footer-links-col a {
  font-size: 0.78rem;
  color: var(--text2);
}
.footer-nav a:hover, .footer-links-col a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text3);
}

/* ===== Update bar ===== */
.update-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  font-size: 0.72rem;
  color: var(--text3);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.update-bar span { color: var(--accent); }

/* ===== Hamburger ===== */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
  padding: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .footer-inner { grid-template-columns: 1fr; }
  #japan-map { height: 300px; }
  .stat-item { padding: 12px 16px; }
}

/* ===== Page: About ===== */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 40px 24px;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.page-header p { font-size: 0.85rem; color: var(--text2); }
.prose {
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--text2);
}
.prose h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.prose p { margin-bottom: 12px; }
.prose a { color: var(--accent); }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-btn:hover { color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }
