:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --surface: #0b1220;
  --surface-light: #111a2f;
  --text: #f8fafc;
  --text-dim: #cbd5f5;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --border: rgba(148, 163, 184, 0.2);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b, #020617 70%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('data:image/svg+xml,%3Csvg width="1440" height="1024" xmlns="http://www.w3.org/2000/svg"%3E%3Cdefs%3E%3ClinearGradient id="g" x1="0%25" x2="0%25" y1="0%25" y2="100%25"%3E%3Cstop offset="0%25" stop-color="%2322566b"/%3E%3Cstop offset="100%25" stop-color="%23161a2e"/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width="1440" height="1024" fill="url(%23g)" opacity="0.15"/%3E%3C/svg%3E')
    center / cover no-repeat;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.55), transparent 70%);
  top: 10%;
  right: 10%;
  filter: blur(20px);
  z-index: -1;
}

.app-shell {
  width: min(100%, 380px);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(2, 6, 23, 0.7);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  height: 720px;
  max-height: 90vh;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.app-header h1 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.step-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background-color: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  animation: fadeSlide 0.35s ease;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.progress {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.progress span {
  width: 32px;
  height: 4px;
  border-radius: 999px;
  background-color: rgba(148, 163, 184, 0.3);
}

.progress span.active {
  background-color: var(--accent-strong);
}

label {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.field-label {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  grid-auto-rows: 1fr;
}

.option-button {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background-color: rgba(15, 23, 42, 0.6);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
  height: 100%;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.option-button.selected {
  border-color: var(--accent-strong);
  background-color: rgba(14, 165, 233, 0.15);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.option-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type='text'],
input[type='number'] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background-color: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 1rem;
}

input::placeholder {
  color: rgba(148, 163, 184, 0.8);
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

button {
  border: none;
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(120deg, var(--accent-strong), #22d3ee);
  color: var(--surface);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

.secondary {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.secondary:hover,
.primary:hover {
  transform: translateY(-1px);
}

.result-card {
  display: grid;
  gap: 12px;
}

.result-card h2 {
  font-size: 1.1rem;
}

.result-summary {
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background-color: rgba(15, 23, 42, 0.6);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-hint {
  font-size: 0.95rem;
  color: rgba(248, 250, 252, 0.8);
}

.result-emphasis {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
}

.credit-cta {
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.credit-cta p {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.credit-card {
  gap: 16px;
}

.credit-section {
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background-color: rgba(15, 23, 42, 0.5);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.credit-apr-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apr-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apr-input input {
  flex: 1;
}

.apr-input span {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.credit-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.credit-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.credit-amount {
  font-size: 1.1rem;
  font-weight: 600;
}

.credit-rows {
  display: grid;
  gap: 12px;
}

.credit-row {
  display: flex;
  border-radius: 16px;
  padding: 14px 16px;
  background-color: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.credit-row strong {
  font-size: 1rem;
}

.credit-row span {
  display: block;
}

.credit-effort {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.credit-extra {
  font-size: 0.85rem;
  color: rgba(248, 250, 252, 0.75);
  margin-top: 6px;
}

.app-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.8);
}

@media (max-height: 700px) {
  .app-shell {
    height: 640px;
  }
}
