/* 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. */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Press+Start+2P&display=swap');

* {
  box-sizing: border-box;
}

html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Background Effects Canvas */
#bg-effects-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   8-STAGE THEMES & ATMOSPHERIC GRADIENTS
   ========================================================================== */

body {
  background-color: #f7f9fa;
  transition: background 1.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.8s ease;
}

/* 0. 기본 (Default Day) */
body.theme-default {
  background: linear-gradient(180deg, #f5f7fa 0%, #e4e8eb 100%);
  color: #2c3e50;
}

/* 1. 노을 (Sunset / Twilight) */
body.theme-sunset {
  background: linear-gradient(180deg, #240b36 0%, #7c1a40 30%, #c31432 60%, #e67e22 85%, #f1c40f 100%);
  color: #ffffff;
}

/* 2. 밤 (Starry Night) */
body.theme-night {
  background: linear-gradient(180deg, #050b14 0%, #0d1b2a 50%, #1b263b 100%);
  color: #f5f6fa;
}

/* 3. 도시 (Cyber City / Neon Skyline) */
body.theme-city {
  background: linear-gradient(180deg, #0f051d 0%, #1c052e 35%, #2a0845 70%, #4b1248 100%);
  color: #00f2fe;
}

/* 4. 사막 (Golden Desert) */
body.theme-desert {
  background: linear-gradient(180deg, #d35400 0%, #e67e22 35%, #f39c12 70%, #f1c40f 100%);
  color: #ffffff;
}

/* 5. 우주 (Deep Space / Cosmic Nebula) */
body.theme-space {
  background: radial-gradient(circle at 65% 25%, #20073b 0%, #080214 55%, #010005 100%);
  color: #a29bfe;
}

/* 6. 비 (Rainy Weather) */
body.theme-rain {
  background: linear-gradient(180deg, #161f28 0%, #202d38 45%, #2b3a48 100%);
  color: #dff9fb;
}

/* 7. 눈 (Snowy Wonderland) */
body.theme-snow {
  background: linear-gradient(180deg, #1e3c72 0%, #2a5298 50%, #60a3bc 85%, #82ccdd 100%);
  color: #ffffff;
}

/* ==========================================================================
   SPRITE & CANVAS THEME FILTERS
   ========================================================================== */

.offline .runner-canvas {
  transition: filter 0.8s ease;
}

/* Light / Warm Themes */
body.theme-default .runner-canvas {
  filter: none;
}

body.theme-sunset .runner-canvas {
  filter: contrast(1.15) brightness(0.9) drop-shadow(0 0 2px rgba(255, 120, 0, 0.4));
}

body.theme-desert .runner-canvas {
  filter: sepia(0.35) contrast(1.1) brightness(0.95);
}

/* Dark Themes Invert & Glow */
body.theme-dark-mode .runner-canvas {
  filter: invert(1) brightness(1.2);
}

body.theme-night .runner-canvas {
  filter: invert(1) brightness(1.25) drop-shadow(0 0 4px rgba(180, 220, 255, 0.7));
}

body.theme-city .runner-canvas {
  filter: invert(1) drop-shadow(0 0 3px #00f2fe) drop-shadow(0 0 8px #ff007f);
}

body.theme-space .runner-canvas {
  filter: invert(1) drop-shadow(0 0 4px #a29bfe) drop-shadow(0 0 10px #6c5ce7);
}

body.theme-rain .runner-canvas {
  filter: invert(1) brightness(1.15) drop-shadow(0 0 3px #74b9ff);
}

body.theme-snow .runner-canvas {
  filter: invert(1) brightness(1.3) drop-shadow(0 0 5px #dfe6e9);
}

/* ==========================================================================
   THEME HUD TOAST & BADGE
   ========================================================================== */

/* Milestone Level-Up Toast */
.theme-toast {
  position: fixed;
  top: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px) scale(0.9);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: rgba(18, 22, 36, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 255, 255, 0.15);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.theme-toast #theme-toast-icon {
  font-size: 22px;
  animation: pulseIcon 1.5s infinite alternate;
}

@keyframes pulseIcon {
  0% { transform: scale(1); }
  100% { transform: scale(1.25); }
}

/* Bottom Persistent Theme Badge */
.theme-badge {
  position: fixed;
  bottom: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  pointer-events: none;
  transition: all 0.4s ease;
}

body.theme-dark-mode .theme-badge {
  background: rgba(15, 20, 35, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f1f2f6;
}

/* ==========================================================================
   ORIGINAL GAME WRAPPER & CONTROLLER
   ========================================================================== */

.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 .interstitial-wrapper {
  color: inherit;
  font-size: 1em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 600px;
  padding-top: 100px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.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: transparent;
  height: 100vh;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 1;
}

#offline-resources {
  display: none;
}

/* Start Message Card */
.sendmessage {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 24px 36px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  z-index: 100;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sendmessage h1 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 700;
  color: #2d3436;
}

.sendmessage .niokbutton {
  display: inline-block;
  padding: 10px 24px;
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(108, 92, 231, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sendmessage .niokbutton:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(108, 92, 231, 0.45);
}

body.theme-dark-mode .sendmessage {
  background: rgba(20, 24, 38, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
}

body.theme-dark-mode .sendmessage h1 {
  color: #f5f6fa;
}

/* Arcade Mode */
.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;
}

@media (max-width: 420px) {
  .theme-badge {
    bottom: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 12px;
  }
}
