@import '../../button-template.css';

:host {
  display: block;
}

.cityscape-shell {
  --sky-1: #04000f;
  --sky-2: #0e0235;
  --sky-3: #2d0860;
  --sky-4: #5e1185;
  --sky-5: #8b1270;
  --horizon: #be356e;
  --bldg-body: #090920;
  --bldg-mid: #0e0e2a;
  --bldg-lit: rgba(100, 60, 200, 0.12);
  --win-off: #0a0a1e;
  --win-cool: #7de8ff;
  --win-warm: #ffe88a;
  --win-glow-c: 0 0 6px #00d5ff, 0 0 16px rgba(0, 200, 255, 0.35);
  --win-glow-w: 0 0 6px #ffcc30, 0 0 16px rgba(255, 190, 0, 0.35);
  --bb-bg: rgba(8, 6, 28, 0.92);
  --bb-border: #00d5ff;
  --bb-glow: 0 0 18px rgba(0, 210, 255, 0.5), inset 0 0 10px rgba(0, 210, 255, 0.05);
  --bb-tag: #00d5ff;
  --bb-title: #d4f4ff;
  --btn-bg: #00d5ff;
  --btn-fg: #04000f;
  --btn-glow: 0 0 14px rgba(0, 210, 255, 0.9);
  --ground-top: #06060f;
  --ground-bot: #020208;
  --moon-vis: 1;
  --sun-vis: 0;
  --star-vis: 1;
  --cloud-col: rgba(255, 255, 255, 0.06);
  --cloud-col2: rgba(255, 255, 255, 0.04);
  --bg-bldg-op: 0.65;
  --haze-col: rgba(6, 6, 15, 0.7);
  --dlg-bg: rgba(8, 6, 28, 0.95);
  --dlg-border: #00d5ff;

  min-height: 100svh;
  font-family: 'Space Mono', 'Courier New', monospace;
  overflow: hidden;
  user-select: none;
  position: relative;
  background: var(--sky-1);
}

.cityscape-shell.sunset {
  --sky-1: #4d3279;
  --sky-2: #5A5485;
  --sky-3: #996C96;
  --sky-4: #e85040;
  --sky-5: #f07020;
  --horizon: #ffaa30;
  --bldg-body: #13072a;
  --bldg-mid: #1e0e38;
  --bldg-lit: rgba(255, 120, 40, 0.14);
  --win-off: #18082e;
  --win-cool: #ffcc55;
  --win-warm: #ff7730;
  --win-glow-c: 0 0 6px #ea00ff, 0 0 16px rgba(255, 180, 0, 0.4);
  --win-glow-w: 0 0 6px #ff00e6, 0 0 16px rgba(255, 196, 0, 0.4);
  --bb-bg: rgba(20, 5, 45, 0.93);
  --bb-border: #ff40f9;
  --bb-glow: 0 0 18px rgba(255, 50, 217, 0.55), inset 0 0 10px rgba(255, 120, 30, 0.06);
  --bb-tag: #b640ff;
  --bb-title: #ffe0c0;
  --btn-bg: #f26ae2;
  --btn-fg: #13072a;
  --btn-glow: 0 0 14px rgba(238, 50, 255, 0.9);
  --ground-top: #0a0318;
  --ground-bot: #04010a;
  --moon-vis: 0;
  --sun-vis: 1;
  --star-vis: 0;
  --cloud-col: rgba(255, 160, 100, 0.22);
  --cloud-col2: rgba(255, 100, 60, 0.14);
  --bg-bldg-op: 0.45;
  --haze-col: rgba(10, 3, 24, 0.65);
  --dlg-bg: rgba(20, 5, 45, 0.96);
  --dlg-border: #ff40cf;
}

.scene {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
}

.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 22%, var(--sky-3) 48%, var(--sky-4) 70%, var(--sky-5) 85%, var(--horizon) 100%);
  transition: background 1.6s ease;
}

.stars-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--star-vis);
  transition: opacity 1.6s ease;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
  animation: twinkle var(--d, 3s) ease-in-out infinite var(--dl, 0s);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.7);
  }

  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

.moon {
  position: absolute;
  top: 9%;
  right: 14%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffbe8, #f5d060 60%, #c8a020);
  box-shadow: 0 0 28px rgba(245, 210, 80, 0.55), 0 0 70px rgba(240, 190, 40, 0.25);
  opacity: var(--moon-vis);
  transition: opacity 1.6s ease;
}

.sun {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fffce0, #ffd020 40%, #ff9000);
  box-shadow: 0 0 40px rgba(255, 200, 0, 0.85), 0 0 90px rgba(255, 150, 0, 0.45), 0 0 200px rgba(255, 80, 0, 0.2);
  opacity: var(--sun-vis);
  transition: opacity 1.6s ease;
  z-index: 4;
}

.cloud-wrap {
  position: absolute;
  top: 4%;
  left: 0;
  right: 0;
  height: 18%;
  pointer-events: none;
}

.cloud {
  position: absolute;
  border-radius: 60px;
  filter: blur(18px);
  transition: background 1.6s ease;
}

.cloud-a {
  width: 280px;
  height: 55px;
  background: var(--cloud-col);
  top: 10px;
  left: 4%;
  animation: drift 50s ease-in-out infinite;
}

.cloud-b {
  width: 200px;
  height: 44px;
  background: var(--cloud-col2);
  top: 28px;
  left: 15%;
  animation: drift 38s ease-in-out infinite 8s;
}

.cloud-c {
  width: 360px;
  height: 65px;
  background: var(--cloud-col);
  top: 5px;
  left: 36%;
  animation: drift 62s ease-in-out infinite 3s;
}

.cloud-d {
  width: 220px;
  height: 50px;
  background: var(--cloud-col2);
  top: 20px;
  left: 62%;
  animation: drift 44s ease-in-out infinite 14s;
}

.cloud-e {
  width: 180px;
  height: 40px;
  background: var(--cloud-col);
  top: 35px;
  left: 80%;
  animation: drift 56s ease-in-out infinite 6s;
}

@keyframes drift {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(-50px);
  }
}

.bg-layer {
  position: absolute;
  bottom: 8vh;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
  opacity: var(--bg-bldg-op);
  transition: opacity 1.6s ease;
}

.bg-bldg {
  position: absolute;
  bottom: 0;
  background: var(--bldg-body);
  transition: background 1.6s ease;
}

.bg-bldg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 14px, rgba(120, 120, 200, 0.08) 14px, rgba(120, 120, 200, 0.08) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(120, 120, 200, 0.08) 12px, rgba(120, 120, 200, 0.08) 14px);
}

.main-layer {
  position: absolute;
  bottom: 8vh;
  left: 0;
  right: 0;
  z-index: 10;
}

.bwrap {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.playerone-gif {
  position: absolute;
  top: 36px;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translateX(-50%);
  object-fit: contain;
  z-index: 14;
  pointer-events: none;
  image-rendering: auto;
}

.bpart {
  position: relative;
  background: var(--bldg-body);
  transition: background 1.6s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.bpart::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28%;
  background: linear-gradient(90deg, transparent, var(--bldg-lit));
  pointer-events: none;
  transition: background 1.6s ease;
}

.wins {
  display: grid;
  gap: 3px;
  padding: 5px;
  pointer-events: none;
}

.w {
  height: 9px;
  border-radius: 1px;
  background: var(--win-off);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.w.lc {
  background: var(--win-cool);
  box-shadow: var(--win-glow-c);
  animation: wflicker var(--wd, 5s) ease-in-out infinite var(--wdl, 0s);
}

.w.lw {
  background: var(--win-warm);
  box-shadow: var(--win-glow-w);
  animation: wflicker var(--wd, 6s) ease-in-out infinite var(--wdl, 0s);
}

@keyframes wflicker {
  0%,
  88%,
  92%,
  97%,
  100% {
    opacity: 1;
  }

  90% {
    opacity: 0.7;
  }

  95% {
    opacity: 0.85;
  }
}

.bb {
  margin: 0 7px 5px;
  padding: 10px 12px;
  background: var(--bb-bg);
  border: 1.5px solid var(--bb-border);
  box-shadow: var(--bb-glow);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  pointer-events: auto;
  transition: border-color 1.6s ease, box-shadow 1.6s ease, background 1.6s ease;
}

.bb-tag {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--bb-tag);
  opacity: 0.75;
  transition: color 1.6s ease;
}

.bb-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(13px, 1.4vw, 20px);
  line-height: 1.1;
  color: var(--bb-title);
  transition: color 1.6s ease;
}

.bb-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--bb-title);
  opacity: 0.55;
  letter-spacing: 0.5px;
  transition: color 1.6s ease;
}

.bb-btn {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  border-radius: 2px;
  padding: 5px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--btn-glow);
  transition: transform 0.2s ease, filter 0.2s ease, background 1.6s ease, box-shadow 1.6s ease;
}

.bb-btn:hover:enabled {
  transform: scale(1.08);
  filter: brightness(1.15);
}

.bb-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.neon {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--bb-tag);
  border: 1px solid var(--bb-border);
  padding: 2px 7px;
  border-radius: 2px;
  text-shadow: 0 0 8px currentColor, 0 0 20px currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: nflicker 9s ease-in-out infinite;
  display: inline-block;
  transition: color 1.6s ease, border-color 1.6s ease;
}

@keyframes nflicker {
  0%,
  94%,
  96%,
  100% {
    opacity: 1;
  }

  95% {
    opacity: 0.25;
  }

  98% {
    opacity: 0.5;
  }
}

.ant {
  width: 3px;
  background: var(--bldg-mid);
  margin: 0 auto;
  transition: background 1.6s ease;
  position: relative;
  flex-shrink: 0;
}

.ant::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff2222;
  box-shadow: 0 0 10px #ff2222, 0 0 20px rgba(255, 0, 0, 0.4);
  animation: blink 1.6s step-start infinite;
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 10vh;
  background: linear-gradient(180deg, var(--ground-top), var(--ground-bot));
  z-index: 20;
  transition: background 1.6s ease;
}

.haze {
  position: absolute;
  bottom: 8vh;
  left: 0;
  right: 0;
  height: 12vh;
  background: linear-gradient(0deg, var(--haze-col), transparent);
  z-index: 15;
  pointer-events: none;
  transition: background 1.6s ease;
}

.tgl {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  padding: 0;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 0.3s, transform 0.2s;
}

.tgl:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}

.tgl-icon {
  font-size: 22px;
  line-height: 1;
}

.mode-badge {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 200;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 10, 0.58);
  display: grid;
  place-items: center;
  z-index: 350;
  padding: 1rem;
}

.dialog-card {
  width: min(460px, 100%);
  background: var(--dlg-bg);
  border: 1.5px solid var(--dlg-border);
  box-shadow: var(--bb-glow);
  border-radius: 4px;
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
}

.dialog-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--bb-title);
  text-align: center;
}

.dialog-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dialog-btn {
  flex: 1;
  min-width: 120px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  border-radius: 2px;
  padding: 0.55rem 0.75rem;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--btn-glow);
}

.dialog-btn:hover:enabled {
  filter: brightness(1.12);
}

.dialog-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.dialog-input {
  width: 100%;
  background: rgba(4, 4, 20, 0.62);
  border: 1px solid var(--bb-border);
  color: var(--bb-title);
  border-radius: 2px;
  padding: 0.6rem 0.7rem;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
}

.dialog-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 213, 255, 0.25);
}

.dialog-textarea {
  min-height: 120px;
  resize: vertical;
}

.import-mode-group {
  display: flex;
  gap: 0.8rem;
}

.import-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--bb-title);
  font-size: 13px;
}

.error-banner {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 360;
  margin: 0;
  color: #ffd0d0;
  background: rgba(146, 0, 16, 0.45);
  border: 1px solid rgba(255, 170, 170, 0.6);
  border-radius: 9px;
  padding: 0.5rem 0.7rem;
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .bwrap {
    transform: scale(0.9);
    transform-origin: bottom center;
  }
}

@media (max-width: 700px) {
  .scene {
    transform: scale(0.8);
    transform-origin: bottom center;
    width: 125%;
    margin-left: -12.5%;
  }

  .dialog-card {
    width: min(380px, 100%);
  }
}
