:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: #e8ecef;
  background: #090b10;
  --bg: #0d1117;
  --surface: rgba(22, 28, 36, 0.92);
  --surface-strong: rgba(18, 23, 31, 0.98);
  --border: rgba(148, 163, 184, 0.14);
  --text-muted: #8b95a1;
  --accent: #6d8cff;
  --accent-soft: rgba(109, 140, 255, 0.18);
  --shadow: 0 32px 120px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, rgba(109, 140, 255, 0.14), transparent 28%),
              radial-gradient(circle at bottom right, rgba(151, 100, 255, 0.12), transparent 30%),
              linear-gradient(180deg, #070a0f 0%, #0c1017 100%);
}

/* Improve touch scrolling behavior and reduce scroll-blocking warnings */
html, body, .main, .iframe-wrap, .tradingview-grid, .tv-panel, .tv-widget {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  font-size: 16px;
  line-height: 1.6;
  padding: 4px;
  color: var(--text-muted);
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: 84%;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 12px;
  z-index: 10;
  flex: 0 0 auto;
}

.header-left {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

button, .url-control input[type=text] {
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  font: inherit;
}

.shortcut-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.quick-button {
  background: rgba(255,255,255,0.04);
  color: #e6ebf3;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

.shortcut-delete {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  color: #d7dae0;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.shortcut-delete:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(109, 140, 255, 0.35);
  transform: translateY(-1px);
}

.quick-button.active,
.quick-button:hover {
  border-color: rgba(109, 140, 255, 0.45);
  background: rgba(109, 140, 255, 0.14);
  color: #f6f8ff;
  transform: translateY(-1px);
}

.url-control {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  min-width: 320px;
  flex: 1;
  align-items: center;
}

.home-button {
  background: rgba(255,255,255,0.06);
  color: #e6ebf3;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.home-button:hover {
  border-color: rgba(109, 140, 255, 0.45);
  background: rgba(109, 140, 255, 0.14);
  transform: translateY(-1px);
}

.url-control input[type=text] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.05);
  color: #f5f8ff;
  outline: none;
  min-width: 0;
}

.url-control input[type=text]::placeholder {
  color: rgba(232, 236, 239, 0.58);
}

.url-control button {
  min-width: 92px;
  padding: 0.55rem 0.8rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.url-control button:hover {
  background: #5b79f0;
  transform: translateY(-1px);
}

.main {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 32px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 0;
}

.embed-help {
  padding: 6px 10px;
  margin-bottom: -8px;
  color: #d7e1ff;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(109, 140, 255, 0.18);
  border-radius: 14px;
  max-width: 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.iframe-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  flex: 1;
  min-height: 0;
}

.welcome {
  padding: 24px 32px;
  min-height: 0;
  flex: 1;
}

.welcome {
  display: grid;
  place-items: center;
  padding: 24px 32px;
  min-height: 0;
  flex: 1;
  color: #e8ecf3;
  text-align: center;
}

.welcome-inner {
  max-width: 720px;
  width: 100%;
}

.welcome h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  letter-spacing: -0.04em;
  color: #f7fbff;
}

.welcome p {
  margin: 0 0 32px;
  color: #b9c2d4;
  font-size: 1.05rem;
}

.welcome ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 18px;
  text-align: left;
}

.welcome li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 1rem;
  color: #d9e0ef;
}

.welcome li::before {
  content: "";
  margin-top: 0.45rem;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(109, 140, 255, 0.4);
}

.iframe-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 0;
}

/* Only hide the main dashboard frame by id; allow other iframes (eg. TradingView) to be visible */
#siteFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: #071018;
  min-height: 0;
  z-index: 0;
}

/* Ensure any iframe injected into tv-widget panels is visible and sized */
.tv-widget iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(10, 14, 20, 0.82);
  color: #e9eef7;
  text-align: center;
  gap: 18px;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 1;
}

.fallback.show {
  opacity: 1;
}

.tradingview-grid {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
      position: relative;
      z-index: 5;
  gap: 8px;
  padding: 8px;
  height: 100%;
  overflow: hidden;
}

.tradingview-grid.show {
  display: grid;
}

.tv-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(109, 140, 255, 0.10);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(10, 14, 20, 0.96);
  min-height: 280px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  height: 100%;
  position: relative;
  z-index: 6;
}

.tv-panel-header {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(109, 140, 255, 0.12);
}

.tv-panel-header input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: #f5f8ff;
  outline: none;
}

.tv-panel-header input::placeholder {
  color: rgba(232, 236, 239, 0.45);
}

.tv-panel-header button {
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: rgba(109, 140, 255, 0.16);
  color: #e9f0ff;
  border: 1px solid rgba(109, 140, 255, 0.18);
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease;
  white-space: nowrap;
}

.tv-panel-header button:hover {
  background: rgba(109, 140, 255, 0.28);
  transform: translateY(-1px);
}

.tv-widget {
  flex: 1;
  min-height: 280px;
  height: 100%;
  background: #081018;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.tv-widget > div[id$="-wrapper"] {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  display: block !important;
}

.tv-widget iframe,
.tv-widget > div > iframe {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  visibility: visible !important;
  opacity: 1 !important;
  border: 0 !important;
  background: transparent !important;
  z-index: 1 !important;
}

@media (max-width: 900px) {
  .tradingview-grid {
    grid-template-columns: 1fr;
  }
  }
.fallback h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #fff;
}

.fallback p {
  margin: 0;
  max-width: 520px;
  color: #c8d2e4;
}

.fallback a,
.fallback button {
  padding: 0.95rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(109, 140, 255, 0.18);
  color: #e9f0ff;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.fallback a:hover,
.fallback button:hover {
  background: rgba(109, 140, 255, 0.28);
  transform: translateY(-1px);
}

.status-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  font-size: 0.95rem;
  color: #9ca6bf;
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.status-bar span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }

  .url-control {
    grid-template-columns: 1fr;
  }

  .url-control button {
    width: 100%;
  }

  .quick-links {
    justify-content: center;
  }

  .main {
    min-height: 560px;
  }
}

/* File:// serving warning banner */
.file-warning {
  position: relative;
  display: none;
  background: linear-gradient(180deg, rgba(255,205,80,0.06), rgba(255,205,80,0.03));
  border: 1px solid rgba(255,205,80,0.12);
  color: #fff3d6;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 12px 20px;
  font-size: 13px;
}
.file-warning button {
  margin-left: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: #fff;
  cursor: pointer;
}

