/* 起源望远镜 · 本地复刻版 — 大流行预测 */

/* 主题变量由 styles/app.css 提供；这里只做别名与兜底，不重复定义整套主题色。 */
:root {
  --fc-surface: var(--surface, #ffffff);
  --fc-surface-2: var(--surface-2, #f5f8f9);
  --fc-text: var(--text, #12303a);
  --fc-muted: var(--muted, #5f7885);
  --fc-border: var(--border, #d7e2e7);
  --fc-accent: var(--accent, #14424e);
  --fc-accent-soft: var(--accent-soft, #e2eff1);
  --fc-radius: var(--radius, 10px);
  --fc-radius-sm: var(--radius-sm, 6px);
  --fc-shadow: var(--shadow, 0 1px 2px rgba(18, 48, 58, 0.06), 0 6px 16px rgba(18, 48, 58, 0.14));
}

/* ---------- 标题 ---------- */

.forecast-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.forecast-heading h1 { font-size: 18px; }

.forecast-heading button {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface);
  color: var(--fc-text);
  font-size: 13px;
  white-space: nowrap;
}

.forecast-heading button:hover {
  border-color: var(--fc-accent);
  color: var(--fc-accent);
}

/* ---------- 时间控制 ---------- */

.forecast-controls {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  background: var(--fc-surface);
}

.forecast-window {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.forecast-live {
  padding: 2px 9px;
  border: 1px solid var(--fc-border);
  border-radius: 999px;
  background: var(--fc-surface-2);
  color: var(--fc-muted);
  font-size: 12px;
  white-space: nowrap;
}

.forecast-live.is-live {
  border-color: transparent;
  background: var(--fc-accent-soft);
  color: var(--fc-accent);
}

.forecast-range {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.forecast-timezone {
  margin-left: auto;
  color: var(--fc-muted);
  font-size: 11px;
  white-space: nowrap;
}

.forecast-time-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.forecast-time-actions { display: flex; gap: 8px; }

.forecast-time-actions button {
  padding: 5px 12px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface-2);
  color: var(--fc-text);
  font-size: 12px;
  white-space: nowrap;
}

.forecast-time-actions button:hover:not(:disabled) {
  border-color: var(--fc-accent);
  color: var(--fc-accent);
}

.forecast-time-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.forecast-time-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fc-muted);
  font-size: 12px;
  white-space: nowrap;
}

.forecast-time-toolbar input[type="date"],
.forecast-time-toolbar select {
  padding: 4px 8px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface);
  color: var(--fc-text);
  font: inherit;
  font-size: 12px;
}

.forecast-time-hint {
  margin: 8px 0 0;
  color: var(--fc-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- 区域筛选 ---------- */

.forecast-region-picker {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  background: var(--fc-surface);
}

.forecast-region-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.forecast-region-actions strong {
  color: var(--fc-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.forecast-region-actions button {
  padding: 4px 10px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface-2);
  color: var(--fc-text);
  font-size: 12px;
  white-space: nowrap;
}

.forecast-region-actions button:hover {
  border-color: var(--fc-accent);
  color: var(--fc-accent);
}

.forecast-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
  justify-content: flex-end;
}

.forecast-region {
  padding: 4px 10px;
  border: 1px solid var(--fc-border);
  border-radius: 999px;
  background: var(--fc-surface);
  color: var(--fc-muted);
  font-size: 12px;
  white-space: nowrap;
}

.forecast-region:hover { border-color: var(--fc-accent); }

.forecast-region.is-active {
  border-color: var(--fc-accent);
  background: var(--fc-accent);
  color: #eaf5f6;
}

#forecast-status {
  margin: 8px 0 0;
  color: var(--fc-muted);
  font-size: 12px;
}

/* ---------- 时间表 ---------- */

.forecast-grid {
  margin-top: 8px;
  max-height: 74vh;
  overflow: auto;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  background: var(--fc-surface);
}

.forecast-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.forecast-table th,
.forecast-table td {
  border-right: 1px solid var(--fc-border);
  border-bottom: 1px solid var(--fc-border);
}

.forecast-table tr:last-child th,
.forecast-table tr:last-child td { border-bottom: 0; }

/* 表头固定在顶部，区域名固定在左侧。 */
.forecast-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--fc-surface-2);
}

.forecast-table .forecast-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  min-width: 128px;
  width: 128px;
  padding: 5px 8px;
  color: var(--fc-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.forecast-table .forecast-area-head {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 128px;
  width: 128px;
  padding: 4px 8px;
  background: var(--fc-surface-2);
  text-align: left;
}

.forecast-area-name {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fc-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}

.forecast-area-name:hover {
  color: var(--fc-accent);
  text-decoration: underline;
}

.forecast-area-head small {
  display: block;
  margin-top: 1px;
  color: var(--fc-muted);
  font-size: 10px;
  font-weight: 400;
}

.forecast-time {
  min-width: 58px;
  padding: 4px 6px;
  color: var(--fc-text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.forecast-time-date {
  display: block;
  min-height: 13px;
  color: var(--fc-muted);
  font-size: 10px;
  font-weight: 400;
}

.forecast-time.is-current-hour {
  background: var(--fc-accent-soft);
  color: var(--fc-accent);
}

.forecast-time.is-current-hour .forecast-time-date { color: var(--fc-accent); }

.forecast-cell {
  min-width: 58px;
  height: 40px;
  padding: 2px;
  background: var(--fc-surface-2);
  vertical-align: top;
}

.forecast-cell.has-event { background: var(--fc-surface); }

.forecast-event {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-left: 3px solid var(--fc-accent);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-accent-soft);
  color: var(--fc-accent);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
}

.forecast-event + .forecast-event { margin-top: 2px; }

.forecast-event strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.forecast-event-bonus {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  white-space: nowrap;
}

.forecast-event-carry {
  color: var(--fc-muted);
  font-size: 10px;
}

.forecast-event:hover { border-color: var(--fc-accent); }

.forecast-empty {
  margin: 0;
  padding: 22px;
  color: var(--fc-muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- 详情侧栏 ---------- */

.forecast-detail {
  position: fixed;
  top: 96px;
  right: 16px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 74vh;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  background: var(--fc-surface);
  box-shadow: var(--fc-shadow);
}

.forecast-detail > header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--fc-border);
  border-radius: var(--fc-radius) var(--fc-radius) 0 0;
  background: var(--fc-surface-2);
}

.forecast-detail > header strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#forecast-detail-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border: 1px solid var(--fc-border);
  border-radius: 50%;
  background: var(--fc-surface);
  color: var(--fc-muted);
  font-size: 14px;
  line-height: 1;
}

#forecast-detail-close:hover {
  border-color: var(--fc-accent);
  color: var(--fc-accent);
}

.forecast-detail-body {
  padding: 10px 12px 14px;
  overflow: auto;
  font-size: 12px;
}

.forecast-detail-body h3 {
  margin: 12px 0 4px;
  font-size: 12px;
}

.forecast-detail-body h4 {
  font-size: 12px;
  font-weight: 600;
}

.forecast-detail-body h4 small {
  margin-left: 4px;
  color: var(--fc-muted);
  font-size: 10px;
  font-weight: 400;
}

.forecast-detail-note {
  margin: 6px 0 0;
  color: var(--fc-muted);
  font-size: 11px;
  line-height: 1.5;
}

.forecast-detail-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--fc-border);
}

.forecast-push-button {
  padding: 5px 12px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface);
  color: var(--fc-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.forecast-push-button:hover:not(:disabled) {
  border-color: var(--fc-accent);
  background: var(--fc-accent);
  color: #eaf5f6;
}

.forecast-push-button:disabled { opacity: 0.6; cursor: not-allowed; }

.forecast-detail-hint {
  color: var(--fc-muted);
  font-size: 11px;
}

.forecast-category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.forecast-category-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface-2);
}

.forecast-category-list li small {
  margin-left: auto;
  color: var(--fc-muted);
  font-size: 10px;
  white-space: nowrap;
}

.forecast-bonus {
  color: var(--fc-accent);
  font-weight: 600;
}

.forecast-culture {
  padding: 5px 0;
  border-bottom: 1px dashed var(--fc-border);
}

.forecast-culture:last-child { border-bottom: 0; }

.forecast-culture strong { font-size: 12px; }

.forecast-culture small {
  margin-left: 4px;
  color: var(--fc-muted);
  font-size: 10px;
}

.forecast-culture p {
  margin: 3px 0 0;
  color: var(--fc-muted);
  font-size: 11px;
  line-height: 1.5;
}

.forecast-port-groups section { margin-top: 8px; }

.forecast-port-groups h3 { margin: 0; }

.forecast-port-groups p {
  margin: 3px 0 0;
  color: var(--fc-muted);
  font-size: 11px;
  line-height: 1.5;
}

.forecast-good {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-surface-2);
}

.forecast-good header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.forecast-good header small {
  margin-left: auto;
  color: var(--fc-muted);
  font-size: 10px;
  white-space: nowrap;
}

.forecast-detail-block { margin-top: 8px; }

@media (max-width: 900px) {
  .forecast-region-picker { flex-direction: column; }
  .forecast-regions { margin-left: 0; justify-content: flex-start; }
  .forecast-detail {
    top: auto;
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 58vh;
  }
}