@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap');


:root {
  --bg: #101010;
  --bg-elevated: #0c1016;
  --bg-elevated-soft: #121822;
  --border-subtle: rgb(242,242,242);
  --accent: rgb(212,212,212);
  --accent-soft: rgba(242,242,242, 0.12);
  --danger: #ff4d6a;
  --text: rgb(212,212,212);
  --text-soft: rgb(161,161,161);
  --text-muted: rgb(122,122,122);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  /*--fontfam-term: monospace;*/
  --fontfam-term: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  /*font-family: var(--font-sans);*/
  /*background: radial-gradient(circle at top, #121826 0, #05070a 55%);*/
  background: rgb(10,10,10);
  color: var(--text);
  font-family: "Geist", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

a {
  color: var(--text-soft);
  text-decoration: underline;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
  color: var(--accent); 
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, text-decoration 0.3s ease;
}

/* Layout */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  /*border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(to right, #05070a, #0b1019);*/
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 38px;
  width: auto;
}

.logo-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.env-tag {
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  /*border-radius: 999px;
  border: 1px solid var(--border-subtle);*/
  color: var(--accent);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.market-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: none;
}

.market-select {
  background: rgba(0,0,0,0);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 10px 20px;
  font-size: 0.85rem;
display: none;
}

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

.wallet-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.network-indicator {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  /*border-radius: 999px;
  background: #111827;*/
  color: var(--text-soft);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 10px;
  padding: 0px 6px;
  min-height: calc(100vh - 120px);
}

.panel {
  /*background: radial-gradient(circle at top left, #151b28 0, #05070a 65%);*/
  background: rgb(18,18,18);
  border-radius: 16px;
  /*border: 1px solid rgba(148, 163, 184, 0.18);*/
  padding: 16px;
  /*box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);*/
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
}

.panel-subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Reference price pill (orderbook header right side) */
.reference-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 10px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  /*background: rgba(242,242,242, 0.08);*/
  background: rgb(10,10,10);
}

.reference-display {
  color: var(--text-soft);
}

.reference-price {
  font-family: var(--fontfam-term);
  color: var(--accent);
}

/* Token pair */

.token-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  /*background: rgba(17, 24, 39, 0.9);*/
  font-size: 0.8rem;
  display: none;
}

.token-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.token-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #101010;
}

.pair-separator {
  opacity: 0.6;
}

/* Orderbook */

.orderbook {
  display: block;           /* no need for flex here anymore */
  margin-top: 0.5rem;
  border-radius: 6px;
  background-color: rgb(10,10,10);
  padding: 20px;
}

.orderbook-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;      /* ensures matching column widths */

  /*border-top: 1px solid rgba(148,163,184,0.05);*/
  border-bottom: 1px solid rgba(148,163,184,0.05);
}

.orderbook-table thead {
  color: var(--text-muted);
  border-bottom: 1px solid rgba(148,163,184,0.05);
}

.orderbook-table th,
.orderbook-table td {
  padding: 0.18rem 0.15rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.orderbook-table th:first-child,
.orderbook-table td:first-child {
  /*text-align: left;*/         /* price + mid label left, everything else right */
}

/* Mid row now inside the table */
.mid-row td {
  padding-top: 4px;
  padding-bottom: 4px;
  border-top: 1px solid rgba(148,163,184,0.05);
  border-bottom: 1px solid rgba(148,163,184,0.05);
  font-size: 0.75rem;
}

.mid-label-cell {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.mid-price-cell {
  /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;*/
  font-family: var(--fontfam-term);
  font-size: 0.8rem;
  color: var(--accent);
  text-align: right;       /* aligns to the Price column */
}

/* Keep your bid/ask coloring */
.bid-row td:first-child {
  color: #4ade80;
}

.ask-row td:first-child {
  color: #fb7185;
}

.orderbook-table tbody tr {
  font-family: var(--fontfam-term);
  font-size: 0.8rem;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.orderbook-table tbody tr.bid-row,
.orderbook-table tbody tr.ask-row {
  cursor: pointer;
}

.orderbook-table tbody tr.bid-row:hover,
.orderbook-table tbody tr.ask-row:hover {
  background: rgba(242, 242, 242, 0.16);
}


.mid-price {
  /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;*/
  font-family: var(--fontfam-term);
  font-size: 0.8rem;
  color: var(--accent);
}


/* Trade panel */

.trade-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.order-form {
  border-radius: 6px;
  /*border: 1px solid rgba(148, 163, 184, 0.25);*/
  padding: 0.75rem;
  /*background: rgba(15, 23, 42, 0.8);*/
  background: rgb(10,10,10);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}

.form-row label {
  font-size: 0.75rem;
  color: var(--text-soft);

align-content: flex-start;
align-items: flex-start;
box-sizing: border-box;
column-gap: 10px;
cursor: default;
display: flex;
flex-basis: auto;
flex-direction: column;
flex-grow: 0;
flex-shrink: 0;
/*flex-wrap: nowrap;*/
font-family: sans-serif;
font-size: 12px;
height: 80.7969px;
justify-content: flex-start;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
position: relative;
row-gap: 10px;
}

.form-input-wrapper {
background-attachment:scroll;
background-clip:border-box;
background-color:rgb(10, 10, 10);
background-image:none;
background-origin:padding-box;
background-position-x:0%;
background-position-y:0%;
background-repeat:repeat;
background-size:auto;
border-bottom-left-radius:16px;
border-bottom-right-radius:16px;
border-top-left-radius:16px;
border-top-right-radius:16px;
box-shadow:none;
box-sizing:border-box;
corner-bottom-left-shape:round;
corner-bottom-right-shape:round;
corner-top-left-shape:round;
corner-top-right-shape:round;
cursor:default;
display:block;
flex-basis:auto;
flex-grow:0;
flex-shrink:0;
font-family:sans-serif;
font-size:12px;
height:51.1953px;
overflow-x:hidden;
overflow-y:hidden;
position:relative;
transition-behavior:normal;
transition-delay:0s;
transition-duration:0s;
transition-property:background, box-shadow;
transition-timing-function:ease;
unicode-bidi:isolate;
width:100%;
}

.form-row input {
  /*background: #020617;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.4rem 0.55rem;
  color: var(--text);
  font-size: 0.85rem;*/

appearanceauto
background-attachment:scroll;
background-clip:border-box;
background-color:rgba(0, 0, 0, 0);
background-image:none;
background-origin:padding-box;
background-position-x:0px;
background-position-y:0px;
background-repeat:repeat;
background-size:auto;
border-bottom-color:rgb(255, 255, 255);
border-bottom-style:none;
border-bottom-width:0px;
border-image-outset:0;
border-image-repeat:stretch;
border-image-slice:100%;
border-image-source:none;
border-image-width:1;
border-left-color:rgb(255, 255, 255);
border-left-style:none;
border-left-width:0px;
border-right-color:rgb(255, 255, 255);
border-right-style:none;
border-right-width:0px;
border-top-color:rgb(255, 255, 255);
border-top-style:none;
border-top-width:0px;
box-sizing:border-box;
color:rgb(255, 255, 255);
cursor:text;
display:inline-block;
font-family:Geist;
font-feature-settings:normal;
font-kerning:auto;
font-optical-sizing:auto;
font-size:16px;
font-size-adjust:none;
font-stretch:100%;
font-style:normal;
font-variant-alternates:normal;
font-variant-caps:normal;
font-variant-east-asian:normal;
font-variant-emoji:normal;
font-variant-ligatures:normal;
font-variant-numeric:normal;
font-variant-position:normal;
font-variation-settings:normal;
font-weight:400;
height:51.1953px;
letter-spacing:normal;
line-height:19.2px;
margin-bottom:0px;
margin-left:0px;
margin-right:0px;
margin-top:0px;
overflow-clip-margin:0px;
overflow-x:clip;
overflow-y:clip;
padding-block-end:16px;
padding-block-start:16px;
padding-bottom:16px;
padding-inline-end:20px;
padding-inline-start:20px;
padding-left:20px;
padding-right:20px;
padding-top:16px;
text-align:start;
text-indent:0px;
text-overflow:ellipsis;
text-rendering:auto;
text-shadow:none;
text-transform:none;
text-wrap-mode:nowrap;
white-space-collapse:collapse;
width:100%;
word-spacing:0px;

    /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;*/
  font-family: var(--fontfam-term);
}

.form-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row input::-webkit-outer-spin-button,
.form-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-row input[type="number"] {
  -moz-appearance: textfield;
}

.form-row-inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

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

#order-notional {
    /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;*/
  font-family: var(--fontfam-term);
}

.toggle-group {
  display: inline-flex;
  /*background: #020617;*/
  padding: 0.15rem;
  border-radius: 10px;
  /*border: 1px solid rgba(242,242,242, 0.5);*/
  margin-bottom: 0.6rem;
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  padding: 6px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.toggle-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-btn.buy {
  /*border-radius: 5px; 0 0 5px;*/
  transition: background-color 0.3s ease, color 0.3s ease;
}

.toggle-btn.active.buy {
  background: #1CAC72;
}

.toggle-btn.buy:hover {
  background: #1CAC72;
  color: var(--accent);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.toggle-btn.sell {
  margin-left: 5px;
  /*border-radius: 0 5px 5px 0;*/
  transition: background-color 0.3s ease, color 0.3s ease;
}

.toggle-btn.active.sell {
  background: rgb(172, 42, 28);
}

.toggle-btn.sell:hover {
  background: rgb(172, 42, 28);
  color: var(--accent);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.form-hint,
.form-mins {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Balances & activity */

.balances,
.activity {
  border-radius: 0.75rem;
  /*border: 1px solid rgba(148, 163, 184, 0.2);*/
  padding: 0.6rem 0.7rem;
  /*background: rgba(15, 23, 42, 0.7);*/
  background: rgb(10,10,10);
}

.balances h3,
.activity h3 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
}

.balance-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.balance-value {
  /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;*/
  font-family: var(--fontfam-term);
}

.activity-log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
  max-height: 120px;
  overflow-y: auto;
}

.activity-log li + li {
  margin-top: 0.2rem;
}

/* Footer */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.5rem 0.9rem;
  /*border-top: 1px solid var(--border-subtle);*/
  font-size: 14px;
  color: var(--text-muted);
  /*background: #020617;*/
}

.footer-left {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-note {
  opacity: 0.8;
  /*color: #fb7185;*/
  color: #FBA271;
}

.footer-right {
  display: flex;
  gap: 0.75rem;
}

.footer-right a {
  color: var(--text-soft);
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.footer-right a:hover {
  color: var(--accent);
  
}

/* Buttons */

.btn {
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  /*transition: transform 0.05s ease, box-shadow 0.05s ease,
    background 0.15s ease, color 0.15s ease;*/
  border-color: rgb(242,242,242);
  border-width: 1px;
  border-style: solid;
  background-color: transparent;
  color: rgb(242,242,242);
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.btn.primary-btn {
  /*background: var(--accent);*/
  /*color: #020617;*/
  /*box-shadow: 0 8px 20px rgba(59, 130, 246, 0.45);*/
}

.btn.primary-btn:hover {
  filter: brightness(1.05);
  color: rgb(10,10,10);
  background-color: rgb(242,242,242);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.btn.ghost-btn {
  border: 1px solid var(--border-subtle);
  /*color: var(--text-soft);*/
}

.btn.ghost-btn:hover {
  filter: brightness(1.05);
  color: rgb(10,10,10);
  background-color: rgb(242,242,242);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.btn.full-width {
  width: 100%;
}

/* Modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.modal {
  background: #101010;
  border-radius: 0.9rem;
  padding: 1rem 1.1rem;
  width: 100%;
  max-width: 380px;
  /*border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);*/
}

.modal h3 {
  margin-top: 0;
  margin-bottom: 0.55rem;
}

.modal p {
  margin-top: 0;
  font-size: 0.85rem;
}

.confirm-details {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tx-hash-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tx-hash {
  font-size: 0.78rem;
  /*font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;*/
  font-family: var(--fontfam-term);
  word-break: break-all;
}

/* Responsive */

@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-header {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .top-nav {
    order: 3;
  }
}




/* Shared overlay container */
.market-overlay,
.wallet-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
  width: 100%;
}

.market-overlay.visible,
.wallet-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Shared backdrop */
.market-overlay-backdrop,
.wallet-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10);
}

/* Content, header, list, etc stay exactly as you had */
.market-overlay-content {
  position: relative;
  margin-top: 40px;          /* appears from top of page */
  width: 100%;
  max-width: 640px;
  background: rgb(10,10,10);
  border-radius: 16px;
  padding: 16px 20px 12px;
  transform: translateY(-6px);
  transition: transform 200ms ease-out;
}

.market-overlay.visible .market-overlay-content,
.wallet-overlay.visible .market-overlay-content {
  transform: translateY(0);
}

.market-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.market-overlay-title h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.market-overlay-title p {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.market-overlay-close-btn {
  font-size: 0.8rem;
  padding-inline: 0.8rem;
}

/* List style reused for both markets and wallets */
.market-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.market-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.2rem;
  border-bottom: 1px solid rgba(148,163,184,0.18);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.market-list-item:hover {
  background-color: rgb(242,242,242);
  color: rgb(10,10,10);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.market-list-item:last-child {
  border-bottom: none;
}

.market-list-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.market-list-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.market-list-symbols {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.market-list-network {
  font-size: 0.75rem;
  color: var(--text-muted);
}




/* Make the orderbook title clickable */
#market-title {
  display: flex;              /* makes icon + text align nicely */
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

#market-title::before{
  content: "";
  width: 1em;              /* scales with font-size */
  height: 1em;
  background: currentColor; /* icon color */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

#market-title:hover {
  background-color: rgb(242,242,242);
  color: rgb(10,10,10);
  transition: background-color 0.3s ease, color 0.3s ease;
}


.wallet-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0.75rem;
  max-height: 240px;
  overflow-y: auto;
}

.wallet-item {
  border-radius: 0.55rem;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.3rem;
  background: rgb(10,10,10);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
}

.wallet-item:hover {
  background: rgba(242,242,242,0.08);
}

.wallet-item-name {
  font-weight: 500;
}

.wallet-item-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wallet-list-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wallet-hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}


[hidden] {
  display: none !important;
}
