:root {
  color-scheme: light;
  --bg: #dff4ff;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-2: rgba(237, 249, 255, 0.9);
  --line: rgba(74, 137, 177, 0.2);
  --text: #183244;
  --muted: #587184;
  --green: #43e59b;
  --red: #ff6a83;
  --amber: #ffd166;
  --blue: #72c7ff;
  --pink: #ff9bd5;
  --mint: #77f0dc;
  --shadow: 0 18px 48px rgba(76, 145, 188, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 155, 213, 0.26), transparent 18rem),
    radial-gradient(circle at 82% 0%, rgba(119, 240, 220, 0.24), transparent 20rem),
    linear-gradient(180deg, rgba(175, 223, 255, 0.72), rgba(235, 249, 255, 0.9) 32rem),
    var(--bg);
  color: var(--text);
  font-size: 14px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("./assets/cat-background-blue-lite.jpg") center top / cover no-repeat;
  opacity: 0.82;
  pointer-events: none;
  z-index: 0;
}

body::after {
  display: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar,
.status-line,
.panel,
.index-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.loading-card {
  opacity: 0.82;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 92px;
  padding: 18px 20px;
  border-radius: 8px;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark,
.theme-icon,
.index-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(145deg, rgba(255, 155, 213, 0.28), rgba(119, 240, 220, 0.16)),
    rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 22px rgba(0, 0, 0, 0.22);
}

.logo-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  font-size: 26px;
}

.logo-mark span {
  transform: translateY(-1px);
}

.cat-mascot {
  position: absolute;
  right: 268px;
  top: 8px;
  width: 124px;
  height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  object-fit: cover;
  object-position: 50% 35%;
  opacity: 0.94;
  pointer-events: none;
  filter: drop-shadow(0 14px 22px rgba(255, 155, 213, 0.18));
  transform-origin: 50% 80%;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.select-wrap,
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

select {
  min-width: 142px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.icon-button {
  width: 48px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.42), transparent 10px),
    linear-gradient(145deg, rgba(255, 155, 213, 0.34), rgba(119, 240, 220, 0.22));
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  padding-right: 18px;
}

.icon-button::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 50%;
  width: 18px;
  height: 18px;
  background-color: #d9f3ff;
  background-image: url("./assets/cat-ui-stickers-lite.png");
  background-position: 100% 100%;
  background-size: 400% auto;
  background-repeat: no-repeat;
  border-radius: 7px;
  transform: translateY(-50%) rotate(8deg);
  pointer-events: none;
}

.toggle input {
  accent-color: var(--blue);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(114, 199, 255, 0.22), rgba(119, 240, 220, 0.14));
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.error-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 91, 102, 0.45);
  border-radius: 8px;
  background: rgba(255, 91, 102, 0.12);
  color: #ffd8dc;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mini-panel {
  margin-bottom: 14px;
  box-shadow: none;
}

.compact-head {
  align-items: center;
  margin-bottom: 10px;
}

.cat-corner {
  display: none;
}

.theme-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.theme-chip {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 9px 52px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 155, 213, 0.09), rgba(119, 240, 220, 0.06)),
    rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.theme-chip.active {
  border-color: rgba(119, 240, 220, 0.5);
  background:
    linear-gradient(145deg, rgba(119, 240, 220, 0.16), rgba(255, 155, 213, 0.1)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(119, 240, 220, 0.12), 0 10px 24px rgba(255, 155, 213, 0.12);
}

.theme-chip:active {
  transform: scale(0.98);
}

.theme-chip-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.34), transparent 9px),
    linear-gradient(145deg, rgba(255, 155, 213, 0.34), rgba(119, 240, 220, 0.2));
  color: var(--text);
  font-size: 10px;
  font-weight: 900;
}

.theme-chip-name {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-chip strong {
  font-size: 12px;
  white-space: nowrap;
}

.theme-chip small {
  grid-column: 2 / 4;
  color: var(--muted);
  font-size: 11px;
}

.cat-sticker {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background-color: #d9f3ff;
  background-image: url("./assets/cat-ui-stickers-lite.png");
  background-position: 0 0;
  background-size: 400% auto;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 18px rgba(75, 154, 210, 0.18);
  transform: translateY(-50%) rotate(3deg);
  pointer-events: none;
}

.sticker-0 .cat-sticker { background-position: 0% 0%; }
.sticker-1 .cat-sticker { background-position: 33.333% 0%; }
.sticker-2 .cat-sticker { background-position: 66.666% 0%; }
.sticker-3 .cat-sticker { background-position: 100% 0%; }
.sticker-4 .cat-sticker { background-position: 0% 50%; }
.sticker-5 .cat-sticker { background-position: 33.333% 50%; }
.sticker-6 .cat-sticker { background-position: 66.666% 50%; }
.sticker-7 .cat-sticker { background-position: 100% 50%; }
.sticker-8 .cat-sticker { background-position: 0% 100%; }
.sticker-9 .cat-sticker { background-position: 33.333% 100%; }
.sticker-10 .cat-sticker { background-position: 66.666% 100%; }
.sticker-11 .cat-sticker { background-position: 100% 100%; }

.index-card {
  min-height: 112px;
  padding: 15px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.index-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.11), transparent 30%);
  opacity: 0.55;
}

.index-card::before,
.row::before,
.sector-score::before {
  display: none;
}

.index-card,
.panel {
  position: relative;
}

.index-card > *,
.panel > * {
  position: relative;
  z-index: 1;
}

.index-top,
.theme-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.index-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}

.theme-icon {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 900;
}

.index-card .name,
.row .name {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.index-card .price {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 800;
}

.index-card .change {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 1.35fr 0.92fr 0.82fr;
  gap: 14px;
  align-items: start;
}

.panel {
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
}

.wide {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.panel-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button {
  min-height: 30px;
  padding: 0 28px 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.segmented button::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 16px;
  height: 16px;
  background-color: #d9f3ff;
  background-image: url("./assets/cat-ui-stickers-lite.png");
  background-position: 0 0;
  background-size: 400% auto;
  background-repeat: no-repeat;
  border-radius: 6px;
  opacity: 0.8;
  transform: translateY(-50%) rotate(6deg);
  pointer-events: none;
}

.segmented button.active {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.34), transparent 10px),
    linear-gradient(135deg, rgba(255, 155, 213, 0.34), rgba(119, 240, 220, 0.24));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

#metricControls button:nth-child(1)::after { background-position: 0% 0%; }
#metricControls button:nth-child(2)::after { background-position: 33.333% 0%; }
#metricControls button:nth-child(3)::after { background-position: 66.666% 0%; }
#metricControls button:nth-child(4)::after { background-position: 100% 0%; }
#filterControls button:nth-child(1)::after { background-position: 0% 50%; }
#filterControls button:nth-child(2)::after { background-position: 33.333% 50%; }
#filterControls button:nth-child(3)::after { background-position: 66.666% 50%; }

.segmented.small button {
  min-height: 26px;
  padding-inline: 9px;
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  height: 42px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
}

th {
  color: var(--muted);
  font-weight: 700;
}

tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: rgba(114, 199, 255, 0.1);
}

tbody tr.active {
  outline: 1px solid rgba(119, 240, 220, 0.26);
}

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

.pos {
  color: var(--red);
}

.neg {
  color: var(--green);
}

.flat {
  color: var(--muted);
}

.strength {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  gap: 10px;
}

.mini-bar,
.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.mini-bar i,
.bar i {
  display: block;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  background: var(--green);
}

.sector-score {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 155, 213, 0.12), rgba(119, 240, 220, 0.08)),
    var(--panel-2);
  transform-origin: center;
}

.sector-score span {
  color: var(--muted);
  font-size: 13px;
}

.sector-score strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1;
}

.bar {
  height: 12px;
}

.member-list,
.futures-list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.055);
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.row > * {
  position: relative;
  z-index: 1;
}

.row strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.row .meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.cat-hop {
  animation: cat-hop 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.strip-pop .theme-chip.active {
  animation: chip-pop 540ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.score-pop {
  animation: score-pop 540ms ease;
}

.list-pop .row {
  animation: row-rise 420ms ease both;
}

.list-pop .row:nth-child(2) {
  animation-delay: 45ms;
}

.list-pop .row:nth-child(3) {
  animation-delay: 90ms;
}

.list-pop .row:nth-child(n + 4) {
  animation-delay: 120ms;
}

@keyframes cat-hop {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  35% {
    transform: translateY(-12px) rotate(-4deg) scale(1.06);
  }
  62% {
    transform: translateY(2px) rotate(3deg) scale(0.98);
  }
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes chip-pop {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 rgba(255, 155, 213, 0);
  }
  45% {
    transform: scale(1.035);
    box-shadow: 0 0 0 7px rgba(255, 155, 213, 0.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 1px rgba(119, 240, 220, 0.12), 0 10px 24px rgba(255, 155, 213, 0.12);
  }
}

@keyframes score-pop {
  0% {
    transform: scale(0.98);
    border-color: rgba(255, 255, 255, 0.12);
  }
  45% {
    transform: scale(1.018);
    border-color: rgba(255, 155, 213, 0.5);
    box-shadow: 0 0 0 6px rgba(255, 155, 213, 0.1);
  }
  100% {
    transform: scale(1);
    border-color: var(--line);
    box-shadow: none;
  }
}

@keyframes row-rise {
  from {
    opacity: 0.4;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 1120px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 720px) {
  body {
    background:
      radial-gradient(circle at 50% -4%, rgba(255, 155, 213, 0.22), transparent 17rem),
      linear-gradient(180deg, rgba(173, 225, 255, 0.74), rgba(238, 250, 255, 0.96) 22rem),
      var(--bg);
  }

  .shell {
    width: min(100vw - 20px, 680px);
    padding-top: 10px;
    padding-bottom: 18px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-inline: -10px;
    border-radius: 0;
    border-inline: 0;
  }

  .cat-mascot {
    right: 12px;
    top: 14px;
    width: 72px;
    height: 52px;
    border-radius: 16px;
    opacity: 0.62;
  }

  .brand {
    gap: 12px;
  }

  .logo-mark {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 22px;
  }

  .controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 48px auto;
    justify-content: stretch;
  }

  .select-wrap {
    width: 100%;
    min-width: 0;
  }

  select {
    width: 100%;
    min-width: 0;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 14px;
  }

  .status-line {
    margin: 10px 0;
    padding: 10px;
    font-size: 12px;
  }

  .overview-grid,
  .workspace {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel,
  .index-card {
    padding: 14px;
  }

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

  .theme-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-chip {
    grid-template-columns: 28px minmax(0, 1fr);
    padding-right: 46px;
    background:
      linear-gradient(145deg, rgba(255, 155, 213, 0.09), rgba(119, 240, 220, 0.06)),
      rgba(255, 255, 255, 0.055);
  }

  .cat-sticker {
    right: 7px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background-size: 400% auto;
  }

  .theme-chip strong {
    grid-column: 2;
  }

  .theme-chip small {
    grid-column: 2;
  }

  .index-card {
    min-height: 92px;
  }

  .index-card .price {
    margin-top: 10px;
    font-size: 18px;
  }

  .panel {
    box-shadow: none;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
  }

  .panel-actions {
    justify-items: stretch;
  }

  .segmented {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .segmented button {
    padding: 0 22px 0 6px;
    font-size: 11px;
  }

  .segmented button::after {
    right: 5px;
    width: 14px;
    height: 14px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    min-height: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
      linear-gradient(145deg, rgba(255, 155, 213, 0.08), rgba(119, 240, 220, 0.05)),
      rgba(255, 255, 255, 0.055);
  }

  tbody tr:hover,
  tbody tr.active {
    background: rgba(85, 168, 255, 0.12);
    border-color: rgba(85, 168, 255, 0.45);
  }

  td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    min-height: 32px;
    height: auto;
    border-bottom: 0;
    font-size: 12px;
    text-align: right;
  }

  td:first-child {
    grid-template-columns: 1fr;
    min-height: 42px;
    text-align: left;
  }

  td:not(:first-child)::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
  }

  .strength {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .sector-score strong {
    font-size: 28px;
  }

  .row {
    min-height: 58px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100vw - 12px, 420px);
  }

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

  .toggle {
    grid-column: 1 / -1;
    justify-content: center;
  }
}
