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

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --bg: #EFF6FF;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --green: #22C55E;
  --orange: #F97316;
  --red: #EF4444;
  --radius: 16px;
  --shadow: 0 2px 16px rgba(37,99,235,0.08);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* SCREENS */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* LOADING */
#screen-loading {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
}

.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* PAGE WRAP */
.page-wrap {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 48px;
  flex: 1;
}

/* LOGO */
.logo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo-mark.small {
  width: 32px;
  height: 32px;
  font-size: 11px;
  border-radius: 8px;
}

.logo-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* INVOICE BADGE */
.invoice-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--primary);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.invoice-badge strong { font-weight: 700; }

/* PAGE TITLE */
.page-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* QUESTION CARD */
.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.question-card.has-error {
  border-color: var(--red);
}

.question-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.question-text {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 20px;
  color: var(--text);
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

/* EMOJI GROUP */
.emoji-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.emoji-option {
  flex: 1;
  cursor: pointer;
}

.emoji-option input[type="radio"] { display: none; }

.emoji-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #F8FAFC;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.emoji-btn:hover {
  background: #F1F5F9;
  transform: translateY(-2px);
}

.emoji-btn svg {
  width: 54px;
  height: 54px;
  transition: transform 0.2s ease;
}

.emoji-btn span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Selected state */
.emoji-option input[type="radio"]:checked + .emoji-btn {
  background: #F0FDF4;
  border-color: var(--green);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(34,197,94,0.2);
}

.emoji-option input[value="2"]:checked + .emoji-btn {
  background: #FFF7ED;
  border-color: var(--orange);
  box-shadow: 0 6px 20px rgba(249,115,22,0.2);
}

.emoji-option input[value="1"]:checked + .emoji-btn {
  background: #FEF2F2;
  border-color: var(--red);
  box-shadow: 0 6px 20px rgba(239,68,68,0.2);
}

.emoji-option input:checked + .emoji-btn svg { transform: scale(1.1); }
.emoji-option input:checked + .emoji-btn span { color: var(--text); font-weight: 700; }

/* Error message */
.question-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 10px;
  display: none;
}

.has-error .question-error { display: block; }

/* COMMENT CARD */
.comment-card textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #F8FAFC;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
  margin-bottom: 12px;
}

.comment-card textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.comment-card textarea::placeholder { color: #94A3B8; }

/* FILE UPLOAD */
.file-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all 0.2s;
}

.file-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #EFF6FF;
}

.file-preview {
  margin-top: 10px;
  padding: 10px 14px;
  background: #EFF6FF;
  border-radius: 8px;
  font-size: 13px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-preview .file-remove {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}

/* SUBMIT BUTTON */
.submit-btn {
  width: 100%;
  padding: 17px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(37,99,235,0.35);
  letter-spacing: 0.3px;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,99,235,0.4);
}

.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.spin { animation: spin 0.8s linear infinite; }

/* THANKS SCREEN */
#screen-thanks {
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #EFF6FF 0%, #F0FDF4 100%);
}

.thanks-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.thanks-animation {
  margin-bottom: 28px;
}

.checkmark { display: block; }
.check-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw-check 0.5s ease 0.2s forwards;
}

@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

.thanks-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}

.thanks-text {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 320px;
  margin-bottom: 36px;
}

.thanks-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

/* ERROR CARD */
.error-card {
  text-align: center;
  padding: 36px 24px;
}

.error-icon { margin-bottom: 20px; }

.error-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* RESPONSIVE */
@media (min-width: 480px) {
  .page-wrap { padding: 32px 24px 60px; }
  .page-title { font-size: 30px; }
}
