:root {
  color: #17201f;
  background: #f7faf8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

.topbar,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid #d8e2dd;
  background: #ffffff;
}

footer {
  border-top: 1px solid #d8e2dd;
  border-bottom: 0;
  align-items: flex-start;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

h2 {
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
}

.eyebrow {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tagline {
  margin-top: 6px;
  color: #4c5f5a;
}

.text-link,
a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

.text-button {
  border: 0;
  background: transparent;
  color: #0f766e;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
}

.text-button.active-text {
  color: #17201f;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 154px);
}

.layout.risk-mode,
.layout.create-mode,
.layout.portfolio-mode {
  grid-template-columns: 1fr;
}

.layout.risk-mode .market-list,
.layout.create-mode .market-list,
.layout.portfolio-mode .market-list {
  display: none;
}

.market-list {
  border-right: 1px solid #d8e2dd;
  background: #edf7f4;
  padding: 16px;
}

.creator-entry {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid #cbd9d4;
  border-radius: 8px;
  background: #ffffff;
}

.creator-entry h2 {
  font-size: 18px;
}

.creator-entry p {
  color: #4d625c;
  line-height: 1.45;
}

.market-band + .market-band {
  margin-top: 20px;
}

.market-band h2 {
  font-size: 14px;
  margin-bottom: 10px;
  color: #31524c;
}

.market-item {
  width: 100%;
  min-height: 94px;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid #cbd9d4;
  background: #ffffff;
  border-radius: 8px;
  padding: 12px;
  color: #17201f;
  cursor: pointer;
}

.market-item + .market-item {
  margin-top: 10px;
}

.market-item.selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.market-item strong {
  color: #b42318;
}

.market-item small {
  color: #62756f;
}

.leaderboard {
  margin-top: 20px;
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid #d6e1dc;
  background: #ffffff;
  border-radius: 8px;
}

.leaderboard h2 {
  font-size: 14px;
  color: #31524c;
}

.leader-item {
  min-height: 58px;
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid #d8e2dd;
  border-radius: 8px;
  background: #f8fbfa;
  color: #17201f;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.leader-item span {
  overflow-wrap: anywhere;
}

.leader-item strong {
  color: #0f766e;
}

.detail {
  padding: clamp(16px, 4vw, 40px);
  display: grid;
  gap: 20px;
  align-content: start;
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid #b9cbc5;
  border-radius: 8px;
  background: #ffffff;
  color: #0f766e;
  cursor: pointer;
  font-size: 20px;
}

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

.metric-grid.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric,
.trade-panel,
.transparency,
.risk,
.eligibility,
.creator-section,
.payout-panel {
  border: 1px solid #d6e1dc;
  background: #ffffff;
  border-radius: 8px;
}

.metric {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
}

.metric span,
.estimate span,
.rows span {
  color: #62756f;
  font-size: 13px;
}

.metric strong {
  font-size: 22px;
}

.trade-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.creator-center {
  gap: 16px;
}

.creator-form {
  display: grid;
  gap: 14px;
}

.creator-section {
  padding: 16px;
  display: grid;
  gap: 14px;
}

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

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

.input-row select,
.input-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9cbc5;
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: #17201f;
}

.preview-line {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6fbfa;
}

.preview-line span {
  color: #62756f;
  font-size: 13px;
}

.preview-line strong {
  overflow-wrap: anywhere;
}

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

.tier-button {
  min-height: 96px;
  display: grid;
  gap: 6px;
  text-align: left;
  border: 1px solid #cbd9d4;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
  cursor: pointer;
}

.tier-button.selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.tier-button strong {
  color: #b42318;
  font-size: 20px;
}

.tier-button small {
  color: #62756f;
}

.eligibility {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #40544e;
  line-height: 1.45;
}

.check-row input {
  margin-top: 3px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #c7d8d2;
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid #c7d8d2;
  background: #f7faf8;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #0f766e;
  color: #ffffff;
  font-weight: 800;
}

.input-row {
  display: grid;
  gap: 8px;
}

.estimate {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f6fbfa;
}

.estimate div {
  display: grid;
  gap: 4px;
}

.estimate.warn {
  background: #fff8e1;
}

.estimate.danger {
  background: #fff3df;
  border: 1px solid #f3b35f;
}

.estimate.block {
  background: #fff0ee;
  border: 1px solid #ef8b80;
}

.slippage-confirm {
  padding: 10px;
  border: 1px solid #f3b35f;
  border-radius: 8px;
  background: #fff8e1;
}

.notice {
  color: #4d625c;
  font-size: 14px;
  line-height: 1.45;
}

.primary {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #b42318;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.primary:disabled {
  background: #a4aaa7;
  cursor: not-allowed;
}

.secondary {
  min-height: 42px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #ffffff;
  color: #0f766e;
  cursor: pointer;
  font-weight: 800;
}

.secondary.compact {
  min-height: 38px;
  padding: 0 12px;
}

.secondary.active-outline {
  background: #0f766e;
  color: #ffffff;
}

.validation-list {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
}

.validation-list.issue {
  border: 1px solid #ef8b80;
  background: #fff0ee;
}

.validation-list.warn {
  border: 1px solid #f3b35f;
  background: #fff8e1;
}

.validation-list p {
  color: #40544e;
  line-height: 1.45;
}

.transparency,
.risk {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.payout-panel {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.payout-panel p {
  color: #4d625c;
  line-height: 1.5;
}

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

.status-ok {
  padding: 10px 12px;
  border: 1px solid #9ac9bd;
  border-radius: 8px;
  background: #effaf7;
}

.promo-center {
  gap: 16px;
}

.promo-shell {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.phone-frame,
.promo-actions section,
.promo-summary {
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #ffffff;
}

.phone-frame {
  overflow: hidden;
  background: #e7f2ef;
}

.chat-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #cbd9d4;
  background: #ffffff;
}

.chat-header span {
  color: #62756f;
  font-size: 13px;
}

.telegram-bubble {
  margin: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(23, 32, 31, 0.08);
}

.telegram-bubble pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #17201f;
  font: inherit;
  line-height: 1.5;
}

.telegram-buttons {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.telegram-buttons a,
.link-button {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #f7faf8;
  color: #0f766e;
  font-weight: 800;
  text-align: center;
}

.promo-actions {
  display: grid;
  gap: 16px;
}

.promo-actions section {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.rows.compact p {
  grid-template-columns: 110px minmax(0, 1fr);
}

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

.promo-summary {
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.promo-summary .metric {
  border: 0;
  border-right: 1px solid #d6e1dc;
  border-radius: 0;
}

.promo-summary .metric:last-child {
  border-right: 0;
}

.portfolio-center {
  gap: 16px;
}

.portfolio-hero,
.portfolio-section {
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.portfolio-hero p,
.portfolio-section p {
  color: #4d625c;
  line-height: 1.5;
}

.portfolio-actions,
.portfolio-summary,
.settlement-states {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-title span {
  color: #62756f;
  font-size: 13px;
}

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

.status-card {
  min-height: 110px;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid #cbd9d4;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
  cursor: pointer;
}

.status-card.selected {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.status-card span {
  overflow-wrap: anywhere;
}

.status-card strong {
  color: #b42318;
}

.status-card small {
  color: #62756f;
}

.portfolio-list {
  display: grid;
  gap: 10px;
}

.portfolio-card,
.history-item {
  display: grid;
  gap: 12px;
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px;
}

.portfolio-card h4 {
  margin: 4px 0 0;
  color: #10231f;
  font-size: 15px;
  line-height: 1.35;
}

.portfolio-card span,
.history-item span,
.history-item small {
  color: #62756f;
  font-size: 12px;
}

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

.portfolio-card-grid p {
  margin: 0;
  display: grid;
  gap: 4px;
}

.portfolio-card-grid strong,
.history-item strong {
  color: #31524c;
  overflow-wrap: anywhere;
}

.portfolio-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-item p {
  margin: 0;
  color: #31524c;
  overflow-wrap: anywhere;
}

.settlement-states div {
  min-height: 88px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 12px;
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #f8fbfa;
}

.settlement-states span {
  color: #62756f;
  font-size: 13px;
}

.rows {
  display: grid;
  gap: 10px;
}

.rows p {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
}

code {
  white-space: normal;
  overflow-wrap: anywhere;
  color: #31524c;
}

.risk p {
  color: #4d625c;
  line-height: 1.6;
}

.risk-center {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.only-risk {
  min-height: calc(100vh - 300px);
  align-content: start;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 32, 31, 0.42);
}

.wallet-guide {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #d6e1dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(23, 32, 31, 0.2);
}

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

.link-button {
  min-height: 42px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 12px;
}

@media (max-width: 860px) {
  .topbar,
  footer,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .layout.create-mode .detail,
  .layout.promo-mode .detail,
  .layout.portfolio-mode .detail,
  .layout.risk-mode .detail {
    order: -1;
  }

  .market-list {
    border-right: 0;
    border-bottom: 1px solid #d8e2dd;
  }

  .promo-shell,
  .promo-summary,
  .portfolio-summary,
  .portfolio-actions,
  .portfolio-card-grid,
  .portfolio-card-actions,
  .status-list,
  .settlement-states,
  .metric-grid,
  .estimate,
  .form-grid,
  .tier-grid,
  .promo-link-list,
  .payout-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wallet-options {
    grid-template-columns: 1fr;
  }

  .rows p {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 440px) {
  .promo-shell,
  .promo-summary,
  .portfolio-summary,
  .portfolio-actions,
  .portfolio-card-grid,
  .portfolio-card-actions,
  .status-list,
  .settlement-states,
  .metric-grid,
  .estimate,
  .form-grid,
  .tier-grid,
  .promo-link-list,
  .payout-actions {
    grid-template-columns: 1fr;
  }

  .preview-line {
    grid-template-columns: 1fr;
  }
}
