/* Liquidation Heatmap Pro - themes via CSS vars */

:root {
  --bg: #050508;
  --surface: #0c0e14;
  --surface-2: #111318;
  --border: #1a1d26;
  --text: #e2e4e9;
  --text-muted: #6b7280;
  --accent: #06b6d4;
  --accent-dim: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.35);
  --emerald: #10b981;
  --gradient-start: #06b6d4;
  --gradient-mid: #8b5cf6;
  --gradient-end: #ec4899;
}

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

input[type="checkbox"] {
  accent-color: var(--accent);
}

body {
  font-family: 'Geist', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  min-height: 100vh;
  -webkit-overflow-scrolling: touch;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 12px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  gap: 16px;
  overflow: hidden;
}

.header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.leverage-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.leverage-strip .leverage-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.leverage-strip .leverage-chip {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.leverage-strip .leverage-chip:hover {
  border-color: var(--accent-dim);
}

.leverage-strip .leverage-chip.checked {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent);
}

.leverage-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.leverage-check input {
  cursor: pointer;
  accent-color: var(--accent);
}

.tooltip-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
}
.tooltip-toggle:has(input:checked) {
  opacity: 1;
  border-color: var(--accent-dim);
}
.tooltip-toggle:hover {
  border-color: var(--accent-dim);
  opacity: 1;
}
.tooltip-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.tooltip-toggle-icon {
  font-size: 16px;
  line-height: 1;
}

.leverage-checkboxes-modal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leverage-checkboxes-modal .leverage-check {
  font-size: 13px;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.header-logo {
  height: 28px;
  width: auto;
  display: block;
}

.header-title-text {
  font-family: 'Unbounded', 'Geist', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}

.header-title-gradient {
  font-family: 'Unbounded', 'Geist', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-scale-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: default;
}

.header-scale-slider {
  width: 72px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface-2);
  border-radius: 3px;
  cursor: pointer;
}

.header-scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}

.header-scale-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.header-scale-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.header-scale-value {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}

.select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select:hover {
  border-color: var(--accent-dim);
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Scrollbar для select в цветах темы */
.select::-webkit-scrollbar {
  width: 8px;
}
.select::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 4px;
}
.select::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 4px;
}
.select::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
select.select {
  scrollbar-color: var(--accent-dim) var(--surface);
  scrollbar-width: thin;
}
select.select option {
  background: var(--surface);
  color: var(--text);
}

#timeframeSelect {
  min-width: 60px;
  flex-shrink: 0;
}

.lang-btn {
  font-size: 11px;
  font-weight: 600;
  min-width: 32px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: rgba(6, 182, 212, 0.08);
}

/* Layout dropdown */
.layout-dropdown-wrap {
  position: relative;
}
.layout-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.layout-dropdown.hidden {
  display: none;
}
.layout-opt {
  display: block;
  width: 100%;
  padding: 8px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.layout-opt:hover {
  background: var(--surface-2);
}
.layout-opt.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent);
}

/* Charts grid (multi-window) */
.charts-grid {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 200px;
  min-width: 0;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}
.charts-grid-1x1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.charts-grid-2x1 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}
.charts-grid-1x2 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}
.charts-grid-2x2 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
}
.chart-panel .chart-row {
  flex: 1;
  min-height: 0;
}
.chart-panel .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.chart-panel .panel-toolbar .select {
  padding: 4px 8px;
  font-size: 12px;
}
.charts-grid-1x1 .chart-panel .panel-toolbar {
  display: none;
}

.chart-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.chart-row {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  min-height: 200px;
  overflow: hidden;
}

.chart-container {
  flex: 1;
  min-width: 0;
  min-height: 200px;
  position: relative;
  width: 100%;
  overflow: hidden;
}
.chart-container > div:first-child {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

.price-scale {
  flex-shrink: 0;
  width: 65px;
  position: relative;
  font-size: 11px;
  font-weight: 500;
  color: #ffffff;
  background: var(--surface);
  border-left: 1px solid var(--border);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.price-scale span {
  position: absolute;
  left: 8px;
  transform: translateY(-50%);
  white-space: nowrap;
  line-height: 1;
}

.hidden {
  display: none !important;
}

.no-liquidations-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 24px;
  background: rgba(12, 14, 20, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  max-width: 360px;
  z-index: 10;
  pointer-events: none;
}

.chart-watermark {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 10;
  opacity: 0.5;
  pointer-events: none;
}
.chart-watermark {
  width: 90px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-watermark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0.9);
}

.chart-watermark-panel {
  bottom: auto;
  right: auto;
}
.chart-symbol-watermark,
[data-panel-sym] {
  position: absolute;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-family: 'JetBrains Mono', 'Geist Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: rgba(226, 228, 233, 0.88);
  letter-spacing: 0.05em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
[data-panel-sym] {
  font-size: clamp(11px, 1.6vw, 16px);
}

.slider-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  margin-left: 4px;
  position: relative;
}
.slider-help:hover { background: var(--accent); color: var(--bg); }

.slider-tooltip-popup {
  position: fixed;
  left: -999px;
  top: 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: normal;
  max-width: 280px;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.slider-tooltip-popup.visible {
  opacity: 1;
}

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.chart-wrapper {
  opacity: 1;
  transition: opacity 0.35s ease;
}
.chart-wrapper.chart-animate-in {
  animation: chartFadeIn 0.5s ease-out forwards;
}
@keyframes chartFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content-wide { max-width: 580px; }

#infoModal .modal-content {
  max-width: min(900px, 96vw);
  width: 100%;
  max-height: 85vh;
  max-height: 85dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#infoModal .modal-body {
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.info-modal-body {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 32px;
}
.info-modal-col {
  min-width: 0;
}
.info-modal-body h4 {
  margin: 18px 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.info-modal-body h4:first-child { margin-top: 0; }
.info-modal-body p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.info-modal-body .info-settings-list {
  margin: 10px 0;
  padding-left: 20px;
  list-style: none;
}
.info-modal-body .info-settings-list li {
  position: relative;
  margin: 10px 0;
  padding-left: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.info-modal-body .info-settings-list li::before {
  content: '›';
  position: absolute;
  left: -4px;
  color: var(--accent);
  font-weight: 600;
}
#infoModal .modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#infoModal .modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}
#infoModal.open {
  align-items: center;
  justify-content: center;
}
@media (max-height: 600px) {
  .info-modal-body { font-size: 12px; }
  .info-modal-body h4 { font-size: 12px; }
  .info-modal-body p,
  .info-modal-body .info-settings-list li { font-size: 12px; }
}
@media (max-height: 480px) {
  .info-modal-body { font-size: 11px; }
  .info-modal-body h4 { font-size: 11px; }
  .info-modal-body p,
  .info-modal-body .info-settings-list li { font-size: 11px; }
}
@media (max-width: 640px) {
  .info-modal-body { grid-template-columns: 1fr; }
}

.cache-coverage-hint {
  position: absolute;
  bottom: 8px;
  left: 8px;
  padding: 4px 10px;
  background: rgba(12, 14, 20, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 8;
  cursor: help;
}

.tooltip {
  position: absolute;
  top: -100px;
  left: -100px;
  padding: 12px 16px;
  background: rgba(12, 14, 20, 0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.highlight-tooltip {
  position: absolute;
  padding: 10px 14px;
  background: rgba(30, 35, 45, 0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  color: var(--text);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 100;
}
.highlight-tooltip-value {
  color: var(--accent);
  font-weight: 600;
}
.highlight-tooltip-label {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
  display: block;
}

.tooltip-label {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tooltip-value {
  color: var(--accent);
  font-weight: 600;
}

.loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(4px);
  z-index: 50;
  transition: opacity 0.3s ease;
}

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

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader span {
  font-size: 13px;
  color: var(--text-muted);
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.legend-label {
  font-size: 11px;
  color: var(--text-muted);
}

.legend-gradient {
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--gradient-start) 0%,
    var(--gradient-mid) 50%,
    var(--gradient-end) 100%
  );
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
  z-index: 1000;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px;
}
.modal.open {
  display: flex;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.5);
}
.modal.open .modal-content {
  pointer-events: auto;
}

.modal-content {
  position: absolute;
  left: 20px;
  top: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-content .modal-header {
  cursor: grab;
  user-select: none;
}
.modal-content .modal-header:active {
  cursor: grabbing;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.settings-section {
  margin-bottom: 24px;
}
.settings-section:last-child { margin-bottom: 0; }

.settings-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.setting-row label {
  flex: 0 0 120px;
  font-size: 13px;
}
.setting-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.setting-row input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}
.setting-row input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--surface-2);
}
.setting-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.setting-row input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: none; }
.setting-row .select {
  flex: 1;
  min-width: 0;
}
.setting-row span {
  flex: 0 0 45px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
.setting-row .candle-color-value {
  flex: 0 0 70px;
  font-family: 'Geist Mono', monospace;
}

.leverage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}

.leverage-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.leverage-checkbox:hover {
  border-color: var(--accent-dim);
}
.leverage-checkbox input {
  accent-color: var(--accent);
  cursor: pointer;
}
.leverage-checkbox.checked {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 8px;
}
.checkbox-label input {
  accent-color: var(--accent);
  cursor: pointer;
}

.exchange-checkboxes-modal {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  min-height: 80px;
}
.exchange-checkboxes-modal .checkbox-label {
  margin-bottom: 0;
}
.settings-section-first {
  padding-top: 0;
}

.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.leverage-strip .select {
  min-width: 140px;
}

/* Share modal */
.share-modal .modal-content {
  max-width: 440px;
}

.contacts-modal-body {
  padding: 20px 24px;
}

.contacts-intro {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.contact-link:hover {
  border-color: var(--accent-dim);
  background: rgba(6, 182, 212, 0.08);
}

.contact-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.contact-link span:not(.contact-icon):not(.contact-url) {
  flex: 1;
  font-weight: 500;
}

.contact-url {
  font-size: 13px;
  color: var(--accent);
}

.share-modal-content .modal-body {
  padding: 16px 20px;
}

.share-section {
  margin-bottom: 20px;
}

.share-section:last-child {
  margin-bottom: 0;
}

.share-section h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.share-btn:hover {
  border-color: var(--accent-dim);
  background: rgba(6, 182, 212, 0.08);
}

.share-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.embed-code {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  font-family: 'Geist Mono', 'JetBrains Mono', monospace;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.embed-code code {
  font-size: inherit;
}

.share-social-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.share-social-grid-icons {
  grid-template-columns: repeat(4, 1fr);
}

.share-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.share-social-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: rgba(6, 182, 212, 0.08);
}

.share-social-icon {
  padding: 12px;
}

.share-social-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Touch-friendly */
button, .icon-btn, .select, .leverage-check, a {
  -webkit-tap-highlight-color: rgba(6, 182, 212, 0.2);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .app {
    padding: 8px;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    gap: 10px;
  }

  .header {
    padding: 10px 12px;
  }

  .layout-dropdown-wrap {
    display: none;
  }

  .header-main {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-title-row {
    justify-content: center;
  }

  .header-title-text {
    font-size: 0.9rem;
  }

  .header-title-gradient {
    font-size: 0.9rem;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .leverage-strip {
    justify-content: center;
  }

  .select {
    min-width: 0;
  }

  .leverage-strip .select {
    min-width: 0;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    min-width: 40px;
  }

  .chart-wrapper {
    min-height: 0;
  }

  .chart-row {
    min-height: 280px;
    flex: 1;
  }

  .chart-container {
    min-height: 280px;
    min-width: 0;
  }

  .price-scale {
    width: 50px;
    font-size: 10px;
  }

  .legend-gradient {
    width: 80px;
  }

  .modal-content {
    left: 10px;
    right: 10px;
    top: 10px;
    max-height: 85vh;
    width: auto;
  }

  .share-modal .modal-content {
    max-width: none;
  }

  .share-social-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Landscape phone: low viewport height — chart must shrink to fit */
@media (max-height: 500px) {
  .chart-row,
  .chart-container {
    min-height: 100px;
  }
}

@media (max-width: 480px) {
  .header-title-text {
    font-size: 0.75rem;
  }

  .header-logo {
    height: 24px;
  }

  .header-title-gradient {
    font-size: 0.8rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 16px;
  }

  .chart-row {
    min-height: 220px;
  }

  .chart-container {
    min-height: 220px;
  }
}

@media (max-width: 480px) and (max-height: 500px) {
  .chart-row,
  .chart-container {
    min-height: 80px;
  }

  .price-scale {
    width: 44px;
    font-size: 9px;
  }

  .select {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Cookie consent */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 10000;
  animation: slideUp 0.4s ease-out;
}
.cookie-consent.hidden {
  display: none;
}
.cookie-consent-content {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.cookie-consent-text {
  flex: 1;
  min-width: 200px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.cookie-consent-actions {
  display: flex;
  gap: 12px;
}
.cookie-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.cookie-btn-accept {
  background: var(--accent);
  color: var(--bg);
}
.cookie-btn-accept:hover {
  background: var(--accent-dim);
}
.cookie-btn-decline {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.cookie-btn-decline:hover {
  border-color: var(--text-muted);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
