:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --shadow-card: 0 20px 40px -10px rgba(0, 0, 0, 0.08), 0 8px 16px -8px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Texture overlay for premium feel */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
  opacity: 0.03;
  pointer-events: none;
  z-index: -1;
}

.app-container {
  width: 100%;
  max-width: 540px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.app-header {
  text-align: center;
  padding: 36px 20px 16px;
}

.app-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.app-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.app-main {
  padding: 16px 20px 36px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.card {
  grid-column: 1;
  grid-row: 1;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(255, 255, 255, 1);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(10px);
  z-index: 1;
  pointer-events: none;
}

.card.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  z-index: 2;
  pointer-events: auto;
}

.card.hidden {
  display: none !important;
}

/* Icon Container */
.icon-container {
  width: 84px;
  height: 84px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: inset 0 0 20px rgba(255,255,255,0.5);
}

.camera-icon {
  width: 42px;
  height: 42px;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.description {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
  word-break: keep-all;
}

/* Form Styles */
.info-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-left: 4px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--bg-color);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
  letter-spacing: -0.2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(236, 72, 153, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background: var(--text-muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Agreement Section */
.agreement-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.agreement-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}

.btn-text-link:hover {
  color: var(--primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.7;
}

.modal-body h4 {
  font-size: 1rem;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--primary);
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-body p {
  margin-bottom: 12px;
}

.upload-label {
  margin: 0;
}

.upload-label input[type="file"] {
  display: none;
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-main);
  margin-top: 16px;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Camera Guide & Progress */
.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  gap: 12px;
}

.progress-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  border: 2px solid rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.progress-step.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.progress-step.completed {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.progress-line {
  height: 2px;
  width: 40px;
  background: rgba(0,0,0,0.1);
}

.camera-guide-container {
  position: relative;
  width: 100%;
  height: 260px;
  background: #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.guide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

#step-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

#step-preview.hidden {
  display: none;
}

.camera-icon-small {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

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

/* Scanner Image Preview */
.image-preview-container {
  position: relative;
  width: 100%;
  height: 260px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 24px;
  background: #000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

#image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  filter: contrast(1.1) brightness(1.1);
}

.scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--success);
  box-shadow: 0 0 20px 8px rgba(16, 185, 129, 0.4);
  animation: scan 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes scan {
  0% { top: -10px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.loading-text {
  animation: pulse 2s infinite;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes pulse {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Results */
.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,0.03);
}

.result-item h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.status-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info { background: #eff6ff; color: #1d4ed8; }
.badge-success { background: #ecfdf5; color: #047857; }

.recommendation-box {
  background: linear-gradient(145deg, rgba(99,102,241,0.04), rgba(236,72,153,0.04));
  padding: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  text-align: left;
  border: 1px solid rgba(99,102,241,0.1);
  position: relative;
}

.recommendation-box::before {
  content: "💡";
  position: absolute;
  top: 24px;
  left: 24px;
  font-size: 1.2rem;
}

.recommendation-box h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--primary);
  padding-left: 32px;
}

.recommendation-box p {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
}

.recommendation-box b {
  color: var(--primary);
}