/* ============================================
   RetroTicker - CRT Ticker Display
   Simulating ~480p low-res CRT text grid
   Target: ~40 cols x 18 rows visible text
   Min text size: 24px — nothing smaller
   ============================================ */

:root {
  --bg-dark: #001040;
  --bg-blue: #102080;
  --bg-navy: #0a0e2a;
  --purple-header: rgb(32, 0, 87);
  --yellow: #ffff00;
  --white: #ffffff;
  --low-blue: #8080ff;
  --green: #00ff00;
  --red: #ff0000;
  --cyan: #00ffff;
  --text-outline:
    -3px -3px 0 #000,
    -3px 0px 0 #000,
    -3px 3px 0 #000,
    0px -3px 0 #000,
    0px 3px 0 #000,
    3px -3px 0 #000,
    3px 0px 0 #000,
    3px 3px 0 #000;
  --text-outline-sm:
    -2px -2px 0 #000,
    -2px 0px 0 #000,
    -2px 2px 0 #000,
    0px -2px 0 #000,
    0px 2px 0 #000,
    2px -2px 0 #000,
    2px 0px 0 #000,
    2px 2px 0 #000;
  --font-main: 'Share Tech Mono', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
}

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

body {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  font-family: var(--font-main);
  color: var(--white);
  overflow: hidden;
}

/* ---- CRT Container ---- */

#crt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
}

#monitor {
  position: relative;
  width: 960px;
  height: 720px;
  background: linear-gradient(180deg,
    #001040 0%,
    #102080 40%,
    #0a1650 100%
  );
  overflow: hidden;
  image-rendering: crisp-edges;
  filter: saturate(90%) blur(1.5px);
}

#fullscreen-wrap {
  display: contents;
}

#fullscreen-wrap:fullscreen {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

#fullscreen-wrap:fullscreen > #monitor {
  transform-origin: center center;
  transform: scale(var(--fullscreen-scale, 1));
}

#fullscreen-wrap::backdrop {
  background: #000;
}

/* ---- Video Overlays ---- */

#texture-overlay,
#grain-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

#texture-overlay {
  z-index: 97;
  opacity: 1;
  mix-blend-mode: screen;
}

#grain-overlay {
  z-index: 98;
  opacity: 0.16;
  mix-blend-mode: screen;
}


/* ---- Start Overlay ---- */

#start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 96;
  background: linear-gradient(180deg,
    #001040 0%,
    #102080 40%,
    #0a1650 100%
  );
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

#start-overlay.hidden {
  display: none;
}

.start-prompt {
  font-family: var(--font-main);
  font-size: 48px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline);
  text-transform: uppercase;
  letter-spacing: 4px;
  animation: blink 1.2s step-end infinite;
}

#screen-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
  z-index: 99;
}

/* ---- Top Bar ---- */

#top-bar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  height: 72px;
  background: transparent;
}

#logo {
  font-family: var(--font-main);
  font-size: 36px;
  font-weight: bold;
  color: var(--white);
  text-shadow: var(--text-outline);
  text-transform: uppercase;
  letter-spacing: 2px;
}

#clock {
  font-family: var(--font-main);
  font-size: 32px;
  font-weight: bold;
  color: var(--white);
  text-shadow: var(--text-outline);
  letter-spacing: 2px;
  text-align: right;
  min-width: 280px;
}

/* ---- Screen / Slides ---- */

#screen {
  position: relative;
  z-index: 5;
  height: calc(100% - 150px);
  padding: 0 28px;
  display: flex;
  flex-direction: column;
}

.slide {
  display: none;
  flex-direction: column;
  height: 100%;
  animation: fadeIn 0.4s ease-in;
}

.slide.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Slide Title ---- */

.slide-title {
  font-family: var(--font-main);
  font-size: 40px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ---- Slide: Current Price ---- */

.current-main {
  display: flex;
  align-items: flex-start;
  gap: 30px;
  margin: 6px 0;
}

.current-price {
  font-size: 120px;
  font-weight: bold;
  line-height: 1;
  color: var(--white);
  text-shadow: var(--text-outline);
}

.current-change {
  font-size: 44px;
  font-weight: bold;
  text-shadow: var(--text-outline);
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.current-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 28px;
  margin-top: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.3);
}

.detail-label {
  color: var(--yellow);
  font-size: 26px;
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: var(--text-outline-sm);
}

.detail-value {
  color: var(--white);
  font-size: 26px;
  font-weight: bold;
  text-shadow: var(--text-outline-sm);
}

.crypto-price-medium {
  font-size: 40px;
  font-weight: bold;
  color: var(--white);
  text-shadow: var(--text-outline);
  margin: 10px 0;
}

/* ---- Slide: Market Overview ---- */

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  flex: 1;
  align-content: start;
  margin-top: 12px;
}

.forecast-day {
  background: rgba(0, 0, 0, 0.25);
  padding: 18px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.forecast-day-name {
  font-family: var(--font-main);
  font-size: 36px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.forecast-icon {
  font-size: 48px;
  line-height: 1;
}

.forecast-temps {
  display: flex;
  gap: 10px;
  font-size: 28px;
  font-weight: bold;
}

.temp-hi {
  color: var(--yellow);
  text-shadow: var(--text-outline-sm);
}

.temp-lo {
  color: var(--low-blue);
  text-shadow: var(--text-outline-sm);
}

.forecast-desc {
  font-size: 24px;
  font-weight: bold;
  color: var(--white);
  text-shadow: var(--text-outline-sm);
  line-height: 1.3;
  text-transform: uppercase;
}

/* ---- Slide: Comparison Table ---- */

.hourly-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.hourly-table th {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: bold;
  color: var(--yellow);
  text-align: left;
  padding: 10px 14px;
  background: var(--purple-header);
  text-shadow: var(--text-outline-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.hourly-table td {
  font-size: 26px;
  font-weight: bold;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--white);
  text-shadow: var(--text-outline-sm);
}

.hourly-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.35);
}

/* ---- Slide: Stats / Supply ---- */

.almanac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 12px;
}

.almanac-section {
  background: rgba(0, 0, 0, 0.25);
  padding: 18px;
}

.almanac-section-title {
  font-family: var(--font-main);
  font-size: 30px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline);
  margin-bottom: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.almanac-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.almanac-label {
  color: var(--yellow);
  font-size: 26px;
  font-weight: bold;
  text-shadow: var(--text-outline-sm);
  text-transform: uppercase;
}

.almanac-value {
  color: var(--white);
  font-size: 26px;
  font-weight: bold;
  text-shadow: var(--text-outline-sm);
}

/* ---- Slide: Price Chart ---- */

.graph-container {
  flex: 1;
  margin-top: 8px;
  position: relative;
}

.graph-container canvas {
  width: 100%;
  height: 100%;
}

/* ---- Bottom Bar / Ticker ---- */

#bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: 68px;
  background: rgba(0, 0, 0, 0.7);
  border-top: 3px solid var(--yellow);
  overflow: hidden;
  display: flex;
  align-items: center;
}

#ticker {
  white-space: nowrap;
  animation: ticker 30s linear infinite;
  font-size: 30px;
  font-weight: bold;
  color: var(--white);
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  letter-spacing: 2px;
  text-transform: uppercase;
  will-change: transform;
}

@keyframes ticker {
  0% { transform: translate3d(960px, 0, 0); }
  100% { transform: translate3d(var(--ticker-end, -100%), 0, 0); }
}

/* ---- Controls ---- */

#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

#icon-controls {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  color: var(--white);
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-blue);
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-btn.active {
  color: var(--yellow) !important;
  border-color: var(--yellow) !important;
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
}

/* ---- Settings Modal ---- */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(180deg, #0a0e2a, #102080);
  border: 2px solid var(--yellow);
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 300px;
  max-width: 90vw;
}

.modal-title {
  font-family: var(--font-main);
  font-size: 28px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline-sm);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
}

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

.modal-label {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: bold;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal-btn {
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: bold;
  padding: 12px 24px;
  background: #1a1a2e;
  border: 1px solid #444;
  color: var(--white);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-btn:hover {
  background: var(--bg-blue);
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
}

.modal-btn.active {
  background: var(--bg-blue);
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
  color: var(--yellow);
}

.modal-close {
  margin-top: 4px;
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: bold;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-close:hover {
  background: rgba(255, 255, 0, 0.1);
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
}

.crypto-overview-grid {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* ---- Loading State ---- */

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-family: var(--font-main);
  font-size: 40px;
  font-weight: bold;
  color: var(--yellow);
  text-shadow: var(--text-outline);
  animation: blink 1s step-end infinite;
  text-transform: uppercase;
}

@keyframes blink {
  50% { opacity: 0; }
}


/* ---- Responsive: scale monitor to fill viewport ---- */

#monitor-wrap {
  width: calc(960px * var(--monitor-scale, 1));
  height: calc(720px * var(--monitor-scale, 1));
  position: relative;
}

#monitor-wrap #monitor {
  transform-origin: top left;
  transform: scale(var(--monitor-scale, 1));
}

