:root {
  color-scheme: dark;
  --bg: #101820;
  --panel: #17222b;
  --panel-2: #1d2b35;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3f7f5;
  --muted: #9dacaa;
  --green: #64d28c;
  --yellow: #f6c75f;
  --red: #ff7770;
  --blue: #64b5f6;
  --cyan: #68e0cf;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(100, 210, 140, 0.14), transparent 30%),
    linear-gradient(135deg, #101820 0%, #15262c 45%, #1a2028 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #22323e;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: #2a3d4a;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(12, 18, 23, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    linear-gradient(#f15b5b 0 48%, #f7f7f2 49% 100%);
  border: 3px solid #111820;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f7f7f2;
  border: 4px solid #111820;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sync-card span,
.sync-card small,
.eyebrow {
  color: var(--muted);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tabs button {
  width: 100%;
  text-align: left;
  padding: 0 14px;
}

.nav-tabs button.active,
.mobile-tabs button.active,
.segmented button.active {
  background: var(--green);
  color: #0e1913;
  border-color: transparent;
  font-weight: 800;
}

.sync-card {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 20px;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

main {
  min-width: 0;
  padding: 28px;
  padding-bottom: 96px;
}

.topbar {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2rem, 4.5vw, 4.4rem);
  line-height: 0.98;
  overflow-wrap: break-word;
}

h2,
p {
  margin: 0;
}

.quick-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quick-actions button,
.panel-head > button {
  min-width: 0;
  padding: 0 14px;
}

.score-band {
  display: grid;
  min-width: 0;
  grid-template-columns: 150px minmax(0, 1fr) 240px;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(100, 210, 140, 0.35);
  border-radius: 8px;
  background: linear-gradient(120deg, rgba(100, 210, 140, 0.18), rgba(100, 181, 246, 0.1));
  box-shadow: var(--shadow);
}

.score {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 10px solid rgba(100, 210, 140, 0.8);
  background: rgba(12, 18, 23, 0.58);
}

.score span,
.weather-chip span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score strong {
  font-size: 3.1rem;
  line-height: 0.9;
}

.score-detail {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.score-detail h2 {
  font-size: 1.55rem;
}

.score-detail p,
.panel p {
  color: #c9d6d3;
}

.weather-chip {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.content-grid.two,
.wide-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
}

.wide-layout {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 34, 43, 0.9);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 1.05rem;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.segmented {
  display: flex;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
}

.priority-list,
.event-list,
.goal-list,
.raid-list,
.box-list,
.prep-list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.item-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--panel-2);
  font-weight: 900;
}

.item strong,
.item small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.item small {
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(100, 210, 140, 0.16);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.map-panel {
  min-height: 430px;
}

.field-map {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, #263d35, #203743 45%, #2c3b2f);
  background-size: 42px 42px, 42px 42px, cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.field-map.has-real-map {
  background: #16212a;
}

.field-map.has-real-map .path,
.field-map.has-real-map .route-line,
.field-map.has-real-map .map-pin {
  display: none;
}

.real-map-frame {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  width: 100%;
  height: 100%;
  border: 0;
  filter: saturate(0.84) contrast(1.03);
}

.field-map.has-real-map .real-map-frame {
  display: block;
}

.campfire-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.campfire-pin {
  position: absolute;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: #f6c75f;
  color: #111820;
  font-size: 0.72rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.campfire-pin.ambassador {
  background: #64d28c;
}

.field-map.large {
  min-height: min(68vh, 680px);
}

.path {
  position: absolute;
  height: 70px;
  width: 130%;
  left: -15%;
  border: 14px solid rgba(246, 199, 95, 0.42);
  border-left: 0;
  border-right: 0;
  transform: rotate(-14deg);
}

.path-a {
  top: 38%;
}

.path-b {
  top: 62%;
  transform: rotate(17deg);
}

.route-line {
  position: absolute;
  inset: 24% 18% 22% 18%;
  border: 4px dashed rgba(104, 224, 207, 0.88);
  border-radius: 44% 56% 50% 42%;
}

.map-pin {
  position: absolute;
  z-index: 2;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  color: #0d1614;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.map-pin.gym {
  background: var(--red);
}

.map-pin.stop {
  background: var(--blue);
}

.map-pin.max {
  background: var(--yellow);
}

.map-pin.nest {
  background: var(--green);
}

.steps {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
  padding-left: 22px;
  color: #c9d6d3;
}

.map-status {
  margin-top: 10px;
  color: #c9d6d3;
  font-size: 0.95rem;
}

.campfire-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.campfire-event,
.empty-state {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.campfire-event img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-2);
}

.campfire-event strong,
.campfire-event small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.campfire-event small,
.empty-state {
  color: var(--muted);
}

.empty-state {
  grid-template-columns: 1fr;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mon {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.mon .orb {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--blue));
}

.rules {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.rules label {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #d5dfdc;
}

.pipeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pipeline span,
.pipeline strong {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.pipeline strong {
  background: rgba(100, 210, 140, 0.16);
  color: var(--green);
}

.mobile-tabs {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  main {
    max-width: 100vw;
    overflow-x: hidden;
    padding: 18px;
    padding-bottom: 96px;
  }

  .topbar,
  .score-band,
  .content-grid,
  .content-grid.two,
  .wide-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .quick-actions {
    justify-content: stretch;
  }

  .quick-actions button {
    flex: 1 1 120px;
    padding-inline: 8px;
  }

  .score-band,
  .panel,
  .content-grid,
  .wide-layout {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .score-band {
    display: grid;
  }

  .score {
    width: 128px;
  }

  .weather-chip {
    width: 100%;
  }

  .mobile-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(12, 18, 23, 0.92);
    backdrop-filter: blur(18px);
  }

  .mobile-tabs button {
    min-width: 0;
    min-height: 42px;
    padding: 0 4px;
    font-size: 0.78rem;
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.95rem;
    line-height: 1.05;
  }

  .panel {
    padding: 14px;
  }

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

  .item .badge {
    grid-column: 2;
    justify-self: start;
  }

  .field-map {
    min-height: 280px;
  }

  .score-detail h2 {
    font-size: 1.35rem;
  }
}
