:root {
  --bg: #0d0d12;
  --surface: #16161d;
  --accent: #00d4aa;
  --accent-dim: #00a884;
  --down: #e55a5a;
  --down-dim: #b84242;
  --text: #e8e6e3;
  --muted: #6b6b7b;
  --figure-outline: #1e3a5f;
  --figure-shirt: #2d3d52;
  --figure-pants: #1e3a5f;
  --character-scale: 2.5;
  --chart-offset-y: 10rem;
}

@media (max-height: 1200px) {
  :root {
    --character-scale: 2.35;
    --chart-offset-y: 8rem;
  }
}

@media (max-height: 1050px) {
  :root {
    --character-scale: 2.15;
    --chart-offset-y: 6.5rem;
  }
  main {
    justify-content: flex-end;
  }
}

@media (max-height: 900px) {
  :root {
    --character-scale: 2.1;
    --chart-offset-y: 6rem;
  }
  main {
    justify-content: flex-end;
  }
}

@media (max-height: 750px) {
  :root {
    --character-scale: 1.7;
    --chart-offset-y: 4rem;
  }
  main {
    justify-content: flex-end;
  }
}

@media (max-height: 600px) {
  :root {
    --character-scale: 1.35;
    --chart-offset-y: 2rem;
  }
  main {
    justify-content: flex-end;
  }
}

@media (max-height: 500px) {
  :root {
    --character-scale: 1.1;
    --chart-offset-y: 1rem;
  }
  main {
    justify-content: flex-end;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.test-mode {
  max-height: none;
  overflow-y: auto;
}

body.test-mode #priceChangeWrap {
  display: none !important;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,170,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,170,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

header {
  flex-shrink: 0;
  position: relative;
  z-index: 50;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

/* Desktop: nav is "invisible" so head/variant/badges sit in header-left; badges push right */
.header-nav {
  display: contents;
}

.header-left .header-select:not(#feedSelect),
.header-left .variant-switch {
  margin: 0;
}

.header-left .header-badges {
  margin-left: auto;
}

.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: 8px;
  cursor: pointer;
  color: var(--accent);
}
.header-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent-dim);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pyth-badge {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0,212,170,0.2);
}

.header-btn {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--surface);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0,212,170,0.2);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.header-btn:hover {
  background: rgba(0,212,170,0.1);
}

.header-btn-chart {
  animation: chart-btn-ping 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.4);
}

.header-btn-chart:hover {
  animation: chart-btn-glow 1.5s ease-in-out infinite;
}

@keyframes chart-btn-ping {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(0, 212, 170, 0); }
}

@keyframes chart-btn-glow {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(0, 212, 170, 0.3); }
  50% { box-shadow: 0 0 14px 4px rgba(0, 212, 170, 0.5); }
}

.chart-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.chart-overlay[hidden] {
  display: none !important;
}

.chart-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.chart-overlay .chart-page-modal {
  position: relative;
  z-index: 1;
  width: min(1000px, 95vw);
  min-width: 320px;
  height: auto;
  min-height: 0;
  max-height: 90vh;
  margin: 0;
  flex-shrink: 0;
}

.chart-overlay .chart-page-modal .chart-main {
  min-height: 280px;
  max-height: 55vh;
}

.chart-overlay .chart-close-overlay {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--chart-border, #1e1e2a);
  background: var(--chart-surface, #12121a);
  color: var(--chart-muted, #6b6b7b);
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
}

.chart-overlay .chart-close-overlay:hover {
  color: var(--chart-up, #00d4aa);
  border-color: var(--chart-up, #00d4aa);
}

.header-select {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(0,212,170,0.25);
  border-radius: 8px;
  cursor: pointer;
}

.header-select:focus {
  outline: none;
  border-color: var(--accent);
}

.variant-switch {
  display: inline-flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,212,170,0.25);
  background: var(--surface);
}

.variant-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.variant-btn:hover {
  color: var(--text);
  background: rgba(0,212,170,0.08);
}

.variant-btn[aria-pressed="true"] {
  color: var(--accent);
  background: rgba(0,212,170,0.15);
}

.faq-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.faq-modal[hidden] {
  display: none;
}

.faq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.faq-content {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid rgba(0,212,170,0.25);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 420px;
}

.faq-content h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.faq-content p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.change-request-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.change-request-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface, #1a1d21);
  border: 1px solid rgba(0,212,170,0.25);
  border-radius: 8px;
  resize: vertical;
  min-height: 80px;
}

.change-request-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.change-request-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.change-request-submit {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid rgba(0,212,170,0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.change-request-submit:hover {
  background: #00e6b8;
}

.change-request-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.faq-cycles-title {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.faq-cycles {
  margin: 0 0 0 1.25rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
}

.faq-cycles li {
  margin-bottom: 0.25rem;
}

.faq-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.faq-updated {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.9;
}

.changelog-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.changelog-list li {
  margin-bottom: 0.75rem;
  padding-left: 0;
}

.changelog-list time {
  color: var(--accent);
  font-weight: 500;
}

.faq-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.faq-close:hover {
  color: var(--text);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 1rem 2rem 2rem;
  overflow-y: auto;
}

.price-block {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 0.25rem;
  transform: scale(clamp(0.65, calc(1 / var(--character-scale)), 1));
  transform-origin: top center;
}

.price-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.price-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  transition: color 0.3s ease;
}

.price-value.up {
  color: var(--accent);
}

.price-value.down {
  color: var(--down);
}

.price-value.loading {
  color: var(--accent);
  font-size: 1.25rem;
}

.price-change-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.price-change-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.price-change {
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}

.price-change.up {
  color: var(--accent);
}

.price-change.down {
  color: var(--down);
}

.character-wrap {
  position: relative;
  width: 200px;
  min-height: 0;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transform: scale(var(--character-scale));
  transform-origin: center center;
  margin-top: var(--chart-offset-y);
  margin-bottom: 4rem;
}

.character {
  position: relative;
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.head-img {
  position: relative;
  z-index: 3;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  margin-bottom: -12px;
  margin-left: 0;
  display: block;
}

.body-wrap {
  position: relative;
  z-index: 1;
  line-height: 0;
}

.body-img {
  display: block;
  width: 100px;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  object-position: bottom;
}

body.male .breast-wrap {
  display: none !important;
}

body.female .indicator-wrap {
  display: none !important;
}

.indicator-wrap {
  position: absolute;
  left: 58px;
  bottom: 52%;
  width: 10px;
  height: 30px;
  transform-origin: 0 100%;
  transition: transform 0.4s ease-out, height 0.4s ease-out;
  z-index: 2;
}

.indicator {
  width: 100%;
  height: 100%;
  background: var(--accent);
  border-radius: 12px;
  border: 2px solid rgba(0,0,0,0.3);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.indicator-wrap.up .indicator {
  background: var(--accent);
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(0, 212, 170, 0.5);
}

.indicator-wrap.down .indicator {
  background: var(--down);
  border-color: rgba(0,0,0,0.25);
  box-shadow: 0 0 12px var(--down), 0 0 24px rgba(229, 90, 90, 0.5);
}

.breast-wrap {
  --breast-height: 40px;
  --nipple-size: 8px;
  position: absolute;
  top: 15%;
  left: 62px;
  right: auto;
  width: calc(var(--breast-height) * 0.7);
  height: var(--breast-height);
  transform-origin: left top;
  transition: height 0.4s ease-out, width 0.4s ease-out;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.breast {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--breast-height) * 0.7);
  height: var(--breast-height);
  background: var(--accent);
  border-radius: 0 50% 50% 0;
  border: 2px solid rgba(0,0,0,0.25);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.breast-wrap.up .breast {
  background: var(--accent);
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 0 12px var(--accent), 0 0 24px rgba(0, 212, 170, 0.5);
}

.breast-wrap.down .breast {
  background: var(--down);
  border-color: rgba(0,0,0,0.25);
  box-shadow: 0 0 12px var(--down), 0 0 24px rgba(229, 90, 90, 0.5);
}

.nipple {
  position: absolute;
  left: 100%;
  top: 50%;
  width: calc(var(--nipple-size) / 2);
  height: var(--nipple-size);
  transform: translate(-30%, -50%);
  border-radius: 0 50% 50% 0;
  background: #5c4033;
  box-shadow: 0 0 8px 2px rgba(92, 64, 51, 0.9), 0 0 16px 4px rgba(120, 80, 60, 0.6), 0 0 24px 6px rgba(92, 64, 51, 0.35);
  z-index: 3;
  transition: width 0.25s ease, height 0.25s ease;
}

.test-panel {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(0,212,170,0.25);
  border-radius: 12px;
  max-width: 360px;
  font-size: 0.9rem;
}

.test-panel-intro {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.test-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.test-row span:first-child {
  min-width: 8rem;
  color: var(--muted);
}

.test-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.test-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid;
  font-size: 0.85rem;
  cursor: pointer;
}

.test-btn-up { background: rgba(0,212,170,0.15); border-color: var(--accent); color: var(--accent); }
.test-btn-down { background: rgba(229,90,90,0.15); border-color: var(--down); color: var(--down); }

.test-row-confetti {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,212,170,0.15);
}

.test-confetti-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.3;
}

footer {
  flex-shrink: 0;
  padding: 0.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer span {
  margin: 0 0.35rem;
  color: var(--muted);
}

.footer-watermark {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  opacity: 0.7;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  :root {
    --character-scale: 1.5;
    --chart-offset-y: 2rem;
  }

  header {
    padding: 0.5rem 1rem;
    flex-wrap: nowrap;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface);
    border-bottom: 1px solid rgba(0,212,170,0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 60;
  }
  header.is-nav-open .header-nav {
    display: flex;
  }

  .header-nav .header-select,
  .header-nav .variant-switch {
    width: 100%;
    justify-content: stretch;
  }
  .header-nav .variant-switch {
    display: flex;
  }
  .header-nav .variant-btn {
    flex: 1;
  }
  .header-nav .header-badges {
    flex-direction: column;
    gap: 0.5rem;
    margin-left: 0;
  }
  .header-nav .header-badges .header-btn,
  .header-nav .header-badges a {
    display: block;
    text-align: center;
    width: 100%;
  }

  .header-left .header-select {
    max-width: 120px;
    min-width: 0;
  }

  .header-burger {
    display: flex;
    flex-shrink: 0;
  }
  .header-burger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .header-burger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .header-burger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .logo {
    font-size: 1rem;
    min-width: 0;
  }
  .logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100px;
  }

  .logo-img {
    width: 28px;
    height: 28px;
  }

  .header-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }

  .faq-modal {
    padding: 0.75rem;
  }

  .faq-content {
    max-width: none;
    width: 100%;
    padding: 1.25rem 1.25rem 2rem;
    margin: 0 0.5rem;
  }

  .faq-content h2 {
    font-size: 1rem;
  }

  .faq-content p {
    font-size: 0.85rem;
  }

  main {
    padding: 0.75rem 1rem;
  }

  .price-value {
    font-size: 1.6rem;
  }

  .price-value.loading {
    font-size: 1.1rem;
  }

  .price-label {
    font-size: 0.75rem;
  }

  .test-panel {
    max-width: none;
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .test-row span:first-child {
    min-width: 6rem;
  }

  footer {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }

  footer span {
    margin: 0 0.2rem;
  }
}

@media (max-width: 480px) {
  :root {
    --character-scale: 1.25;
    --chart-offset-y: 1rem;
  }

  .price-value {
    font-size: 1.4rem;
  }

  .header-badges {
    gap: 0.35rem;
  }
}

#confettiContainer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.confetti-particle {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  animation: confetti-fall 2.5s ease-out forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}
