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

:root {
  --font-family: 'Outfit', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(26, 35, 55, 0.95);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(56, 189, 248, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --gradient-btn: linear-gradient(135deg, #0ea5e9 0%, #2563eb 50%, #4f46e5 100%);
  --gradient-btn-hover: linear-gradient(135deg, #38bdf8 0%, #3b82f6 50%, #6366f1 100%);
  --shadow-glow: 0 10px 30px -5px rgba(14, 165, 233, 0.45), 0 0 20px rgba(59, 130, 246, 0.25);
}

* {
  box-sizing: border-box;
}

html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: #f7f7f7;
  overflow-x: hidden;
}

/* ==========================================================================
   Main Landing Screen (Home View)
   ========================================================================== */
.main-landing-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, var(--bg-dark) 75%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 24px 16px;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.main-landing-screen.hidden-screen {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  pointer-events: none;
}

.main-bg-glow {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 350px;
  background: radial-gradient(ellipse, rgba(56, 189, 248, 0.15) 0%, rgba(99, 102, 241, 0.08) 50%, transparent 70%);
  pointer-events: none;
  filter: blur(40px);
}

.main-container {
  position: relative;
  max-width: 640px;
  width: 100%;
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header & Badges */
.main-header {
  margin-bottom: 20px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  backdrop-filter: blur(12px);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
}

.badge-text {
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Hero Section */
.dino-avatar-card {
  margin-bottom: 18px;
}

.dino-icon-wrapper {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  animation: float-icon 3s infinite ease-in-out;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.dino-sprite-preview {
  width: 44px;
  height: 48px;
  background-image: url('assets/default_100_percent/100-offline-sprite.png');
  background-position: -848px -2px;
  background-repeat: no-repeat;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)) invert(1) brightness(1.2);
}

.main-title {
  color: var(--text-primary);
  font-size: 2.3rem;
  font-weight: 800;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.main-subtitle {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.6;
  margin: 0 0 28px 0;
  max-width: 480px;
}

/* Call to Action Button */
.main-cta-group {
  width: 100%;
  max-width: 380px;
  margin-bottom: 36px;
}

.btn-play-game {
  width: 100%;
  padding: 16px 28px;
  background: var(--gradient-btn);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-glow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-play-game:hover {
  background: var(--gradient-btn-hover);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 35px -5px rgba(14, 165, 233, 0.6), 0 0 25px rgba(99, 102, 241, 0.35);
}

.btn-play-game:active {
  transform: translateY(0px) scale(0.98);
}

.btn-play-game .btn-icon {
  font-size: 1.35rem;
  animation: bounce-icon 1.5s infinite;
}

@keyframes bounce-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.btn-play-game .btn-keyhint {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  margin-left: 4px;
}

/* Feature Cards Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: left;
  backdrop-filter: blur(10px);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.feature-body h3 {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.feature-body p {
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0;
}

.feature-body kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.72rem;
  font-family: inherit;
  color: #fff;
}

/* Footer */
.main-footer {
  color: #64748b;
  font-size: 0.78rem;
}

/* ==========================================================================
   In-Game Navigation & Controls
   ========================================================================== */
.game-top-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: 9999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 1;
  visibility: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.game-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.game-nav-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.03);
}

.game-top-info {
  display: flex;
  align-items: center;
}

.game-live-badge {
  color: #4ade80;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Touch Controls Bar (Mobile / Mouse) */
.touch-controls-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 500;
  display: flex;
  gap: 16px;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.touch-btn {
  padding: 14px 28px;
  border-radius: 14px;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.touch-btn-jump {
  background: linear-gradient(135deg, #0284c7, #2563eb);
}

.touch-btn-duck {
  background: linear-gradient(135deg, #475569, #334155);
}

.touch-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   Original Chromium Offline Game Styles (Preserved & Enhanced)
   ========================================================================== */
.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%;
  position: relative;
  min-height: 250px;
}

.offline .runner-container {
  height: 150px;
  max-width: 600px;
  overflow: hidden;
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 44px;
}

.offline .runner-canvas {
  height: 150px;
  max-width: 600px;
  opacity: 1;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 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;
}

.inverted {
  background-color: #202124 !important;
}

.inverted .runner-canvas {
  filter: invert(1);
  -webkit-filter: invert(1);
}

#offline-resources {
  display: none;
}

@media (max-width: 640px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .main-title {
    font-size: 1.85rem;
  }
  .main-subtitle {
    font-size: 0.88rem;
    margin-bottom: 20px;
  }
  .btn-play-game {
    padding: 14px 20px;
    font-size: 1rem;
  }
}

@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;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 0;
}

.arcade-mode .runner-container {
  position: relative;
  top: 0;
  left: auto;
  right: auto;
  margin: auto;
  transform-origin: center center;
  transition: transform 250ms cubic-bezier(0.4, 0, 1, 1);
  z-index: 2;
}
