/* The Glass Eye - Glass-effect design system + pointer-events layering */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0F0F14;
  color: #E8E8EC;
}

/* ====== 3D SCENE LAYER (z-index: 0) ====== */
#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ====== UI LAYER (z-index: 1) ====== */
#game-root {
  position: relative;
  width: 100%;
  height: 100dvh;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  padding-top: var(--sat, env(safe-area-inset-top, 0px));
  padding-bottom: var(--sab, env(safe-area-inset-bottom, 0px));
}

/* Interactive UI elements get pointer-events back */
#game-root button,
#game-root .title-screen,
#game-root .how-to-play-screen,
#game-root .case-select-screen,
#game-root .case-intro-screen,
#game-root .loading-screen,
#game-root .scene-complete-screen,
#game-root .energy-empty-overlay,
#game-root .found-overlay,
#game-root .hud-top-bar,
#game-root .hud-checklist,
#game-root .hud-hint-btn {
  pointer-events: auto;
}

/* ====== GLASS EFFECT ====== */
.glass-card {
  background: rgba(15, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
}

/* ====== BUTTONS ====== */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7C52FB, #5B3FC4);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 12px 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #E8E8EC;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ====== TITLE SCREEN ====== */
.title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  background: rgba(15, 15, 20, 0.92);
}

.title-logo {
  text-align: center;
  margin-bottom: 48px;
}

.title-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 2s infinite;
}

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

.title-text {
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, #7C52FB, #A78BFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.title-subtitle {
  font-size: 14px;
  color: #888;
  margin-top: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.title-actions {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.title-footer {
  position: absolute;
  bottom: 40px;
  display: flex;
  gap: 12px;
}

/* ====== HOW TO PLAY ====== */
.how-to-play-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: rgba(15, 15, 20, 0.92);
}

.rules-card {
  max-width: 340px;
  width: 100%;
}

.rules-card h2 {
  font-size: 22px;
  margin-bottom: 20px;
  text-align: center;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.4;
  color: #ccc;
}

.rule-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ====== CASE INTRO ====== */
.case-intro-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: rgba(15, 15, 20, 0.88);
}

.case-intro-card {
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.case-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(124, 82, 251, 0.2);
  color: #A78BFA;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.case-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.case-desc {
  font-size: 14px;
  color: #999;
  line-height: 1.5;
  margin-bottom: 20px;
}

.case-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 14px;
  color: #aaa;
  margin-bottom: 24px;
}

/* ====== LOADING ====== */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: rgba(15, 15, 20, 0.95);
  pointer-events: auto;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(124, 82, 251, 0.2);
  border-top-color: #7C52FB;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: #888;
}

/* ====== HUD (Investigation mode) ====== */
.hud-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 12px;
}

.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(15, 15, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-energy {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
}

.hud-energy-icon {
  font-size: 18px;
}

.hud-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.hud-score-value {
  font-size: 18px;
  font-weight: 700;
  color: #A78BFA;
}

.hud-score-label {
  font-size: 11px;
  color: #888;
}

.hud-progress {
  font-size: 14px;
  font-weight: 600;
  color: #7C52FB;
}

.hud-progress-text {
  font-size: 14px;
}

/* Object checklist */
.hud-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: rgba(15, 15, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-height: 140px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 12px;
}

.hud-item-found {
  opacity: 0.4;
}

.hud-item-found .hud-item-name {
  text-decoration: line-through;
  color: #4ade80;
}

.hud-hint-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(124, 82, 251, 0.2);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hud-hint-btn:active {
  background: rgba(124, 82, 251, 0.4);
}

/* ====== FOUND OVERLAY ====== */
.found-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.found-card {
  text-align: center;
  padding: 24px 32px;
  background: rgba(15, 15, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid #4ade80;
  border-radius: 16px;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.found-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #4ade80;
  color: #000;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.found-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.found-points {
  font-size: 14px;
  color: #4ade80;
  font-weight: 600;
}

/* ====== ENERGY EMPTY ====== */
.energy-empty-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10;
}

.energy-empty-card {
  max-width: 300px;
  width: 90%;
  text-align: center;
}

.energy-empty-card .energy-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.energy-empty-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.energy-empty-card p {
  font-size: 14px;
  color: #999;
  margin-bottom: 20px;
}

.energy-empty-card .btn-primary {
  margin-bottom: 10px;
}

/* ====== SCENE COMPLETE ====== */
.scene-complete-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: rgba(15, 15, 20, 0.92);
  pointer-events: auto;
}

.complete-card {
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.complete-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.complete-stars {
  font-size: 36px;
  margin-bottom: 12px;
}

.complete-card h2 {
  font-size: 22px;
  margin-bottom: 16px;
}

.complete-stats {
  margin-bottom: 24px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: #ccc;
}

.stat-row span:last-child {
  font-weight: 600;
  color: #E8E8EC;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ====== CASE SELECT ====== */
.case-select-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  background: rgba(15, 15, 20, 0.92);
}

.case-select-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.case-select-header .btn-back {
  font-size: 20px;
}

.case-select-title {
  font-size: 22px;
  font-weight: 700;
}

.case-select-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1;
  padding-bottom: 24px;
}

.case-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.case-card:active {
  transform: scale(0.98);
}

.case-card:hover {
  border-color: rgba(124, 82, 251, 0.4);
}

.case-card-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.case-card-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #E8E8EC;
}

.case-card-desc {
  font-size: 13px;
  color: #999;
  line-height: 1.4;
  margin-bottom: 12px;
}

.case-card-meta {
  font-size: 12px;
  color: #7C52FB;
  font-weight: 600;
  letter-spacing: 0.5px;
}
