:root {
  --bg: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --accent: #3b82f6;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* Fallback for older browsers */
  height: 100dvh;
  overflow: hidden;
}

.glass-container {
  width: 100%;
  max-width: 500px;
  height: 100vh; /* Fallback for older browsers */
  height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 15px);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  .glass-container {
    height: 85vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  }
}

.screen { 
  display: none; 
  padding: 20px; 
  flex-direction: column; 
  height: 100%; 
  box-sizing: border-box; 
}
.screen.active { display: flex; }

h1 { text-align: center; font-size: 2.5rem; margin-bottom: 10px; }
p { text-align: center; color: #94a3b8; }

input {
  width: 100%;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
  color: white;
  margin-bottom: 20px;
  box-sizing: border-box;
  font-size: 1rem;
}

button {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: 0.2s;
}

button:hover { background: #2563eb; }

/* Chat UI */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
}

#status-indicator { color: #22c55e; font-weight: bold; }
.skip-btn { width: auto; padding: 8px 16px; background: #ef4444; }
.skip-btn:hover { background: #dc2626; }

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message { 
  padding: 10px 15px; 
  border-radius: 15px; 
  max-width: 75%; 
  word-wrap: break-word; 
}
.msg-self { 
  background: var(--accent); 
  align-self: flex-end; 
  border-bottom-right-radius: 2px; 
}
.msg-other { 
  background: rgba(255,255,255,0.1); 
  align-self: flex-start; 
  border-bottom-left-radius: 2px; 
}
.msg-system { 
  background: transparent; 
  color: #94a3b8; 
  align-self: center; 
  font-size: 0.8rem; 
}

.input-area { display: flex; gap: 10px; padding-top: 15px; }
.input-area input { margin: 0; }
.input-area button { width: 80px; }

/* Spinner */
.spinner {
  border: 4px solid var(--glass-border);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: auto;
}
@keyframes spin { 
  0% { transform: rotate(0deg); } 
  100% { transform: rotate(360deg); } 
}
