/* Copyright 2013 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}

.icon {
  -webkit-user-select: none;
  user-select: none;
  display: inline-block;
}

.icon-offline {
  content: -webkit-image-set( url(assets/default_100_percent/100-error-offline.png) 1x, url(assets/default_200_percent/200-error-offline.png) 2x);
  position: relative;
}

.hidden {
  display: none;
}


/* Offline page */

.offline .interstitial-wrapper {
  color: #2b2b2b;
  font-size: 1em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 600px;
  padding-top: 100px;
  width: 100%;
}

.offline .runner-container {
  height: 150px;
  max-width: 600px;
  overflow: hidden;
  position: absolute;
  top: 35px;
  width: 44px;
}

.offline .runner-canvas {
  height: 150px;
  max-width: 600px;
  opacity: 1;
  overflow: hidden;
  position: absolute;
  top: 0;
  z-index: 2;
}

.offline .controller {
  background: rgba(247, 247, 247, .1);
  height: 100vh;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 1;
}

#offline-resources {
  display: none;
}

@media (max-width: 420px) {
  .suggested-left > #control-buttons, .suggested-right > #control-buttons {
    float: none;
  }
  .snackbar {
    left: 0;
    bottom: 0;
    width: 100%;
    border-radius: 0;
  }
}

@media (max-height: 350px) {
  h1 {
    margin: 0 0 15px;
  }
  .icon-offline {
    margin: 0 0 10px;
  }
  .interstitial-wrapper {
    margin-top: 5%;
  }
  .nav-wrapper {
    margin-top: 30px;
  }
}

@media (min-width: 600px) and (max-width: 736px) and (orientation: landscape) {
  .offline .interstitial-wrapper {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (min-width: 420px) and (max-width: 736px) and (min-height: 240px) and (max-height: 420px) and (orientation:landscape) {
  .interstitial-wrapper {
    margin-bottom: 100px;
  }
}

@media (min-height: 240px) and (orientation: landscape) {
  .offline .interstitial-wrapper {
    margin-bottom: 90px;
  }
  .icon-offline {
    margin-bottom: 20px;
  }
}

@media (max-height: 320px) and (orientation: landscape) {
  .icon-offline {
    margin-bottom: 0;
  }
  .offline .runner-container {
    top: 10px;
  }
}

@media (max-width: 240px) {
  .interstitial-wrapper {
    overflow: inherit;
    padding: 0 8px;
  }
}

.arcade-mode,
.arcade-mode .runner-container,
.arcade-mode .runner-canvas {
  image-rendering: pixelated;
  max-width: 100%;
  overflow: hidden;
}

.arcade-mode #buttons,
.arcade-mode #main-content {
  opacity: 0;
  overflow: hidden;
}

.arcade-mode .interstitial-wrapper {
  height: 100vh;
  max-width: 100%;
  overflow: hidden;
}

.arcade-mode .runner-container {
  left: 0;
  margin: auto;
  right: 0;
  transform-origin: top center;
  transition: transform 250ms cubic-bezier(0.4, 0, 1, 1) 400ms;
  z-index: 2;
}

/* Dynamic Themed Backgrounds */
body {
  transition: background 1.5s ease-in-out, color 1.5s ease-in-out;
}

/* Background overlay for particles/effects */
#bg-effect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

/* 1. Default Theme */
body.bg-default {
  background: #f7f7f7;
  color: #2b2b2b;
}
body.bg-default h1 {
  color: #2b2b2b;
}

/* 2. Sunset Theme */
body.bg-sunset {
  background: linear-gradient(135deg, #f5576c 0%, #f093fb 50%, #f76b1c 100%);
  color: #fff;
}
body.bg-sunset h1 {
  color: #fff;
}

/* 3. Night Theme */
body.bg-night {
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  color: #fff;
}
body.bg-night h1 {
  color: #fff;
}

/* 4. City Theme */
body.bg-city {
  background: linear-gradient(135deg, #1d0933 0%, #4b0082 50%, #00ffff 100%);
  color: #fff;
}
body.bg-city h1 {
  color: #fff;
}

/* 5. Desert Theme */
body.bg-desert {
  background: linear-gradient(135deg, #e65c00 0%, #F9D423 100%);
  color: #2b2b2b;
}
body.bg-desert h1 {
  color: #2b2b2b;
}

/* 6. Space Theme */
body.bg-space {
  background: linear-gradient(135deg, #020024 0%, #090979 35%, #00d4ff 100%);
  color: #fff;
}
body.bg-space h1 {
  color: #fff;
}

/* 7. Rain Theme */
body.bg-rain {
  background: linear-gradient(135deg, #2c3e50 0%, #000000 100%);
  color: #fff;
}
body.bg-rain h1 {
  color: #fff;
}
body.bg-rain #bg-effect-overlay {
  opacity: 0.75;
  background-image: linear-gradient(170deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 80%, rgba(255, 255, 255, 0.2) 80%, rgba(255, 255, 255, 0.2) 100%);
  background-size: 8px 60px;
  animation: rainEffect 0.6s linear infinite;
}
@keyframes rainEffect {
  0% { background-position: 0px 0px; }
  100% { background-position: 100px 1000px; }
}

/* 8. Snow Theme */
body.bg-snow {
  background: linear-gradient(135deg, #83a4d4 0%, #b6fbff 100%);
  color: #2b2b2b;
}
body.bg-snow h1 {
  color: #2b2b2b;
}
body.bg-snow #bg-effect-overlay {
  opacity: 0.85;
  background-image: 
    radial-gradient(circle at 10px 10px, rgba(255, 255, 255, 0.8) 2px, transparent 0),
    radial-gradient(circle at 40px 60px, rgba(255, 255, 255, 0.6) 3px, transparent 0),
    radial-gradient(circle at 80px 30px, rgba(255, 255, 255, 0.7) 2.5px, transparent 0);
  background-size: 120px 120px;
  animation: snowEffect 4.5s linear infinite;
}
@keyframes snowEffect {
  0% { background-position: 0px 0px; }
  100% { background-position: 50px 500px; }
}

/* Canvas inversion on dark backgrounds to keep obstacles/T-Rex visible */
body.bg-default .runner-canvas,
body.bg-sunset .runner-canvas,
body.bg-desert .runner-canvas,
body.bg-snow .runner-canvas {
  filter: none;
  transition: filter 1s ease-in-out;
}

body.bg-night .runner-canvas,
body.bg-city .runner-canvas,
body.bg-space .runner-canvas,
body.bg-rain .runner-canvas {
  filter: invert(1) brightness(1.2);
  transition: filter 1s ease-in-out;
}

/* Other general element visibility updates */
.interstitial-wrapper {
  position: relative;
  z-index: 1; /* keep above background effects */
}

/* Auth Layout Wrapper */
.auth-wrapper {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(circle at 50% 50%, #151829 0%, #0a0b12 100%);
  font-family: 'Inter', sans-serif;
  overflow-y: auto;
  z-index: 10;
  position: relative;
}

.auth-brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #00f2fe 0%, #38ef7d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title i {
  color: #00f2fe;
}

.brand-subtitle {
  font-size: 1rem;
  color: #94a3b8;
  font-weight: 400;
}

.auth-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  max-width: 900px;
  width: 100%;
}

/* Authentication Cards Common Styles */
.auth-card {
  border-radius: 24px;
  padding: 40px 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.3s ease;
}

.auth-card:hover {
  transform: translateY(-5px);
}

.card-header {
  text-align: center;
  margin-bottom: 30px;
}

.card-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 15px;
  margin-bottom: 5px;
}

.card-header p {
  font-size: 0.9rem;
}

.icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 1.5rem;
}

/* LEFT CARD: Login (Dark Mode Theme) */
.auth-card-login {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(79, 172, 254, 0.2);
  color: #f8fafc;
}

.auth-card-login .card-header p {
  color: #94a3b8;
}

.icon-badge-login {
  background: rgba(79, 172, 254, 0.15);
  border: 1px solid rgba(79, 172, 254, 0.4);
  color: #4facfe;
}

.auth-card-login .input-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-card-login .input-group input {
  color: #fff;
}

.auth-card-login .input-group input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.auth-card-login .input-icon {
  color: #4facfe;
}

.btn-login {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  color: #070913;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(0, 242, 254, 0.25);
  border: none;
}

.btn-login:hover {
  background: linear-gradient(135deg, #00f2fe 30%, #7f00ff 100%);
  color: #fff;
  box-shadow: 0 15px 25px rgba(0, 242, 254, 0.4);
}

/* RIGHT CARD: Register (Light Mode Theme) */
.auth-card-register {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(56, 239, 125, 0.3);
  color: #1e293b;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.auth-card-register .card-header p {
  color: #64748b;
}

.icon-badge-register {
  background: rgba(56, 239, 125, 0.15);
  border: 1px solid rgba(56, 239, 125, 0.4);
  color: #11998e;
}

.auth-card-register .input-group {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.auth-card-register .input-group input {
  color: #1e293b;
}

.auth-card-register .input-group input::placeholder {
  color: rgba(30, 41, 59, 0.45);
}

.auth-card-register .input-icon {
  color: #11998e;
}

.btn-register {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(56, 239, 125, 0.25);
  border: none;
}

.btn-register:hover {
  background: linear-gradient(135deg, #38ef7d 0%, #00f2fe 100%);
  color: #070913;
  box-shadow: 0 15px 25px rgba(56, 239, 125, 0.4);
}

/* Shared Form Styles */
.input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 18px;
  transition: border-color 0.3s;
}

.input-group input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  width: 100%;
  font-family: inherit;
}

.input-group i {
  width: 18px;
  height: 18px;
}

.btn-auth {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-auth:hover {
  transform: translateY(-2px);
}

.error-msg {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  text-align: left;
}

.error-msg i {
  width: 16px;
  height: 16px;
}

/* AUTHENTICATED GAME WRAPPER & HEADER BAR */
.game-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
  position: relative;
}

.header-left, .header-right, .header-center {
  display: flex;
  align-items: center;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #f8fafc;
}

.user-badge i {
  width: 16px;
  height: 16px;
  color: #00f2fe;
}

.high-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(249, 212, 35, 0.1);
  border: 1px solid rgba(249, 212, 35, 0.3);
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.high-score-badge i {
  width: 18px;
  height: 18px;
}

.icon-gold {
  color: #f9d423;
  filter: drop-shadow(0 0 4px rgba(249, 212, 35, 0.4));
}

.badge-label {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.85rem;
}

#db-high-score-val {
  color: #f9d423;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.btn-logout i {
  width: 16px;
  height: 16px;
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
  .auth-container {
    grid-template-columns: 1fr;
    max-width: 440px;
  }
  .brand-title {
    font-size: 2.2rem;
  }
  .game-header {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }
}
