* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-dark:   #185FA5;
  --blue-mid:    #378ADD;
  --blue-light:  #E6F1FB;
  --blue-pale:   #F0F7FF;
  --green:       #27AE60;
  --red:         #E74C3C;
  --gold:        #F39C12;
  --white:       #FFFFFF;
  --text-dark:   #1A2B3C;
  --text-mid:    #4A6080;
  --radius:      16px;
  --shadow:      0 4px 20px rgba(24,95,165,0.15);
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--blue-pale);
  color: var(--text-dark);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  color: white;
  padding: 16px 20px 14px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(24,95,165,0.3);
}
.app-header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.03em; }
.app-header .subtitle { font-size: 0.72rem; opacity: 0.85; margin-top: 2px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  display: flex;
  border-top: 1px solid #D0E4F7;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 8px;
  text-decoration: none;
  color: var(--text-mid);
  font-size: 0.68rem;
  gap: 3px;
  transition: color 0.2s;
}
.nav-item.active { color: var(--blue-dark); }
.nav-item svg { width: 24px; height: 24px; }
.nav-item span { font-size: 0.65rem; }

/* ===== MAIN CONTENT ===== */
.main { padding: 16px; max-width: 480px; margin: 0 auto; }

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-title {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== BUTTONS ===== */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  text-align: center;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
  color: white;
  box-shadow: 0 4px 16px rgba(55,138,221,0.4);
}
.btn-success {
  background: linear-gradient(135deg, #1E8449, var(--green));
  color: white;
  box-shadow: 0 4px 16px rgba(39,174,96,0.4);
}
.btn-outline {
  background: white;
  color: var(--blue-dark);
  border: 2px solid var(--blue-mid);
}
.btn-sm {
  padding: 10px 20px;
  font-size: 0.9rem;
  width: auto;
  display: inline-block;
}

/* ===== PROGRESS BAR ===== */
.progress-wrap { background: #D0E4F7; border-radius: 50px; height: 14px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-mid));
  transition: width 0.5s ease;
}

/* ===== RANK BADGE ===== */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--gold), #E67E22);
  color: white;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(243,156,18,0.4);
}

/* ===== POINTS DISPLAY ===== */
.points-big {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--blue-dark);
  line-height: 1;
}
.points-unit { font-size: 1rem; color: var(--text-mid); margin-left: 4px; }

/* ===== STREAK ===== */
.streak-wrap { display: flex; align-items: center; gap: 8px; }
.streak-icon { font-size: 1.4rem; }
.streak-count { font-size: 1.6rem; font-weight: 900; color: var(--gold); }
.streak-label { font-size: 0.8rem; color: var(--text-mid); }

/* ===== LOGIN PAGE ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--blue-dark) 0%, var(--blue-mid) 50%, var(--blue-light) 100%);
}
.login-logo { font-size: 4rem; margin-bottom: 8px; }
.login-title { color: white; font-size: 1.3rem; font-weight: 900; text-align: center; line-height: 1.4; margin-bottom: 4px; }
.login-sub { color: rgba(255,255,255,0.8); font-size: 0.85rem; text-align: center; margin-bottom: 32px; }
.login-card {
  background: white;
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.form-group { margin-bottom: 16px; }
.form-label { font-size: 0.8rem; font-weight: 700; color: var(--text-mid); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #D0E4F7;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--blue-mid); }
.error-msg { color: var(--red); font-size: 0.85rem; text-align: center; margin-top: 12px; min-height: 20px; }

/* ===== QUIZ PAGE ===== */
.question-num { font-size: 0.8rem; color: var(--text-mid); margin-bottom: 4px; }
.question-text { font-size: 1.05rem; font-weight: 700; line-height: 1.6; color: var(--text-dark); }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.choice-btn {
  padding: 16px 18px;
  border: 2px solid #D0E4F7;
  border-radius: 14px;
  background: white;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.selected  { border-color: var(--blue-mid); background: var(--blue-light); }
.choice-btn.correct   { border-color: var(--green); background: #E8F8F0; color: var(--green); }
.choice-btn.incorrect { border-color: var(--red);   background: #FDEDEC; color: var(--red); }
.choice-label {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #D0E4F7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.result-card {
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
}
.result-correct   { background: #E8F8F0; border: 2px solid var(--green); }
.result-incorrect { background: #FDEDEC; border: 2px solid var(--red); }
.result-title { font-size: 1.1rem; font-weight: 900; margin-bottom: 8px; }
.result-title.green { color: var(--green); }
.result-title.red   { color: var(--red); }
.result-explanation { font-size: 0.88rem; line-height: 1.7; color: var(--text-dark); }

.kokochan-bubble {
  background: var(--blue-light);
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-dark);
  margin-top: 12px;
  position: relative;
}
.kokochan-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-done {
  text-align: center;
  padding: 24px 0;
}
.session-done .big-emoji { font-size: 3rem; }
.session-done h2 { font-size: 1.3rem; font-weight: 900; margin: 12px 0 8px; color: var(--blue-dark); }
.session-done p { font-size: 0.9rem; color: var(--text-mid); margin-bottom: 16px; }

/* ===== MAP PAGE ===== */
.map-wrap { background: white; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.map-svg-container { width: 100%; overflow: hidden; display: flex; justify-content: center; }
.station-list { margin-top: 16px; }
.station-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #EEF5FB;
}
.station-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}
.dot-done    { background: var(--blue-dark); color: white; }
.dot-current { background: var(--gold); color: white; box-shadow: 0 0 0 3px rgba(243,156,18,0.3); }
.dot-future  { background: white; border: 2px solid #D0E4F7; color: var(--text-mid); }
.station-name { font-size: 0.9rem; font-weight: 600; flex: 1; }
.station-route { font-size: 0.7rem; color: var(--text-mid); }
.station-check { color: var(--blue-dark); font-size: 1rem; }

/* ===== ADMIN PAGE ===== */
.admin-header {
  background: linear-gradient(135deg, #1A2B3C, #2C3E50);
  color: white;
  padding: 16px 20px;
  text-align: center;
}
.admin-user-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat-item { background: var(--blue-pale); border-radius: 10px; padding: 10px 12px; }
.stat-num  { font-size: 1.5rem; font-weight: 900; color: var(--blue-dark); }
.stat-label { font-size: 0.7rem; color: var(--text-mid); }

.reminder-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
}
.reminder-urgent    { background: #FFF3E0; border-left: 4px solid var(--gold); }
.reminder-soon      { background: #EBF5FB; border-left: 4px solid var(--blue-mid); }
.reminder-upcoming  { background: white; border: 1px solid #D0E4F7; }
.reminder-past      { background: #F8F9FA; opacity: 0.6; }
.reminder-icon { font-size: 1.5rem; flex-shrink: 0; }
.reminder-text { font-size: 0.85rem; line-height: 1.5; }
.reminder-date { font-size: 0.72rem; color: var(--text-mid); margin-top: 2px; }

/* ===== ALERT / TOAST ===== */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--blue-dark);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.warning { background: var(--gold); color: var(--text-dark); }

/* ===== STATION ARRIVAL POPUP ===== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.popup-overlay.show { opacity: 1; pointer-events: all; }
.popup-box {
  background: white;
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  transform: scale(0.8);
  transition: transform 0.3s;
}
.popup-overlay.show .popup-box { transform: scale(1); }
.popup-emoji { font-size: 3.5rem; }
.popup-title { font-size: 1.3rem; font-weight: 900; color: var(--blue-dark); margin: 8px 0; }
.popup-text { font-size: 0.88rem; color: var(--text-mid); line-height: 1.6; margin-bottom: 20px; }

/* ===== MISC ===== */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.hidden { display: none; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}
.pulse { animation: pulse 2s ease-in-out infinite; }

@keyframes sparkle {
  0%   { opacity: 0; transform: scale(0) rotate(0deg); }
  50%  { opacity: 1; transform: scale(1) rotate(180deg); }
  100% { opacity: 0; transform: scale(0) rotate(360deg); }
}
