.tropicalcast-wrap {
  --tc-bg: #ffffff;
  --tc-panel: rgba(255, 255, 255, 0.96);
  --tc-panel-2: rgba(248, 250, 252, 0.98);
  --tc-text: #0f172a;
  --tc-muted: #64748b;
  --tc-border: rgba(15, 23, 42, 0.14);
  --tc-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
  --tc-radius: 16px;
  background: var(--tc-bg);
  color: var(--tc-text);
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
  overflow: hidden;
  box-shadow: var(--tc-shadow);
  font-family: inherit;
  margin: 1.25rem 0;
}

.tropicalcast-wrap * {
  box-sizing: border-box;
}

.tropicalcast-wrap h3 {
  color: inherit;
}

/* Default: match the website instead of forcing a heavy weather-dashboard frame. */
.tropicalcast-wrap.tc-theme-inherit {
  --tc-bg: transparent;
  --tc-panel: color-mix(in srgb, Canvas 92%, transparent);
  --tc-panel-2: color-mix(in srgb, Canvas 96%, transparent);
  --tc-text: inherit;
  --tc-muted: #64748b;
  --tc-border: rgba(100, 116, 139, 0.26);
  --tc-shadow: none;
}

.tropicalcast-wrap.tc-theme-light {
  --tc-bg: #ffffff;
  --tc-panel: rgba(255, 255, 255, 0.98);
  --tc-panel-2: #f8fafc;
  --tc-text: #0f172a;
  --tc-muted: #64748b;
  --tc-border: rgba(15, 23, 42, 0.14);
  --tc-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
}

.tropicalcast-wrap.tc-theme-dark {
  --tc-bg: linear-gradient(135deg, #07111f, #10243e);
  --tc-panel: rgba(11, 24, 42, 0.96);
  --tc-panel-2: rgba(15, 23, 42, 0.72);
  --tc-text: #f8fafc;
  --tc-muted: #aebbd0;
  --tc-border: rgba(148, 163, 184, 0.24);
  --tc-shadow: 0 18px 55px rgba(2, 8, 23, 0.28);
}

.tropicalcast-wrap.tc-theme-ocean {
  --tc-bg: linear-gradient(135deg, #ecfeff, #eff6ff 55%, #f0fdfa);
  --tc-panel: rgba(255, 255, 255, 0.82);
  --tc-panel-2: rgba(240, 249, 255, 0.9);
  --tc-text: #082f49;
  --tc-muted: #38637a;
  --tc-border: rgba(14, 165, 233, 0.23);
  --tc-shadow: 0 18px 45px rgba(14, 116, 144, 0.12);
}

.tropicalcast-wrap.tc-theme-minimal {
  --tc-bg: transparent;
  --tc-panel: rgba(255, 255, 255, 0.95);
  --tc-panel-2: #ffffff;
  --tc-text: inherit;
  --tc-muted: #64748b;
  --tc-border: rgba(100, 116, 139, 0.2);
  --tc-shadow: none;
  border: 0;
  border-radius: 0;
}

.tc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--tc-border);
  background: color-mix(in srgb, var(--tc-panel-2) 75%, transparent);
}

.tc-header h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.1;
  font-weight: 800;
}

.tc-kicker {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--tc-accent);
  font-weight: 800;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.tc-status {
  color: var(--tc-muted);
  font-size: 0.88rem;
  text-align: right;
  max-width: 460px;
}

.tc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--tc-panel-2) 86%, transparent);
  border-bottom: 1px solid var(--tc-border);
}

.tc-control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tc-mode-group {
  margin-left: auto;
}

.tc-single-basin .tc-mode-group {
  margin-left: 0;
}

.tc-button {
  appearance: none;
  border: 1px solid var(--tc-border);
  border-radius: 999px;
  background: var(--tc-panel);
  color: var(--tc-text);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.tc-button:hover,
.tc-button:focus {
  transform: translateY(-1px);
  border-color: var(--tc-accent);
  outline: none;
}

.tc-button.is-active {
  background: var(--tc-accent);
  border-color: var(--tc-accent);
  color: #ffffff;
}

.tc-refresh {
  color: #ffffff;
  background: #15803d;
  border-color: rgba(22, 163, 74, 0.65);
}

.tc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 0;
  min-height: 420px;
}

.tc-no-side-panel .tc-layout {
  grid-template-columns: 1fr;
}

.tc-map {
  width: 100%;
  min-height: 360px;
  background: #e2e8f0;
  z-index: 1;
}

.tc-map .leaflet-control-attribution {
  font-size: 10px;
}

.tc-side-panel {
  background: var(--tc-panel);
  border-left: 1px solid var(--tc-border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tc-card {
  background: var(--tc-panel-2);
  border: 1px solid var(--tc-border);
  border-radius: calc(var(--tc-radius) * 0.75);
  padding: 12px;
}

.tc-card-title {
  color: var(--tc-accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.tc-summary,
.tc-source,
.tc-legend {
  color: var(--tc-text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tc-muted {
  color: var(--tc-muted);
  font-size: 0.84rem;
}

.tc-legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
}

.tc-swatch,
.tc-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #111827;
  flex: 0 0 auto;
}

.tc-swatch.low { background: #fde68a; }
.tc-swatch.medium { background: #f97316; }
.tc-swatch.high { background: #ef4444; }
.tc-swatch.cone {
  background: rgba(255, 255, 255, 0.55);
  border-color: #475569;
  border-radius: 4px;
}
.tc-dot.point {
  background: #fff;
  border-color: #111827;
}

.tc-line {
  width: 26px;
  height: 0;
  border-top: 4px solid #fbbf24;
  flex: 0 0 auto;
}

.tc-line.dashed { border-top-style: dashed; }
.tc-line.track { border-color: #111827; }
.tc-line.warning { border-color: #ef4444; }

.tc-source details {
  margin-top: 8px;
}

.tc-source summary {
  cursor: pointer;
  color: var(--tc-accent);
  font-weight: 700;
}

.tc-source ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--tc-muted);
  font-size: 0.82rem;
}

.tc-footer-note {
  color: var(--tc-muted);
  font-size: 0.78rem;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--tc-border);
  background: color-mix(in srgb, var(--tc-panel-2) 72%, transparent);
}

.tc-popup {
  min-width: 230px;
  color: #0f172a;
  font-size: 13px;
}

.tc-popup strong {
  display: block;
  margin-bottom: 8px;
}

.tc-popup table {
  width: 100%;
  border-collapse: collapse;
}

.tc-popup th,
.tc-popup td {
  border-top: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  padding: 4px 3px;
}

.tc-popup th {
  color: #334155;
  width: 42%;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@supports not (color: color-mix(in srgb, white, black)) {
  .tc-header,
  .tc-toolbar,
  .tc-footer-note {
    background: var(--tc-panel-2);
  }
}

@media (max-width: 900px) {
  .tc-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .tc-status {
    text-align: left;
  }

  .tc-layout {
    grid-template-columns: 1fr;
  }

  .tc-side-panel {
    border-left: 0;
    border-top: 1px solid var(--tc-border);
  }

  .tc-mode-group {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .tc-toolbar,
  .tc-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .tc-button {
    width: 100%;
    justify-content: center;
  }

  .tc-control-group {
    width: 100%;
  }

  .tc-refresh {
    width: 100%;
  }
}
