/* 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 Background Themes & Particles */
body {
  transition: background 0.8s ease, color 0.8s ease;
  overflow: hidden;
  position: relative;
}

#bg-canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

#bg-effect-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.offline .interstitial-wrapper {
  position: relative;
  z-index: 5;
}

/* 0. 기본 (Day) */
body.theme-0-default {
  background: linear-gradient(180deg, #f7f7f7 0%, #eef2f3 100%);
  color: #2b2b2b;
}

/* 1. 노을 (Sunset) */
body.theme-1-sunset {
  background: linear-gradient(180deg, #1e112a 0%, #7b2cbf 40%, #ff7e5f 75%, #feb47b 100%);
  color: #ffffff;
}

/* 2. 밤 (Night) */
body.theme-2-night {
  background: linear-gradient(180deg, #050814 0%, #0c1b33 60%, #142850 100%);
  color: #ffffff;
}

/* 3. 도시 (City) */
body.theme-3-city {
  background: linear-gradient(180deg, #0d0221 0%, #261447 50%, #541388 100%);
  color: #ffffff;
}

/* 4. 사막 (Desert) */
body.theme-4-desert {
  background: linear-gradient(180deg, #2b1810 0%, #8c3a00 50%, #d97724 100%);
  color: #ffffff;
}

/* 5. 우주 (Space) */
body.theme-5-space {
  background: linear-gradient(180deg, #03001e 0%, #7303c0 60%, #000000 100%);
  color: #ffffff;
}

/* 6. 비 (Rain) */
body.theme-6-rain {
  background: linear-gradient(180deg, #0b132b 0%, #1c2541 60%, #3a506b 100%);
  color: #ffffff;
}

/* 7. 눈 (Snow) */
body.theme-7-snow {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 60%, #334155 100%);
  color: #ffffff;
}

/* Dark mode canvas filter for non-default themes */
body.theme-dark .runner-canvas {
  filter: invert(100%) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

body.theme-dark #messageBox h1 {
  color: #ffffff !important;
}

/* Theme Toast Notification */
.theme-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(56, 189, 248, 0.4);
  backdrop-filter: blur(12px);
  border-radius: 50px;
  z-index: 100;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.theme-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.theme-toast-icon {
  font-size: 2rem;
  line-height: 1;
}

.theme-toast-content {
  display: flex;
  flex-direction: column;
}

.theme-toast-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.theme-toast-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

/* User Top Navigation Bar */
.user-header-bar {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  padding: 8px 18px;
  border-radius: 40px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.user-header-bar.hidden {
  display: none !important;
}

.user-badge, .score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
}

.user-badge svg {
  width: 18px;
  height: 18px;
  color: #38bdf8;
}

.score-badge svg {
  width: 18px;
  height: 18px;
  color: #fbbf24;
}

.score-badge span {
  color: #fbbf24;
  font-weight: 800;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

/* Fullscreen Auth Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(20px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.auth-overlay.hidden {
  display: none !important;
}

/* Auth Modal Card */
.auth-modal-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.auth-modal-card.mode-login {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 20px 50px rgba(56, 189, 248, 0.2);
}

.auth-modal-card.mode-register {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 20px 50px rgba(16, 185, 129, 0.2);
}

/* Auth Tabs Header */
.auth-tabs {
  display: flex;
  background: rgba(2, 6, 23, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
  flex: 1;
  padding: 16px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  position: relative;
}

.auth-tab svg {
  width: 20px;
  height: 20px;
}

.auth-tab.active {
  color: #ffffff;
}

#tab-login.active {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-bottom: 3px solid #38bdf8;
}

#tab-register.active {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-bottom: 3px solid #34d399;
}

/* Modal Body */
.auth-modal-body {
  padding: 32px 28px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.badge-login {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-register {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.icon-cyan {
  color: #38bdf8;
}

.icon-emerald {
  color: #34d399;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* Auth Form Fields */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group svg {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: #64748b;
  pointer-events: none;
  transition: color 0.3s ease;
}

.input-group input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.mode-login .input-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.mode-login .input-group input:focus + svg,
.mode-login .input-group:focus-within svg {
  color: #38bdf8;
}

.mode-register .input-group input:focus {
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

.mode-register .input-group input:focus + svg,
.mode-register .input-group:focus-within svg {
  color: #34d399;
}

/* Alert Messages */
.auth-alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.auth-alert.hidden {
  display: none !important;
}

.auth-alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Action Buttons */
.btn-auth {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.btn-login {
  background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(2, 132, 199, 0.6);
}

.btn-register {
  background: linear-gradient(135deg, #059669 0%, #10b981 50%, #06b6d4 100%);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(16, 185, 129, 0.6);
}

.btn-auth:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-auth svg {
  width: 20px;
  height: 20px;
}
