*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --accent: #1a73e8;
  --text: #eaeaea;
  --text2: #a0a0b0;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.logo { font-size: 28px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.logo span { color: var(--text); }
.subtitle { color: var(--text2); font-size: 14px; margin-bottom: 40px; }

.form-group { width: 100%; margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-group input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 18px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text2); font-size: 14px; }

.btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  padding: 16px;
  cursor: pointer;
  transition: opacity .2s;
  margin-top: 8px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { opacity: .8; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--bg3);
  color: var(--text2);
}

.error-msg {
  background: rgba(233,69,96,.15);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  width: 100%;
  display: none;
}
.error-msg.show { display: block; }

/* Ekran startowy — siatka skilli */
.greeting { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.greeting-sub { color: var(--text2); font-size: 14px; margin-bottom: 32px; }

.skills-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skill-btn {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  padding: 20px 20px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background .2s, border-color .2s;
}
.skill-btn:active { background: var(--bg3); border-color: var(--accent); }
.skill-icon { font-size: 24px; width: 36px; text-align: center; flex-shrink: 0; }

.logout-btn {
  margin-top: 24px;
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
}

/* Czat */
.chat-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  flex-shrink: 0;
}
.chat-back { background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 0; }
.chat-title { font-size: 16px; font-weight: 600; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  min-height: 0;
}

.msg { display: flex; flex-direction: column; gap: 4px; }
.msg-bot .bubble {
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 12px 16px;
  font-size: 15px;
  max-width: 85%;
  align-self: flex-start;
}
.msg-user .bubble {
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 var(--radius);
  padding: 12px 16px;
  font-size: 15px;
  max-width: 85%;
  align-self: flex-end;
  color: #fff;
}

.chat-input-area {
  background: var(--bg2);
  border-top: 1px solid var(--bg3);
  width: 100%;
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.chat-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chat-btn {
  background: var(--bg3);
  border: none;
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .2s;
}
.chat-btn:active { background: var(--accent); }
.chat-btn-skip { background: transparent; border: 1px solid var(--bg3); color: var(--text2); }
.chat-btn-primary { background: var(--accent); color: #fff; }

.chat-text-input-row { display: flex; gap: 8px; align-items: center; }
.chat-text-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
}
.chat-text-input:focus { border-color: var(--accent); }
.mic-btn {
  background: var(--bg3);
  border: none;
  border-radius: 50%;
  color: var(--text);
  font-size: 20px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mic-btn.recording { background: var(--accent); }
.send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Foto preview */
.photo-preview {
  width: 100%;
  border-radius: var(--radius);
  margin-top: 8px;
  max-height: 200px;
  object-fit: cover;
}
.photo-count { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* Potwierdzenie końcowe */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}
.success-icon { font-size: 64px; margin-bottom: 16px; }
.success-title { font-size: 22px; font-weight: 700; color: #4caf50; margin-bottom: 8px; }
.success-nr { font-size: 28px; font-weight: 700; color: var(--accent); margin-bottom: 24px; }
.success-sub { color: var(--text2); font-size: 15px; }

/* Spinner */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bg3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Detekcja jakości zdjęcia */
.quality-warning {
  background: rgba(255,152,0,.15);
  border: 1px solid #ff9800;
  border-radius: var(--radius);
  color: #ff9800;
  font-size: 13px;
  padding: 10px 14px;
  margin-top: 8px;
}

@media (max-width: 360px) {
  .skill-btn { font-size: 15px; padding: 16px; }
  .logo { font-size: 24px; }
}
