:root {
  color: #213042;
  background:
    linear-gradient(120deg, rgba(255, 131, 103, 0.18), transparent 32%),
    linear-gradient(260deg, rgba(0, 187, 249, 0.16), transparent 36%),
    #fff8ed;
  font-family: 'Avenir Next', 'Helvetica Neue', 'PingFang SC', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.app-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.2) 48%, rgba(255, 255, 255, 0.78)),
    radial-gradient(circle at 68% 48%, rgba(255, 255, 255, 0.7), transparent 30%),
    repeating-linear-gradient(135deg, rgba(255, 138, 61, 0.08) 0 1px, transparent 1px 26px);
}

.globe-canvas,
.marker-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.globe-canvas {
  cursor: grab;
}

.globe-canvas.is-dragging {
  cursor: grabbing;
}

.marker-layer {
  pointer-events: none;
}

.map-marker {
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--story-color);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--story-color) 22%, transparent), 0 8px 18px rgba(30, 48, 66, 0.18);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.map-marker:hover,
.map-marker:focus-visible,
.map-marker.is-active {
  outline: none;
  transform: translate(-50%, -50%) scale(1.25);
}

.panel {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 20px 60px rgba(77, 89, 116, 0.16);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.left-column {
  position: absolute;
  top: 3.4vh;
  bottom: 3.4vh;
  left: 3.6vw;
  width: min(32rem, 34vw);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.hero-panel {
  flex-shrink: 0;
  padding: 1rem 1.05rem 0.9rem;
}

.eyebrow,
.language-label,
.story-list-label,
.focus-label,
.focus-continent,
.focus-year,
.story-region,
.map-status {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6f7083;
}

.eyebrow {
  margin: 0;
  color: #f04f78;
}

.hero-title,
.focus-title {
  margin: 0;
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  font-weight: 700;
  letter-spacing: 0;
  color: #233047;
}

.hero-title {
  margin-top: 0.35rem;
  font-size: clamp(1.9rem, 3vw, 3.35rem);
  line-height: 0.98;
  max-width: 12ch;
}

.hero-intro,
.focus-body,
.focus-subtitle,
.story-copy span,
.story-count,
.hint {
  color: #475467;
  line-height: 1.58;
}

.hero-intro {
  max-width: 48ch;
  margin: 0.65rem 0 0.75rem;
  font-size: 0.9rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.summary-card {
  min-height: 3.65rem;
  padding: 0.55rem;
  border: 1px solid rgba(35, 48, 71, 0.08);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 236, 203, 0.78));
}

.summary-card strong {
  display: block;
  font-size: 1.25rem;
  color: #ef476f;
}

.summary-card span {
  color: #5c6677;
  font-size: 0.78rem;
}

.hint {
  margin: 0;
  font-size: 0.82rem;
}

.language-switch {
  display: inline-flex;
  gap: 0.45rem;
}

.lang-button,
.filter-button,
.type-button {
  border: 1px solid rgba(35, 48, 71, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.lang-button {
  min-width: 4.4rem;
  padding: 0.55rem 0.75rem;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.42rem 0.56rem 0.42rem 0.66rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.filter-button strong,
.type-button strong {
  min-width: 1.35rem;
  padding: 0.08rem 0.34rem;
  border-radius: 999px;
  background: rgba(35, 48, 71, 0.08);
  color: #475467;
  font-size: 0.68rem;
  line-height: 1.45;
}

.filter-button.is-active strong,
.type-button.is-active strong {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.lang-button:hover,
.lang-button:focus-visible,
.filter-button:hover,
.filter-button:focus-visible,
.type-button:hover,
.type-button:focus-visible {
  border-color: #00a6d6;
  outline: none;
  transform: translateY(-1px);
}

.lang-button.is-active,
.filter-button.is-active,
.type-button.is-active {
  border-color: transparent;
  background: #233047;
  color: #ffffff;
}

.story-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.85rem;
  overflow: hidden;
}

.story-list-head {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  width: 100%;
  height: 2.55rem;
  border: 1px solid rgba(35, 48, 71, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #233047;
  font: inherit;
  font-size: 0.84rem;
  outline: none;
  padding: 0 0.85rem 0 2.25rem;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.search-field input:focus {
  border-color: rgba(0, 166, 214, 0.55);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 166, 214, 0.1);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid #8a94a6;
  border-radius: 50%;
  transform: translateY(-55%);
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 0.42rem;
  height: 2px;
  right: -0.36rem;
  bottom: -0.2rem;
  border-radius: 999px;
  background: #8a94a6;
  transform: rotate(45deg);
}

.type-filters,
.region-filters {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.type-button {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.4rem 0.54rem 0.4rem 0.62rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.story-items {
  display: grid;
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 0.25rem;
}

.story-count {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 0.08rem;
  padding: 0.32rem 0.15rem 0.42rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.76));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 0.76rem;
}

.story-count strong {
  color: #ef476f;
}

.empty-state {
  padding: 1rem 0.85rem;
  border: 1px dashed rgba(35, 48, 71, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  color: #5c6677;
  font-size: 0.84rem;
  line-height: 1.55;
}

.story-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: start;
  width: 100%;
  min-height: 5.1rem;
  border: 1px solid rgba(35, 48, 71, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  text-align: left;
  padding: 0.68rem;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.story-item:hover,
.story-item:focus-visible,
.story-item.is-active {
  border-color: rgba(239, 71, 111, 0.28);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(239, 71, 111, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.story-dot {
  width: 0.78rem;
  height: 0.78rem;
  margin-top: 0.3rem;
  border-radius: 50%;
  background: var(--story-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--story-color) 20%, transparent);
}

.story-copy {
  display: grid;
  gap: 0.24rem;
  min-width: 0;
}

.story-copy strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #25324a;
}

.story-copy span {
  font-size: 0.78rem;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.12rem;
}

.story-meta span {
  display: inline-flex;
  width: fit-content;
  padding: 0.16rem 0.38rem;
  border-radius: 999px;
  background: rgba(35, 48, 71, 0.06);
  color: #5c6677;
  font-size: 0.68rem;
  line-height: 1.35;
}

.story-region {
  max-width: 8rem;
  text-align: right;
}

.focus-card {
  position: absolute;
  right: 3.6vw;
  bottom: 4vh;
  width: min(23rem, 24vw);
  padding: 0.9rem;
}

.focus-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.focus-heading {
  display: grid;
  gap: 0.35rem;
}

.map-status:empty {
  display: none;
}

.focus-language {
  display: grid;
  justify-items: end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.focus-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.focus-continent,
.focus-year {
  display: inline-flex;
  width: fit-content;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #eef9ff;
  color: #1a7196;
}

.focus-year {
  background: #fff1d6;
  color: #9a5b00;
}

.focus-title {
  margin-top: 0.5rem;
  font-size: clamp(1.45rem, 2vw, 2.05rem);
  line-height: 1.03;
}

.focus-theme {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0;
}

.focus-theme span {
  display: inline-flex;
  padding: 0.34rem 0.58rem;
  border-radius: 999px;
  background: #ffedf2;
  color: #c82f5b;
  font-weight: 700;
  font-size: 0.8rem;
}

.focus-theme span:last-child {
  background: #eef9ff;
  color: #1a7196;
}

.focus-subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.86rem;
}

.focus-body {
  margin: 0.65rem 0 0.75rem;
  font-size: 0.86rem;
}

.focus-critical {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid #ef476f;
  border-radius: 0 8px 8px 0;
  background: rgba(255, 237, 242, 0.78);
  color: #5a3442;
  font-size: 0.82rem;
  line-height: 1.55;
}

.focus-source {
  display: grid;
  gap: 0.22rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(26, 113, 150, 0.16);
  border-radius: 8px;
  background: rgba(238, 249, 255, 0.72);
}

.focus-source span {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1a7196;
}

.focus-source p {
  margin: 0;
  color: #475467;
  font-size: 0.8rem;
  line-height: 1.5;
}

.focus-source a {
  width: fit-content;
  color: #0f6c8d;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.focus-source a:hover,
.focus-source a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.focus-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.focus-tag {
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(35, 48, 71, 0.09);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 0.78rem;
}

@media (max-width: 1120px) {
  .left-column {
    left: 1rem;
    width: min(31rem, calc(50vw - 1.5rem));
  }

  .focus-card {
    right: 1rem;
    width: min(22rem, calc(40vw - 1.5rem));
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    padding-bottom: 1rem;
  }

  .globe-canvas,
  .marker-layer {
    position: fixed;
    height: 100vh;
  }

  .left-column {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    width: calc(100vw - 1.5rem);
    height: auto;
    margin: 0.75rem;
    gap: 0.75rem;
  }

  .hero-panel,
  .story-list,
  .focus-card {
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .hero-title {
    max-width: 12ch;
    font-size: 2.2rem;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-card {
    min-height: 3.9rem;
    padding: 0.55rem;
  }

  .story-list {
    max-height: 27rem;
  }

  .focus-card {
    position: relative;
    right: auto;
    bottom: auto;
    width: calc(100vw - 1.5rem);
    margin: 0 0.75rem 0.75rem;
  }

  .focus-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .focus-language {
    justify-items: start;
  }

  .story-region {
    display: none;
  }
}

@media (max-width: 430px) {
  .hero-panel,
  .story-list,
  .focus-card {
    padding: 0.85rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .summary-grid {
    gap: 0.45rem;
  }

  .summary-card strong {
    font-size: 1.25rem;
  }

  .story-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
}
