:root{
  --bg:#000000;
  --phone:#0b0b0d;

  --surface: rgba(255,255,255,0.03);
  --surface-2: rgba(255,255,255,0.05);

  --border: rgba(255,255,255,0.09);
  --border-2: rgba(255,255,255,0.07);

  --text:#f2f2f7;
  --muted: rgba(161,161,170,0.92);

  --r-card: 18px;
  --r-pill: 14px;

  --s-1: 8px;
  --s-2: 12px;
  --s-3: 16px;

  --shadow-card: 0 12px 26px rgba(0,0,0,0.35);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.05);
}

*{ box-sizing:border-box; }
html, body { height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 800px at 50% -200px, rgba(255,255,255,0.06), transparent 55%), var(--bg);
  color:var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px;
}

/* iPhone frame */
.phone{
  width:390px;
  height:844px;
  background:var(--phone);
  border-radius:56px;
  border:2px solid #1d1d1f;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.60),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  position:relative;
  overflow:hidden;
}
.bezel{
  position:absolute;
  inset:0;
  border-radius:56px;
  pointer-events:none;
  box-shadow: 0 0 0 8px rgba(0,0,0,0.85) inset;
}
.notch{
  position:absolute;
  top:0;
  left:50%;
  transform:translateX(-50%);
  width:165px;
  height:34px;
  background:#000;
  border-bottom-left-radius:22px;
  border-bottom-right-radius:22px;
  z-index:6;
}

/* status bar */
.statusbar{
  position:absolute;
  top:10px;
  left:18px;
  right:18px;
  height:24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  z-index:7;
  pointer-events:none;
}
.sb-time{ font-weight:800; font-size:13px; letter-spacing:0.2px; }
.sb-right{ display:flex; align-items:center; gap:8px; }

.signal{ display:flex; align-items:flex-end; gap:2px; height:12px; }
.signal span{ display:block; width:3px; border-radius:2px; background:rgba(242,242,247,0.9); }
.signal span:nth-child(1){ height:4px; opacity:0.55; }
.signal span:nth-child(2){ height:6px; opacity:0.65; }
.signal span:nth-child(3){ height:9px; opacity:0.80; }
.signal span:nth-child(4){ height:12px; opacity:0.95; }

.wifi{ width:16px; height:12px; position:relative; }
.wifi:before, .wifi:after{
  content:"";
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  border:2px solid rgba(242,242,247,0.9);
  border-color: rgba(242,242,247,0.9) transparent transparent transparent;
  border-radius:50%;
}
.wifi:before{ width:16px; height:16px; top:-8px; opacity:0.75; }
.wifi:after{ width:10px; height:10px; top:-5px; opacity:0.95; }
.wifi .dot{ position:absolute; width:3px; height:3px; border-radius:50%; background:rgba(242,242,247,0.95); left:50%; bottom:0; transform:translateX(-50%); }

.battery{ width:24px; height:12px; border:1.5px solid rgba(242,242,247,0.85); border-radius:3px; position:relative; }
.battery:after{ content:""; position:absolute; right:-3px; top:3px; width:2px; height:6px; border-radius:1px; background:rgba(242,242,247,0.85); }
.battery .level{ position:absolute; left:1px; top:1px; bottom:1px; width:70%; background:rgba(242,242,247,0.90); border-radius:2px; }

/* layout */
.screen{
  height:100%;
  padding:54px var(--s-3) var(--s-3) var(--s-3);
  display:flex;
  flex-direction:column;
  gap:var(--s-2);
}

/* unified card styling */
.toolbar,
#chartWrap,
#k2TradePanel,
#k2Results,
.k2-panel,
.k2-results{
  border-radius: var(--r-card) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-inset);
}

/* inputs/buttons baseline */
select, input, button{
  height:42px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  width:100%;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

select:focus, input:focus{
  border-color: rgba(255,255,255,0.16);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

button{
  background: rgba(255,255,255,0.06);
  font-weight: 1000;
  cursor: pointer;
}
button:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.10);
}
button:active{
  transform: scale(0.98);
}

/* toolbar */
.toolbar{
  position: sticky;
  top: 0;
  z-index: 80;
  padding: var(--s-2);
  display:flex;
  flex-direction:column;
  gap: 10px;
  background: rgba(10,10,12,0.78) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toolbarRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: var(--s-2);
}

.tickerBig{
  font-size: 22px;
  font-weight: 1000;
  letter-spacing: 0.4px;
  line-height: 1;
}

.toolbarRight{
  display:flex;
  align-items:center;
  gap: var(--s-1);
}
.toolbarRight #date{
  width: 140px;
  text-align: center;
}
.toolbarRight #modeBtn{
  width: 110px;
}

.searchWrap{
  display:flex;
  align-items:center;
  gap: 10px;
  height:42px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: rgba(0,0,0,0.35);
}
.searchIcon{
  color: rgba(242,242,247,0.55);
  font-size: 14px;
  line-height: 1;
}
#tickerSearch{
  border: none;
  background: transparent;
  padding: 0;
  height: 40px;
  width: 100%;
  outline: none;
}
#tickerSearch::placeholder{
  color: rgba(161,161,170,0.85);
}

/* keep hidden select for compatibility */
#ticker{
  display:none;
}

#status{
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px;
}

/* chart */
#chartWrap{
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #000000 0%, #050508 100%) !important;
  box-shadow: var(--shadow-inset), 0 10px 22px rgba(0,0,0,0.30);
}
#chart{ position:absolute; inset:0; }

/* empty state */
#empty{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 6px;
  color: rgba(242,242,247,0.55);
  font-size: 13px;
  pointer-events:none;
}
#empty::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background: rgba(242,242,247,0.35);
  box-shadow: 0 0 0 6px rgba(242,242,247,0.05);
}

/* bottom tabs */
.tabs{
  margin-top: var(--s-2);
  background: rgba(10,10,12,0.78);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 10px;
  display:flex;
  justify-content: space-between;
  gap: 6px;
  box-shadow: var(--shadow-inset);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tab{
  flex: 1;
  text-align:center;
  padding: 10px 8px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tab.active{
  color: var(--text);
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
}

/* hide scrollbars in results list (still scrollable) */
#k2TradesRows{
  scrollbar-width: none;
}
#k2TradesRows::-webkit-scrollbar{
  width: 0;
  height: 0;
}
