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

:root {
  --bg: #000;
  --surface: #111;
  --border: #222;
  --text: #fff;
  --text-secondary: #999;
  --text-muted: #555;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --disabled-bg: #1a1a1a;
  --disabled-text: #444;
}

.light {
  --bg: #fff;
  --surface: #f5f5f5;
  --border: #e0e0e0;
  --text: #000;
  --text-secondary: #555;
  --text-muted: #999;
  --disabled-bg: #eee;
  --disabled-text: #aaa;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px;
}

/* Dark mode toggle */
.dark-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: background 0.2s;
  z-index: 100;
}
.dark-toggle:hover {
  background: var(--border);
}

/* Header */
header {
  margin-bottom: 48px;
}
header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}
header p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Form */
.form-label {
  display: block;
  font-size: 14px;
  font-style: italic;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 16px;
}

textarea {
  width: 100%;
  height: 180px;
  padding: 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
textarea::placeholder {
  color: var(--text-muted);
}
textarea:focus {
  border-color: var(--accent);
}

.submit-btn {
  width: 100%;
  margin-top: 24px;
  padding: 16px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s;
}
.submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.submit-btn:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: not-allowed;
}
.submit-btn .arrow {
  transition: transform 0.2s;
}
.submit-btn:hover:not(:disabled) .arrow {
  transform: translateX(4px);
}

/* Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Error */
.error-msg {
  margin-top: 24px;
  padding: 16px;
  background: #1a0000;
  border: 1px solid #3a0000;
  border-radius: 8px;
  color: #f87171;
  text-align: center;
}
.light .error-msg {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* Results */
.results {
  margin-top: 64px;
}

.answer-card {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 32px;
}
.answer-card .big-answer {
  font-size: clamp(72px, 15vw, 160px);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 16px;
}
.answer-card .answer-sub {
  font-size: 20px;
  color: var(--text-secondary);
}

/* Cost grid */
.cost-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
@media (max-width: 600px) {
  .cost-grid {
    grid-template-columns: 1fr;
  }
}

.cost-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}
.cost-card .label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.cost-card .amount {
  font-size: 36px;
  font-weight: 700;
}
.cost-card .detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

/* Explanation */
.explanation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}
.explanation-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}
.explanation-card p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.disclaimer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
