/* ============================================
   BOW & ZOW — App UI Extensions
   Entry screen, loading, errors, league switcher, modal
   Appended after styles.css
   ============================================ */

/* ============ ENTRY SCREEN ============ */

#entry-screen {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

/* Dramatic split glow behind the entry */
#entry-screen::before {
  content: '';
  position: absolute;
  top: -20%; left: -10%;
  width: 55%; height: 80%;
  background: radial-gradient(ellipse, rgba(255,46,76,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: entryGlowL 6s ease-in-out infinite alternate;
}
#entry-screen::after {
  content: '';
  position: absolute;
  top: -20%; right: -10%;
  width: 55%; height: 80%;
  background: radial-gradient(ellipse, rgba(0,255,135,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: entryGlowR 6s ease-in-out infinite alternate;
}

@keyframes entryGlowL { from { transform: translate(0,0) scale(1); } to { transform: translate(5%,8%) scale(1.1); } }
@keyframes entryGlowR { from { transform: translate(0,0) scale(1); } to { transform: translate(-5%,6%) scale(1.08); } }

.entry-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 520px;
  width: 100%;
  animation: slideUp 0.7s cubic-bezier(.2,.7,.2,1) both;
}

.entry-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(72px, 18vw, 140px);
  line-height: 0.85;
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.06em;
}
.entry-logo .b { color: var(--bow); text-shadow: 0 0 60px rgba(255,46,76,0.5); }
.entry-logo .amp { color: var(--mute); font-size: 0.5em; margin: 0 0.05em; }
.entry-logo .z { color: var(--zow); text-shadow: 0 0 60px rgba(0,255,135,0.45); }

.entry-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--mute);
  text-transform: uppercase;
  margin-top: 18px;
  margin-bottom: 48px;
}

.entry-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line-2);
  padding: 32px;
  position: relative;
}
.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--bow) 0%, transparent 40%, transparent 60%, var(--zow) 100%);
}

.entry-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--mute);
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: left;
}

.entry-input-row {
  display: flex;
  gap: 0;
}

#entry-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-right: 0;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  padding: 14px 18px;
  outline: none;
  letter-spacing: 0.08em;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
#entry-input::-webkit-outer-spin-button,
#entry-input::-webkit-inner-spin-button { -webkit-appearance: none; }
#entry-input::placeholder { color: var(--mute); font-size: 15px; letter-spacing: 0.06em; }
#entry-input:focus { border-color: var(--line-2); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }

#entry-btn {
  background: var(--text);
  color: #000;
  border: none;
  padding: 14px 22px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  display: flex; align-items: center; gap: 8px;
}
#entry-btn:hover { background: var(--zow); }
#entry-btn:active { transform: scale(0.98); }
#entry-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#entry-btn.loading { background: var(--line-2); color: var(--mute-2); }

#entry-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--bow);
  letter-spacing: 0.08em;
  margin-top: 10px;
  text-align: left;
  opacity: 0;
  transition: opacity 0.2s;
  min-height: 16px;
}

.entry-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--mute);
  letter-spacing: 0.08em;
  margin-top: 14px;
  line-height: 1.7;
  text-align: left;
}
.entry-hint a { color: var(--mute-2); text-decoration: underline; text-underline-offset: 3px; }

.entry-badges {
  display: flex;
  gap: 10px;
  margin-top: 36px;
  justify-content: center;
  flex-wrap: wrap;
}
.entry-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--mute);
  padding: 6px 12px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}

/* ============ LOADING SCREEN ============ */

#app-loading {
  position: fixed; inset: 0;
  z-index: 90;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.loading-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 60px;
  display: flex; align-items: baseline; gap: 0.05em;
}
.loading-logo .b { color: var(--bow); }
.loading-logo .amp { color: var(--mute); font-size: 0.5em; }
.loading-logo .z { color: var(--zow); }

.loading-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--mute-2);
  text-transform: uppercase;
}

.loading-league {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: -8px;
}

.loading-bar-wrap {
  width: 280px;
  height: 3px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.loading-bar-track {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bow) 0%, var(--zow) 100%);
  transform-origin: left;
  animation: loadingPulse 1.6s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%   { transform: scaleX(0) translateX(0); }
  50%  { transform: scaleX(0.6) translateX(30%); }
  100% { transform: scaleX(0) translateX(200%); }
}

#loading-bar-fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bow) 0%, var(--zow) 100%);
  width: 0%;
  transition: width 0.4s ease;
  z-index: 1;
}

#loading-progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--mute);
  text-transform: uppercase;
}

/* ============ ERROR STATE ============ */

#app-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 16px;
  padding: 24px;
}
.error-icon { font-size: 48px; }
.error-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  color: var(--bow);
  letter-spacing: 0.04em;
}
#error-message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--mute-2);
  letter-spacing: 0.08em;
  max-width: 40ch;
  line-height: 1.8;
}
.error-retry {
  margin-top: 8px;
  padding: 10px 24px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.15s;
}
.error-retry:hover { border-color: var(--zow); color: var(--zow); }
.error-retry:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--line); color: var(--mute); }

/* ============ LEAGUE SWITCHER ============ */

.league-switcher { position: relative; }

.ls-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 0.15s;
  max-width: 200px;
}
.ls-trigger:hover { border-color: var(--zow); }

.ls-dot {
  width: 7px; height: 7px;
  background: var(--zow);
  box-shadow: 0 0 8px var(--zow-glow);
  flex-shrink: 0;
  animation: pulse 1.4s infinite;
}

.ls-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.ls-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  z-index: 200;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
.ls-menu.open { display: block; animation: slideUp 0.2s ease both; }

.ls-menu-inner { padding: 6px 0; }

.ls-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mute-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  gap: 10px;
}
.ls-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.ls-item.active { color: var(--zow); }
.ls-item-id { color: var(--mute); font-size: 10px; }
.ls-item-check { color: var(--zow); }
.ls-add { color: var(--mute); border-top: none; }
.ls-add:hover { color: var(--zow); }
.ls-divider { height: 1px; background: var(--line); margin: 4px 0; }

/* ============ ADD LEAGUE MODAL ============ */

.modal-overlay {
  position: fixed; inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--line-2);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  position: relative;
  animation: slideUp 0.25s ease both;
}
.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--bow) 0%, var(--zow) 100%);
}

.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.modal-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--mute);
  text-transform: uppercase;
  margin-bottom: 22px;
}

.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  padding: 14px 16px;
  outline: none;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  -moz-appearance: textfield;
}
.modal-input::-webkit-outer-spin-button,
.modal-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.modal-input:focus { border-color: var(--zow); }

.modal-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--bow);
  letter-spacing: 0.06em;
  min-height: 18px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal-cancel {
  padding: 10px 20px;
  background: none;
  border: 1px solid var(--line-2);
  color: var(--mute-2);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.15s;
}
.modal-cancel:hover { border-color: var(--mute); color: var(--text); }

.modal-confirm {
  padding: 10px 24px;
  background: var(--text);
  color: #000;
  border: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-confirm:hover { background: var(--zow); }
.modal-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ MOBILE ADJUSTMENTS ============ */

@media (max-width: 640px) {
  .entry-card { padding: 22px 18px; }
  .entry-logo { font-size: clamp(60px, 22vw, 100px); }
  #entry-btn { padding: 14px 14px; font-size: 15px; }
  .modal-box { padding: 24px 18px; }
  .ls-trigger { max-width: 140px; }
  .ls-name { max-width: 80px; }
}
