:root {
  /* Warm Neutral Color Palette */
  --sand: #E8DCC8;
  --clay: #C4B5A0;
  --cream: #F5F1EB;
  --cocoa: #3D3028;
  --muted-blue: #5B8DBE;
  --soft-green: #8CAF76;
  
  /* Semantic Colors */
  --bg-primary: #FBF8F3;
  --bg-secondary: #F0EDE5;
  --text-primary: #3D3028;
  --text-secondary: #6B6B6B;
  --border-color: rgba(189, 159, 128, 0.2);
  --shadow-soft: rgba(61, 48, 40, 0.08);
  
  font-family: "Segoe Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #FBF8F3 0%, #F5F1EB 100%);
  color: var(--text-primary);
  line-height: 1.6;
  font-family: inherit;
  font-weight: 400;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

h1, h2, h3, p, li, label, span, strong, button, textarea, output {
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

body {
  display: flex;
  flex-direction: column;
}

.page-shell {
  width: min(1000px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 2rem;
  flex: 1;
}

/* Header */
.page-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
}

h1 {
  margin: 0;
  font-size: 2.75rem;
  line-height: 1.05;
  color: var(--cocoa);
  font-weight: 600;
}

.hero-subtitle {
  margin: 0;
  max-width: 50rem;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Hero Section */
.hero-section {
  margin-bottom: 4rem;
}

.hero-form {
  display: grid;
  gap: 2rem;
}

.hero-input-group {
  display: grid;
  gap: 0.75rem;
}

.hero-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cocoa);
}

textarea {
  width: 100%;
  padding: 1.25rem 1.25rem 3.75rem;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea.placeholder-active {
  color: var(--text-secondary);
}

.hero-textarea-wrapper {
  position: relative;
}

.prompt-submit-button {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: none;
  background: var(--cocoa);
  color: var(--cream);
  font-size: 1.45rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(61, 48, 40, 0.18);
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.section-separator {
  width: 100%;
  border: none;
  border-top: 1px solid rgba(189, 159, 128, 0.2);
  margin: 3rem 0 1.5rem;
}

.slider-value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.slider-unit {
  font-size: 0.95rem;
}

.setting-note {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.prompt-submit-button.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.prompt-submit-button:hover,
.prompt-submit-button:focus {
  background: #342b21;
}

.impact-cards-primary .impact-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(245, 241, 235, 0.98) 100%);
  border: 1px solid rgba(61, 48, 40, 0.14);
  box-shadow: 0 16px 28px rgba(61, 48, 40, 0.10);
}

.impact-cards-secondary .impact-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(61, 48, 40, 0.08);
  box-shadow: 0 8px 18px rgba(61, 48, 40, 0.06);
  opacity: 0.96;
}

.impact-cards-secondary {
  opacity: 0.96;
}

textarea:focus {
  outline: none;
  border-color: var(--muted-blue);
  box-shadow: 0 0 0 3px rgba(91, 141, 190, 0.1);
}

.hero-note {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

.token-indicator {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Settings Panel */
.settings-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  padding: 1.5rem;
  background: rgba(232, 220, 200, 0.15);
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.settings-group {
  display: grid;
  gap: 0.75rem;
}

.settings-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cocoa);
}

select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%233D3028' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

select:focus {
  outline: none;
  border-color: var(--muted-blue);
}

.setting-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.slider-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--muted-blue) 0%, var(--soft-green) 100%);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cocoa);
  cursor: pointer;
  box-shadow: 0 2px 4px var(--shadow-soft);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cocoa);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px var(--shadow-soft);
}

output {
  font-weight: 700;
  color: var(--muted-blue);
  min-width: 2.5rem;
  text-align: right;
}

.slider-unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Annual Impact Section */
.annual-impact-section {
  margin-bottom: 3rem;
  scroll-margin-top: 100px;
}

.section-title {
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  color: var(--cocoa);
  font-weight: 600;
}

.section-note {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 54rem;
}

.impact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.impact-card {
  padding: 2rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(245, 241, 235, 0.8) 100%);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 4px 12px var(--shadow-soft);
}

.impact-cards-primary .impact-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(245, 241, 235, 0.96) 100%);
  border-color: rgba(61, 48, 40, 0.14);
  box-shadow: 0 16px 32px rgba(61, 48, 40, 0.12);
}

.impact-cards-secondary .impact-card {
  background: rgba(232, 220, 200, 0.12);
  border-color: rgba(189, 159, 128, 0.16);
  box-shadow: 0 8px 18px rgba(61, 48, 40, 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card-emoji {
  font-size: 2.5rem;
  display: block;
}

.impact-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--cocoa);
  font-weight: 600;
}

.card-value {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.card-value strong {
  font-size: 1.75rem;
  color: var(--muted-blue);
  font-weight: 700;
}

.card-unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Micro-Impact Section */
.micro-impact-section {
  margin-bottom: 3rem;
}

.info-card {
  padding: 1.5rem;
  background: rgba(232, 220, 200, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin: 0;
}

.metrics-grid div {
  display: grid;
  gap: 0.4rem;
}

.metrics-grid dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.metrics-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cocoa);
}

/* Footer */
.page-footer {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 2px solid var(--border-color);
  background: rgba(232, 220, 200, 0.08);
}

/* Debt Clock Section */
.debt-clock-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem 0 0;
  border-top: 1px dashed var(--border-color);
  background: rgba(232, 220, 200, 0.06);
}

.debt-clock-section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--cocoa);
  font-weight: 600;
}

.debt-subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: normal;
}

.debt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.debt-card {
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(200, 181, 160, 0.2) 0%, rgba(139, 175, 118, 0.1) 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.debt-label {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 700;
}

.debt-card strong {
  display: block;
  font-size: 1.75rem;
  color: var(--cocoa);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.debt-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Methodology Section */
.methodology-section {
  display: grid;
  gap: 2.5rem;
}

.reference-subsection {
  display: grid;
  gap: 1rem;
}

.reference-subsection h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--cocoa);
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.reference-table th {
  text-align: left;
  padding: 0.75rem;
  background: rgba(91, 141, 190, 0.1);
  color: var(--cocoa);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
}

.reference-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.reference-list {
  margin: 0;
  padding-left: 1.5rem;
}

.reference-list li {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.reference-list a {
  color: var(--muted-blue);
  text-decoration: none;
  font-weight: 500;
}

.reference-list a:hover {
  text-decoration: underline;
}

.reference-note {
  padding: 1rem;
  background: rgba(139, 175, 118, 0.1);
  border-left: 3px solid var(--soft-green);
  border-radius: 8px;
}

.reference-note p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .page-shell {
    width: calc(100% - 1.5rem);
    padding: 2rem 0 1rem;
  }

  h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .settings-panel {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .impact-cards {
    grid-template-columns: 1fr;
  }

  .impact-card {
    padding: 1.5rem;
  }

  .reference-table {
    font-size: 0.85rem;
  }

  .reference-table th,
  .reference-table td {
    padding: 0.5rem;
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}
