.sosc-shell {
  --sosc-blue: #2478a8;
  --sosc-blue-dark: #155577;
  --sosc-blue-deep: #0d3f5b;
  --sosc-blue-soft: #edf8ff;
  --sosc-import: #176b9c;
  --sosc-export: #d5682d;
  --sosc-future: #6f58a8;
  --sosc-ink: #102f43;
  --sosc-muted: #5e7483;
  --sosc-border: #cfe7f4;
  position: relative;
  overflow: hidden;
  margin-top: clamp(2rem, 5vw, 4rem);
  border: 1px solid var(--sosc-border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 89, 125, 0.16);
  color: var(--sosc-ink);
}

.sosc-shell *,
.sosc-shell *::before,
.sosc-shell *::after {
  box-sizing: border-box;
}

.sosc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.4rem, 4vw, 2.4rem);
  background: linear-gradient(130deg, var(--sosc-blue-deep), var(--sosc-blue), #49a8d8);
  color: #fff;
}

.sosc-kicker {
  margin: 0 0 0.35rem;
  color: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
  opacity: 0.8;
}

.sosc-head h3 {
  max-width: 780px;
  margin: 0;
  color: #fff;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.08;
}

.sosc-intro {
  max-width: 760px;
  margin: 0.7rem 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.98rem;
  line-height: 1.55;
}

.sosc-update {
  flex: 0 0 190px;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: right;
  backdrop-filter: blur(8px);
}

.sosc-update strong {
  display: block;
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sosc-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.34fr);
  gap: 1rem;
  padding: clamp(1.1rem, 3vw, 1.8rem);
  border-bottom: 1px solid var(--sosc-border);
  background: #fff;
}

.sosc-layer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sosc-layer legend,
.sosc-date span {
  width: 100%;
  margin-bottom: 0.12rem;
  color: var(--sosc-blue-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sosc-layer button,
.sosc-play,
.sosc-icon-button,
.sosc-message button {
  min-height: 44px;
  margin: 0;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--sosc-border);
  border-radius: 10px;
  background: #fff;
  color: var(--sosc-blue-dark);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
}

.sosc-layer button:hover,
.sosc-layer button:focus-visible,
.sosc-layer button.is-active,
.sosc-play:hover,
.sosc-play:focus-visible,
.sosc-icon-button:hover,
.sosc-icon-button:focus-visible,
.sosc-message button:hover,
.sosc-message button:focus-visible {
  border-color: var(--sosc-blue);
  background: var(--sosc-blue-soft);
  box-shadow: 0 0 0 3px rgba(36, 120, 168, 0.13);
  outline: none;
}

.sosc-layer button.is-active {
  background: var(--sosc-blue);
  color: #fff;
}

.sosc-date {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.sosc-date input {
  min-height: 44px;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--sosc-border);
  border-radius: 10px;
  background: #fff;
  color: var(--sosc-ink);
  font: inherit;
}

.sosc-date input:focus-visible,
.sosc-time-controls input:focus-visible {
  border-color: var(--sosc-blue);
  box-shadow: 0 0 0 3px rgba(36, 120, 168, 0.13);
  outline: none;
}

.sosc-notice {
  margin: 1rem clamp(1.1rem, 3vw, 1.8rem) 0;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  border: 1px solid #e4b077;
  border-radius: 12px;
  background: #fff8ed;
  color: #714018;
  font-size: 0.88rem;
  line-height: 1.45;
}

.sosc-notice::before {
  content: '!';
  float: left;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: -0.05rem 0 0 -2rem;
  border-radius: 50%;
  background: #d5682d;
  color: #fff;
  font-weight: 800;
}

.sosc-notice[hidden],
.sosc-message[hidden],
.sosc-future-key[hidden],
.sosc-future-explain[hidden] {
  display: none;
}

.sosc-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  min-height: 88px;
  padding: 1rem;
  color: var(--sosc-muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.sosc-map-panel,
.sosc-chart-panel {
  padding: clamp(1.2rem, 3vw, 1.9rem);
}

.sosc-chart-panel {
  border-top: 1px solid var(--sosc-border);
  background: #fbfdfe;
}

.sosc-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sosc-panel-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sosc-panel-heading h4 {
  margin: 0;
  color: var(--sosc-blue-deep);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.sosc-section-no {
  display: grid;
  flex: 0 0 2rem;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--sosc-blue-soft);
  color: var(--sosc-blue-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.sosc-net {
  display: grid;
  min-width: 150px;
  padding: 0.55rem 0.8rem;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: #fff;
  text-align: right;
}

.sosc-net span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sosc-net strong {
  color: inherit;
  font-size: 1.15rem;
}

.sosc-net.is-import { color: var(--sosc-import); }
.sosc-net.is-export { color: var(--sosc-export); }
.sosc-net.is-neutral { color: #64747d; }

.sosc-map-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--sosc-border);
  border-radius: 16px;
  background: #eaf4f9;
}

#sosc-map {
  z-index: 1;
  width: 100%;
  height: 530px;
  background: radial-gradient(circle at 52% 48%, #f8fbfc, #e7f0f4);
}

.sosc-map-legend {
  position: absolute;
  z-index: 500;
  right: 0.8rem;
  bottom: 0.8rem;
  display: grid;
  gap: 0.4rem;
  max-width: 250px;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(207, 231, 244, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 24px rgba(15, 71, 99, 0.16);
  backdrop-filter: blur(7px);
}

.sosc-map-legend span,
.sosc-future-key {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--sosc-muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.sosc-key {
  display: inline-block;
  flex: 0 0 22px;
  height: 5px;
  border-radius: 99px;
  background: var(--sosc-import);
}

.sosc-key::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  margin: -4px 0 0 17px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--sosc-import);
}

.sosc-key-export { background: var(--sosc-export); }
.sosc-key-export::after { border-left-color: var(--sosc-export); }
.sosc-key-neutral { height: 2px; background: #7b8794; }
.sosc-key-neutral::after { display: none; }

.sosc-arrow-icon {
  background: transparent;
  border: 0;
}

.sosc-arrowhead {
  display: block;
  position: relative;
  width: 20px;
  height: 20px;
  background: var(--sosc-flow-outline);
  clip-path: polygon(50% 0%, 100% 100%, 50% 80%, 0% 100%);
  filter: drop-shadow(0 1px 2px rgba(16, 47, 67, 0.32));
  transform-origin: 50% 50%;
}

.sosc-arrowhead::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--sosc-flow);
  clip-path: inherit;
}

.sosc-flow-tooltip,
.sosc-country-tooltip {
  border: 1px solid var(--sosc-border) !important;
  border-radius: 9px !important;
  box-shadow: 0 8px 24px rgba(16, 47, 67, 0.18) !important;
  color: var(--sosc-ink) !important;
  font-size: 0.78rem !important;
  line-height: 1.45 !important;
}

.sosc-time-controls {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.7rem;
  padding: 1rem 0 0;
}

.sosc-time-controls label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--sosc-blue-dark);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sosc-time-controls input {
  width: 100%;
  min-width: 120px;
  accent-color: var(--sosc-blue);
}

.sosc-time-controls output {
  min-width: 160px;
  color: var(--sosc-ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
  text-transform: none;
}

.sosc-values {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sosc-border);
}

.sosc-values h5 {
  margin: 0 0 0.7rem;
  color: var(--sosc-blue-deep);
  font-size: 0.95rem;
}

.sosc-table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.sosc-shell table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.78rem;
}

.sosc-shell th,
.sosc-shell td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #e6eff3;
  color: var(--sosc-ink);
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.sosc-shell th:first-child,
.sosc-shell td:first-child {
  text-align: left;
}

.sosc-shell thead th {
  background: #f4f9fb;
  color: var(--sosc-blue-dark);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sosc-values button {
  margin: 0;
  padding: 0.18rem 0.25rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--sosc-blue-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sosc-values button:hover,
.sosc-values button:focus-visible {
  background: var(--sosc-blue-soft);
  outline: 2px solid rgba(36, 120, 168, 0.35);
}

.sosc-chart-wrap {
  position: relative;
  height: 430px;
  border: 1px solid var(--sosc-border);
  border-radius: 15px;
  background: #fff;
  padding: 0.8rem;
}

.sosc-chart-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 0.36rem;
  width: max-content;
  max-width: min(330px, calc(100% - 1rem));
  padding: 0.68rem 0.76rem;
  border: 1px solid rgba(16, 47, 67, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 24px rgba(16, 47, 67, 0.18);
  color: var(--sosc-ink);
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: none;
}

.sosc-chart-tooltip[hidden] {
  display: none;
}

.sosc-chart-tooltip-title {
  display: block;
  padding-bottom: 0.18rem;
  border-bottom: 1px solid var(--sosc-border);
  font-size: 0.78rem;
}

.sosc-chart-tooltip-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: start;
  gap: 0.42rem;
}

.sosc-chart-tooltip-row i {
  width: 8px;
  height: 8px;
  margin-top: 0.17rem;
  border-radius: 50%;
}

.sosc-future-key i {
  display: inline-block;
  width: 24px;
  height: 12px;
  border-left: 2px dashed var(--sosc-future);
  background: rgba(111, 88, 168, 0.12);
}

.sosc-future-explain {
  margin: 0.75rem 0 0;
  color: var(--sosc-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.sosc-data-details,
.sosc-interpret {
  margin-top: 1rem;
  border: 1px solid var(--sosc-border);
  border-radius: 13px;
  background: #fff;
}

.sosc-data-details summary,
.sosc-interpret summary {
  padding: 0.9rem 1rem;
  color: var(--sosc-blue-dark);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.sosc-data-details .sosc-table-scroll {
  max-height: 360px;
  border-top: 1px solid var(--sosc-border);
}

.sosc-data-details thead {
  position: sticky;
  z-index: 1;
  top: 0;
}

.sosc-interpret {
  margin: 0 clamp(1.2rem, 3vw, 1.9rem) clamp(1.2rem, 3vw, 1.9rem);
  background: #f7fbfd;
}

.sosc-interpret[open] summary {
  border-bottom: 1px solid var(--sosc-border);
}

.sosc-interpret ol {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 1rem 1.2rem 0.3rem 2.6rem;
}

.sosc-interpret li,
.sosc-method {
  color: #405b6c;
  font-size: 0.82rem;
  line-height: 1.58;
}

.sosc-interpret li::marker {
  color: var(--sosc-blue);
  font-weight: 800;
}

.sosc-method {
  margin: 0.6rem 1rem 1rem;
  padding: 0.8rem 0.9rem;
  border-left: 3px solid var(--sosc-blue);
  background: #fff;
}

.sosc-source {
  padding: 1rem clamp(1.2rem, 3vw, 1.9rem) 1.25rem;
  border-top: 1px solid var(--sosc-border);
  background: #f4f9fb;
}

.sosc-source p {
  margin: 0.25rem 0;
  color: var(--sosc-muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.sosc-source a {
  color: var(--sosc-blue-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

@media (max-width: 850px) {
  .sosc-head,
  .sosc-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sosc-update,
  .sosc-net {
    flex-basis: auto;
    width: 100%;
    text-align: left;
  }

  .sosc-controls {
    grid-template-columns: 1fr;
  }

  #sosc-map {
    height: 470px;
  }

  .sosc-time-controls {
    grid-template-columns: auto 1fr auto;
  }

  .sosc-play {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sosc-time-controls label {
    grid-template-columns: 1fr;
  }

  .sosc-time-controls output {
    min-width: 0;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .sosc-shell {
    border-radius: 17px;
  }

  .sosc-layer button {
    width: 100%;
  }

  #sosc-map {
    height: 420px;
  }

  .sosc-map-legend {
    position: relative;
    right: auto;
    bottom: auto;
    max-width: none;
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: none;
  }

  .sosc-chart-wrap {
    height: 360px;
    padding: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sosc-shell *,
  .sosc-shell *::before,
  .sosc-shell *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
