:root {
  color-scheme: dark;
  --bg: #071016;
  --sidebar: #0c151d;
  --panel: #111d27;
  --panel-2: #162937;
  --line: #263f4c;
  --text: #eef8f8;
  --muted: #96aeb8;
  --green: #38d7a2;
  --amber: #f2bb57;
  --pink: #f06ea9;
  --blue: #57a7ff;
  --danger: #ff6f61;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(12, 25, 34, 0.96), rgba(7, 16, 22, 1) 380px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
  background: rgba(12, 21, 29, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--green);
  font-weight: 900;
}

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

.brand small, .mini, .eyebrow, dt, .panel-title span {
  color: var(--muted);
}

nav {
  display: flex;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  white-space: nowrap;
}

nav a.active, nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}

nav a.nav-cast {
  color: var(--green);
  border-color: rgba(56, 215, 162, 0.36);
}

.wallet-zone {
  display: flex;
  justify-content: end;
}

.wallet-button, .primary-button, .ghost-button, .primary-action, .secondary-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.wallet-button, .primary-button, .primary-action {
  border-color: rgba(56, 215, 162, 0.72);
  background: linear-gradient(180deg, rgba(56, 215, 162, 0.24), rgba(56, 215, 162, 0.09));
  color: #f4fffb;
  font-weight: 850;
}

.wallet-button.connected, .primary-button.connected {
  border-color: rgba(87, 167, 255, 0.72);
  background: linear-gradient(180deg, rgba(87, 167, 255, 0.24), rgba(87, 167, 255, 0.09));
}

.ghost-button, .secondary-action {
  color: var(--muted);
}

.notice {
  min-height: 22px;
  margin: 0;
  color: var(--amber);
  font-size: 13px;
}

main {
  min-width: 0;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 22px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
}

.section-head.compact h1 {
  max-width: 760px;
  font-size: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(38px, 7vw, 74px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric, .panel, .fish-card, .feed-item, .rank-row, .wallet-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 29, 39, 0.86);
}

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
}

.panel {
  padding: 16px;
}

.panel-title, .row.between {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.timeline, .feed, .rank-list, .wallet-list {
  display: grid;
  gap: 10px;
}

.timeline {
  margin-top: 14px;
}

.timeline-item, .feed-item, .rank-row, .wallet-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.thumb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #091721;
}

.thumb img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(56, 215, 162, 0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.badge.uncommon {
  color: var(--amber);
  background: rgba(242, 187, 87, 0.13);
}

.badge.rare {
  color: var(--pink);
  background: rgba(240, 110, 169, 0.14);
}

.badge.pending {
  color: var(--muted);
  background: rgba(150, 174, 184, 0.12);
}

.fleet-card {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.fleet-highlight {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
}

.fleet-highlight img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #091721;
  border-radius: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

input, select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

input {
  min-width: min(460px, 100%);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.fish-card {
  overflow: hidden;
}

.fish-art {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: #091721;
}

.fish-art img {
  width: 84%;
  height: 84%;
  object-fit: contain;
}

.fish-copy {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.fish-copy p {
  margin: 0;
}

dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

dt {
  font-size: 11px;
}

dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.links a {
  color: var(--text);
  text-decoration: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1720;
  font-size: 13px;
}

.wallet-row a {
  color: var(--text);
  text-decoration: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1720;
  font-size: 13px;
}

.cast-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
}

.cast-ticket {
  display: grid;
  gap: 18px;
}

.cast-ticket dl {
  grid-template-columns: 1fr;
}

.price-stack {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid rgba(56, 215, 162, 0.45);
  border-radius: 8px;
  background: rgba(56, 215, 162, 0.08);
}

.price-stack span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.price-stack strong {
  font-size: 44px;
  line-height: 1;
}

.cast-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.cast-submit {
  min-height: 54px;
  font-size: 16px;
}

.cast-flow {
  display: grid;
  gap: 16px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.flow-step {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #0b1720;
  font-size: 13px;
  font-weight: 850;
}

.flow-step.active {
  color: var(--green);
  border-color: rgba(56, 215, 162, 0.64);
  background: rgba(56, 215, 162, 0.1);
}

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

.status-board article, .recovery-row {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1720;
}

.status-board span, .recovery-row span {
  color: var(--muted);
  font-size: 12px;
}

.status-board strong, .recovery-row strong {
  overflow-wrap: anywhere;
}

.cast-recovery {
  grid-column: 1 / -1;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.market-card p {
  max-width: 720px;
}

.market-card.wide {
  grid-column: 1 / -1;
}

.market-fish-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.market-fish {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: #0b1720;
}

.market-fish img {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #091721;
  border-radius: 8px;
}

.market-fish span {
  font-size: 13px;
  font-weight: 800;
}

.market-fish small {
  color: var(--muted);
}

.cast-card.featured {
  border-color: rgba(56, 215, 162, 0.7);
}

.pending-row {
  border-color: rgba(150, 174, 184, 0.45);
  background: rgba(18, 26, 31, 0.9);
}

.hidden {
  display: none;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  nav a {
    text-align: center;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .brand, .wallet-zone {
    justify-self: center;
  }

  nav {
    justify-content: start;
  }

  .metric-grid, .split, .cast-layout, .market-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  .hero-actions {
    justify-content: start;
  }
}

@media (max-width: 620px) {
  main {
    padding: 18px 14px;
  }

  nav {
    justify-content: start;
  }

  h1, .section-head.compact h1 {
    font-size: 32px;
    line-height: 1.05;
  }

  .flow-steps, .status-board {
    grid-template-columns: 1fr;
  }

  .price-stack strong {
    font-size: 34px;
  }

  .timeline-item, .feed-item, .rank-row, .wallet-row {
    grid-template-columns: 56px 1fr;
  }

  .timeline-item .badge, .feed-item .badge, .rank-row .badge, .wallet-row a {
    grid-column: 2;
    width: fit-content;
  }

  .thumb {
    width: 56px;
    height: 56px;
  }

  .thumb img {
    width: 52px;
    height: 52px;
  }
}
