:root {
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #111827 50%, #0f172a 100%);
  --panel-bg: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(255, 255, 255, 0.08);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --accent: #00f2fe;
  
  --score-blue: #00f2fe;
  --score-blue-bg: rgba(0, 242, 254, 0.15);
  --score-yellow: #f59e0b;
  --score-yellow-bg: rgba(245, 158, 11, 0.15);
  --score-orange: #f97316;
  --score-orange-bg: rgba(249, 115, 22, 0.15);
  --score-gray: #64748b;
  --score-gray-bg: rgba(100, 116, 139, 0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b0f19;
  box-shadow: 0 0 20px var(--primary-glow);
}

.logo-icon svg {
  width: 26px;
  height: 26px;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(to right, #ffffff, #a5f3fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-input, .text-input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.select-input:focus, .text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, #00f2fe 0%, #00c6ff 100%);
  color: #0f172a;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Location Card */
.current-location-card {
  padding: 24px;
  margin-bottom: 32px;
}

.location-header-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.location-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 4px;
}

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

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-pulse {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-ref {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Presets */
.preset-locations {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
}

.preset-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border-color: rgba(56, 189, 248, 0.4);
}

/* Section Title */
.section-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.info-tag {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Calendar Grid */
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Day Forecast Card */
.day-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.day-card:hover {
  transform: translateY(-4px);
  background: var(--panel-hover);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.day-card-header {
  margin-bottom: 12px;
}

.day-date {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.day-dow {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Score Circle / Meter */
.score-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 12px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
}

.score-circle.blue {
  background: var(--score-blue-bg);
  border: 2px solid var(--score-blue);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.score-circle.yellow {
  background: var(--score-yellow-bg);
  border: 2px solid var(--score-yellow);
}

.score-circle.orange {
  background: var(--score-orange-bg);
  border: 2px solid var(--score-orange);
}

.score-circle.gray {
  background: var(--score-gray-bg);
  border: 2px solid var(--score-gray);
}

.score-num {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Day Summary Indicators */
.day-metrics {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-val {
  font-weight: 600;
  color: var(--text-main);
}

/* Loading */
.loading-container {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.app-footer {
  margin-top: 60px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-top: 1px solid var(--panel-border);
  padding-top: 24px;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

.disclaimer {
  margin-top: 6px;
  font-size: 0.75rem;
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card.modal-lg {
  max-width: 780px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.search-item {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.search-item:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
}

.divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--panel-border);
  z-index: 0;
}

.divider span {
  background: #0f172a;
  padding: 0 12px;
  position: relative;
  z-index: 1;
}

.manual-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-width {
  width: 100%;
}

/* Detail Modal Evaluation */
.evaluation-card {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.eval-icon {
  font-size: 1.8rem;
}

.eval-text {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.5;
}

.sub-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 14px;
}

/* Hourly Timeline Grid */
.hourly-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.hourly-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
}

.hourly-time {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

/* ─── 予報テーブル（1〜3日目：行レイアウト） ─── */
.forecast-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.ft-row {
  display: grid;
  grid-template-columns: 220px repeat(5, 1fr);
  gap: 8px;
  align-items: stretch;
}

.ft-header {
  padding: 0 0 4px;
}

.ft-hour-header {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
  padding: 6px 0;
}

.ft-cell {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  transition: all 0.2s ease;
}

.ft-summary-cell {
  border-left: 4px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row-blue  .ft-summary-cell { border-left-color: var(--score-blue); }
.score-row-yellow .ft-summary-cell { border-left-color: var(--score-yellow); }
.score-row-orange .ft-summary-cell { border-left-color: var(--score-orange); }
.score-row-gray  .ft-summary-cell { border-left-color: var(--score-gray); }

.ft-date {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
}

.ft-dow {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.ft-summary-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ft-eval {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.ft-hour-cell {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ft-hour-cell:hover {
  background: var(--panel-hover);
  border-color: rgba(56, 189, 248, 0.3);
}

.ft-hour-score {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.ft-hour-cell .day-metrics {
  width: 100%;
}

.no-data {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ─── 最初の3日間：展開表示ブロック ─── */
.expand-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 10px;
}

.expand-day-block {
  padding: 20px 24px;
  border-left: 4px solid transparent;
  transition: all 0.25s ease;
}

.expand-day-block.score-border-blue  { border-left-color: var(--score-blue); }
.expand-day-block.score-border-yellow { border-left-color: var(--score-yellow); }
.expand-day-block.score-border-orange { border-left-color: var(--score-orange); }
.expand-day-block.score-border-gray  { border-left-color: var(--score-gray); }

.expand-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.expand-date-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expand-date {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
}

.expand-dow {
  font-size: 1rem;
  color: var(--text-muted);
  margin-left: 6px;
}

.expand-score-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.score-circle.score-sm {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.score-circle.score-sm .score-num {
  font-size: 1.4rem;
}

.expand-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.em-item {
  font-size: 0.88rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.em-item b {
  color: var(--text-main);
  margin-left: 2px;
}

.expand-eval {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid rgba(56, 189, 248, 0.4);
}

.expand-hourly-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.expand-hourly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

/* ─── 4〜7日先コンパクトグリッド ─── */
.compact-section-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-section-label::before,
.compact-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--panel-border);
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ─── 時間帯スコア表示 ─── */
.hourly-score {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.text-danger {
  color: #ef4444 !important;
  font-weight: 700;
}

.text-warn {
  color: #f59e0b !important;
  font-weight: 700;
}

/* ─── ライブカメラコンテナ ─── */
.live-camera-container {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
}

.live-camera-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.live-badge {
  background: #ef4444;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.camera-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.video-responsive {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  border-radius: var(--radius-sm);
  background: #000;
}

.video-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
