:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07110b;
  color: #102016;
  --bg: #06110b;
  --board: #ffffff;
  --panel: #fbfff8;
  --panel-2: #f2faef;
  --line: #dbe8dc;
  --line-soft: rgba(16, 32, 22, 0.1);
  --text: #102016;
  --muted: #687869;
  --green: #16a34a;
  --green-2: #087f3c;
  --yellow: #b4d72e;
  --soil: #7b5633;
  --red: #d33f3f;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(64, 240, 118, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(64, 240, 118, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, rgba(64, 240, 118, 0.15), transparent 26%),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto;
}

button,
input,
select {
  font: inherit;
}

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

.shell {
  width: min(1420px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 20px;
  background: var(--board);
  border: 1px solid rgba(64, 240, 118, 0.26);
  border-radius: 14px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 4px 0 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-lockup > div {
  min-width: 0;
}

.eyebrow,
.brand-subtitle,
.source-label,
.timeline small,
.decision-card span,
.decision-card small,
.allocation p,
.balance-row small,
.empty-state {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--text);
  font-size: clamp(2.25rem, 5vw, 5.3rem);
  line-height: 1;
  max-width: 100%;
}

.pixel-title {
  font-family: "Courier New", "Lucida Console", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 1000;
  text-transform: none;
  text-shadow:
    2px 0 #102016,
    0 2px #102016,
    2px 2px #102016;
}

.title-notpunks {
  color: var(--green);
}

.title-farm {
  color: var(--yellow);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  min-width: 0;
  max-width: 100%;
}

.title-art {
  flex: 0 0 auto;
  width: clamp(86px, 9vw, 138px);
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
}

.brand-subtitle {
  max-width: 520px;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.header-actions,
.wallet-panel,
.control-strip,
.workspace {
  display: flex;
  gap: 10px;
}

.header-actions {
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.wallet-panel {
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-height: 62px;
  min-width: 0;
  max-width: 100%;
}

.language-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.language-control span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.language-control select {
  min-width: 76px;
  min-height: 40px;
}

.wallet-panel > #tonConnectButton,
.wallet-panel > .status-pill {
  margin-bottom: 0;
}

.wallet-panel > #tonConnectButton {
  display: flex;
  align-items: end;
  max-width: 100%;
  min-height: 40px;
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  min-height: 40px;
}

.tab-button {
  min-height: 30px;
  min-width: 86px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
  cursor: pointer;
}

.tab-button.is-active {
  background: #ffffff;
  color: var(--green);
  border-color: rgba(16, 163, 74, 0.22);
  box-shadow: 0 8px 22px rgba(16, 32, 22, 0.08);
}

.tab-view[hidden] {
  display: none;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.trust-strip span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(16, 163, 74, 0.2);
  border-radius: 999px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--green-2);
  font-size: 0.74rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.primary-button,
.icon-button,
.secondary-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(16, 163, 74, 0.4);
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.icon-button,
.secondary-button {
  background: #ffffff;
  color: var(--green);
  border-color: rgba(16, 163, 74, 0.24);
}

.secondary-button {
  width: 100%;
  margin-top: 6px;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#tonConnectButton [data-tc-button="true"] {
  min-height: 40px;
  height: 40px !important;
  border-radius: 8px !important;
  background: var(--green) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.primary-button .lucide,
.icon-button .lucide,
.secondary-button .lucide {
  width: 17px;
  height: 17px;
}

.lucide,
.metric-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.metric-icon {
  width: 22px;
  height: 22px;
  color: var(--green);
}

.status-pill,
.risk {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill {
  height: 40px;
  background: rgba(16, 163, 74, 0.08);
  color: var(--green);
  border: 1px solid rgba(16, 163, 74, 0.22);
}

.control-strip,
.summary-grid article,
.main-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.control-strip {
  flex-wrap: wrap;
  align-items: end;
  padding: 12px;
}

.control-strip > label {
  flex: 1 1 190px;
  max-width: 260px;
  min-width: 0;
}

.control-strip > .icon-button {
  min-width: 128px;
}

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

.advanced-controls,
.advanced-section,
.compact-details {
  color: var(--text);
}

.advanced-controls {
  width: 100%;
}

.advanced-controls summary,
.advanced-section summary,
.compact-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green-2);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.advanced-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  min-width: 0;
}

select,
input[type="number"] {
  min-height: 38px;
  min-width: 144px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

select:focus,
input[type="number"]:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(64, 240, 118, 0.12);
}

.toggle-row {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.summary-grid article {
  position: relative;
  min-height: 112px;
  padding: 14px;
  overflow: hidden;
}

.summary-grid article::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -54px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  border: 1px solid rgba(16, 163, 74, 0.12);
}

.summary-grid span {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-grid strong {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.15;
}

.workspace {
  align-items: stretch;
  margin-top: 12px;
}

.workspace:not(.lower) {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  align-items: start;
}

.workspace:not(.lower) .side-panel {
  grid-column: 1;
  grid-row: 1;
  width: auto;
}

.workspace:not(.lower) .main-panel {
  grid-column: 2;
  grid-row: 1;
}

.main-panel {
  min-width: 0;
  flex: 1;
  padding: 16px;
}

.side-panel {
  min-width: 0;
  width: 360px;
  padding: 16px;
}

.lower .side-panel {
  width: 320px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

th,
td {
  padding: 12px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3),
th:nth-child(6),
td:nth-child(6) {
  display: none;
}

.strategy-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
}

.strategy-cell .lucide,
.allocation-row .lucide,
.timeline .lucide {
  color: var(--green);
}

.protocol-badge,
.asset-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 900;
}

.source-label {
  display: block;
  margin-top: 5px;
  font-size: 0.7rem;
}

.protocol-badge {
  background: rgba(16, 163, 74, 0.08);
  color: var(--green);
  border: 1px solid rgba(16, 163, 74, 0.16);
}

.asset-chip {
  margin-right: 4px;
  background: rgba(180, 215, 46, 0.13);
  color: var(--yellow);
  border: 1px solid rgba(180, 215, 46, 0.22);
}

.apy-value {
  color: var(--green);
}

.risk-low {
  background: rgba(16, 163, 74, 0.1);
  color: var(--green);
}

.risk-medium {
  background: rgba(180, 215, 46, 0.16);
  color: var(--yellow);
}

.risk-high {
  background: rgba(255, 157, 77, 0.16);
  color: #ffb36c;
}

.risk-degen,
.risk-perps {
  background: rgba(255, 93, 93, 0.14);
  color: var(--red);
}

.decision-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(16, 163, 74, 0.18);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 22px;
  overflow: hidden;
}

.side-panel > .decision-card {
  margin-bottom: 12px;
}

.decision-card::after {
  content: "NFA";
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(16, 163, 74, 0.08);
  font-size: 3rem;
  font-weight: 1000;
}

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

.decision-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--green);
}

.decision-action {
  margin-bottom: 0;
  color: var(--green);
  font-weight: 1000;
  text-transform: uppercase;
}

.allocation,
.wallet-balances {
  margin-bottom: 22px;
}

.wallet-balances {
  display: grid;
  gap: 8px;
}

.balance-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.balance-row span {
  font-weight: 900;
}

.balance-row b {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.allocation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 900;
}

.allocation-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.allocation-row .lucide {
  width: 16px;
  height: 16px;
}

.allocation p {
  margin: 7px 0 12px;
  font-size: 0.88rem;
}

.bar {
  height: 9px;
  overflow: hidden;
  background: #e8f1e8;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.bar.secondary span {
  background: var(--yellow);
}

.bar.tertiary span {
  background: var(--soil);
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.timeline .lucide {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.timeline span,
.timeline small {
  display: block;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: clamp(220px, 32vw, 320px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fcf4 100%);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  margin: 0;
}

.metrics dt {
  color: var(--muted);
}

.metrics dd {
  margin: 0;
  font-weight: 900;
  color: var(--text);
}

.swap-planner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
}

.swap-planner label,
.swap-planner select,
.swap-planner input {
  width: 100%;
  min-width: 0;
}

.swap-planner .icon-button,
.swap-planner .primary-button {
  width: 100%;
  min-width: 0;
}

.swap-result {
  margin-top: 14px;
}

.chart-section {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.faq-section {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
}

.faq-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.faq-heading h2 {
  margin-bottom: 0;
}

.faq-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.faq-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.faq-flow article {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(16, 163, 74, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfff8 0%, #ffffff 100%);
}

.faq-flow span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-bottom: 10px;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(180, 215, 46, 0.16);
  color: var(--green-2);
  font-size: 0.72rem;
  font-weight: 1000;
}

.faq-flow strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.98rem;
}

.faq-flow p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

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

.faq-grid details {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.faq-grid summary {
  cursor: pointer;
  padding: 14px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 1000;
  list-style-position: inside;
}

.faq-grid p {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
}

.chart-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.chart-heading h2 {
  margin-bottom: 5px;
}

.chart-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.chart-live-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(16, 163, 74, 0.2);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--green-2);
  background: #ffffff;
  font-size: 0.74rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.advanced-section {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.advanced-section > .workspace {
  margin-top: 12px;
}

.compact-details {
  padding-top: 4px;
}

.compact-details h2 {
  margin-top: 16px;
}

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

  .workspace,
  .workspace:not(.lower) {
    display: flex;
    flex-direction: column;
  }

  .workspace:not(.lower) .side-panel,
  .workspace:not(.lower) .main-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .wallet-panel {
    justify-content: flex-start;
    min-height: 0;
  }

  .header-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .side-panel,
  .lower .side-panel {
    width: 100%;
  }

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

}

@media (max-width: 640px) {
  .shell {
    width: 100%;
    padding: 14px;
    margin: 0;
    min-height: 100vh;
    border-radius: 0;
  }

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

  .title-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .title-art {
    width: 82px;
  }

  .brand-subtitle {
    max-width: none;
    font-size: 0.9rem;
  }

  .wallet-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    order: -1;
  }

  .tab-button {
    width: 100%;
    min-width: 0;
    min-height: 36px;
  }

  .wallet-panel > #tonConnectButton {
    width: 100%;
  }

  .wallet-panel > #tonConnectButton > * {
    width: 100%;
  }

  .status-pill {
    justify-content: center;
    width: 100%;
  }

  .language-control select {
    width: 100%;
  }

  .trust-strip span {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  select,
  input[type="number"],
  .primary-button,
  .icon-button,
  .secondary-button {
    width: 100%;
    min-width: 0;
  }

  .control-strip > label {
    max-width: none;
  }

  .advanced-controls-grid,
  .swap-planner {
    grid-template-columns: 1fr;
  }

  .main-panel,
  .side-panel,
  .chart-section,
  .faq-section {
    padding: 12px;
  }

  .chart-heading,
  .faq-heading {
    align-items: start;
    gap: 10px;
  }

  .faq-flow,
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 12px;
  }

  h1 {
    font-size: clamp(1.72rem, 8.6vw, 2.25rem);
  }

  .title-art {
    width: 58px;
  }

  .trust-strip span {
    flex-basis: 100%;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 0.84rem;
  }
}
