:root {
  --bg-color: #131722;
  --panel-bg: #1E222D;
  --border-color: #2A2E39;
  --grid-color: #1a1e28;
  --text-primary: #D1D4DC;
  --text-secondary: #787B86;
  --up-color: #26A69A;
  --down-color: #EF5350;
  --line-color: #2962FF;
  --btn-bg: #2A2E39;
  --btn-hover: #363A45;
}

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

body,
html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.header {
  height: 60px;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.ticker-info {
  display: flex;
  align-items: center;
  gap: 24px;
}

.symbol-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.symbol-icon {
  background-color: #F7931A;
  /* Bitcoin Orange */
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.symbol-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.price-container {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.price-value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.price-diff {
  font-size: 14px;
  font-weight: 500;
}

.up {
  color: var(--up-color) !important;
}

.down {
  color: var(--down-color) !important;
}

.toolbar {
  display: flex;
  align-items: center;
}

.toolbar-group {
  display: flex;
  gap: 12px;
}

.tool-btn {
  background: var(--btn-bg);
  border: 1px solid transparent;
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: var(--btn-hover);
}

.tool-btn:active {
  transform: scale(0.98);
}

.tool-btn.active {
  background: rgba(41, 98, 255, 0.1);
  color: var(--line-color);
}

.chart-container {
  flex: 1;
  position: relative;
  width: 100%;
}

#chart-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.instruction-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.4s ease;
  z-index: 5;
}

.instruction-box {
  background: rgba(30, 34, 45, 0.8);
  backdrop-filter: blur(8px);
  padding: 24px 32px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.instruction-box p {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.instruction-box span {
  font-size: 14px;
  color: var(--text-secondary);
}

.hidden {
  opacity: 0 !important;
  pointer-events: none;
}

#settings-btn {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: -8px;
  transition: background 0.2s;
}

#settings-btn:hover {
  background: var(--btn-hover);
}

.settings-icon {
  opacity: 0.5;
  transition: opacity 0.2s;
}

#settings-btn:hover .settings-icon {
  opacity: 1;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background-color: var(--border-color);
  margin: 0 4px;
}

.tool-btn.icon-only {
  padding: 8px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin-bottom: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-group input {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  width: 100%;
}

.form-group input:focus {
  border-color: var(--line-color);
}

.form-group input[type="color"] {
  height: 40px;
  padding: 4px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.tool-btn.primary {
  background: var(--line-color);
  color: #fff;
}

.tool-btn.primary:hover {
  background: #1e4bd8;
}

.analytics-container {
  display: flex;
  gap: 24px;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 1px solid var(--border-color);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.buy-btn-style {
  background: rgba(38, 166, 154, 0.1);
  color: var(--up-color);
  border: 1px solid rgba(38, 166, 154, 0.3);
}

.buy-btn-style:hover {
  background: rgba(38, 166, 154, 0.2);
}

.positions-overlay {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(30, 34, 45, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 260px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.close-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
}

.close-icon:hover {
  color: #fff;
}

.pos-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.pos-label {
  color: var(--text-secondary);
}

.pos-val {
  color: var(--text-primary);
  font-weight: 500;
}

.pnl-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dotted var(--border-color);
  font-size: 14px;
}

.pnl-row .pos-val {
  font-weight: 700;
}

.pos-list {
  max-height: 200px;
  overflow-y: auto;
  border-bottom: 1px dotted var(--border-color);
}

.pos-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.pos-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

.pos-item-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.pos-item-close:hover {
  color: var(--down-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.creator-dropdown {
  position: relative;
}

.dropdown-btn {
  display: flex;
  align-items: center;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 180px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.2s ease;
  z-index: 100;
}

.creator-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: var(--btn-hover);
}

.dropdown-item img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}