@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --bg: #f7fbff;
  --surface: #ffffff;
  --ink: #263247;
  --muted: #667085;
  --purple: #8b72d6;
  --purple-dark: #6552a8;
  --pink: #f4b8d0;
  --yellow: #ffe39a;
  --mint: #bdebd9;
  --blue: #bcdcf7;
  --coral: #f4ad9e;
  --border: #dfe7f1;
  --danger: #c85f67;
  --shadow: 0 16px 38px rgba(59, 74, 105, .12);
  --radius: 28px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 6%, rgba(244,184,208,.38), transparent 24rem),
    radial-gradient(circle at 92% 10%, rgba(189,235,217,.55), transparent 26rem),
    radial-gradient(circle at 70% 90%, rgba(188,220,247,.45), transparent 28rem),
    var(--bg);
}

button, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: env(safe-area-inset-top) 18px calc(30px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 2px 18px;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: clamp(1.65rem, 5vw, 2.25rem);
  line-height: 1;
  font-weight: 900;
}

.eyebrow {
  margin: 0;
  color: var(--purple-dark);
  font-weight: 900;
  font-size: .73rem;
  letter-spacing: .13em;
}

.view { display: none; }
.view.active { display: block; }

.hero-card,
.content-card,
.emergency-panel {
  border: 1px solid rgba(223,231,241,.95);
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(242,238,255,.98));
}

.hero-card::after {
  content: "✦";
  position: absolute;
  right: 26px;
  top: 20px;
  font-size: 3.4rem;
  color: var(--yellow);
  transform: rotate(12deg);
}

.hero-card h2,
.content-card h2,
.emergency-panel h2 {
  margin: 5px 0 8px;
  font-size: clamp(1.75rem, 6vw, 2.55rem);
  line-height: 1.04;
  font-weight: 900;
}

.hero-card p:last-child,
.muted,
.lead { color: var(--muted); }

.hero-kicker {
  margin: 0;
  color: var(--purple-dark);
  font-weight: 900;
}

.action-grid {
  display: grid;
  gap: 12px;
}

.action-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  padding: 18px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(59,74,105,.07);
  transition: transform .15s ease, box-shadow .15s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(59,74,105,.11);
}

.action-card:nth-child(2) .icon { background: var(--pink); }
.action-card:nth-child(3) .icon { background: var(--yellow); }
.action-card:nth-child(4) .icon { background: var(--mint); }

.action-card.emergency {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
}

.action-card strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 900;
}

.action-card small {
  display: block;
  margin-top: 3px;
  opacity: .8;
}

.icon {
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--blue);
  font-size: 1.3rem;
}

.emergency .icon {
  color: var(--purple-dark);
  background: white;
}

.back-button,
.ghost-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 15px;
  background: rgba(255,255,255,.84);
  color: var(--ink);
  font-weight: 900;
}

.back-button { margin-bottom: 12px; }

.emergency-panel {
  border: 2px solid var(--purple);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,247,255,.98));
}

.breath-box,
.gentle-note,
.summary-card,
.mini-plan {
  margin: 18px 0;
  border-radius: 20px;
  padding: 17px;
}

.breath-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #f1ebff, #eef9ff);
}

.breath-circle {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border: 3px solid var(--purple);
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(.7); opacity: .55; }
  37.5% { transform: scale(1); opacity: 1; }
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-list button {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: white;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  font-weight: 800;
}

.choice-list button:hover { border-color: var(--purple); }

.primary-button,
.danger-button {
  width: 100%;
  border: 0;
  border-radius: 17px;
  padding: 15px 18px;
  margin-top: 14px;
  font-weight: 900;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--purple-dark), var(--purple));
}

.danger-button {
  color: white;
  background: var(--danger);
}

.result-card,
.translation-output,
.repair-card {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: white;
  padding: 18px;
}

.result-card h4,
.translation-output h3 { margin: 0 0 8px; }

.label {
  color: var(--purple-dark);
  font-weight: 900;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.quote {
  font-size: 1.08rem;
  font-weight: 800;
}

.hidden { display: none; }

label {
  display: block;
  margin: 16px 0 7px;
  font-weight: 900;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: white;
  color: var(--ink);
  padding: 13px;
}

textarea { resize: vertical; }

.translation-output section + section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.translation-output h3 {
  color: var(--purple-dark);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.translation-output p { margin: 0; }

.script-section {
  border-radius: 16px;
  background: #f6f2ff;
  padding: 14px !important;
}

.repair-card {
  border-left: 7px solid var(--pink);
}

.repair-card p:first-child { margin-top: 0; }
.repair-card p:last-child { margin-bottom: 0; }

.gentle-note { background: #fff7d8; }

.mini-plan {
  background: #eefaf5;
  border: 1px solid #d4eee4;
}

.mini-plan ol {
  margin: 8px 0 0;
  padding-left: 21px;
}

.mini-plan li + li { margin-top: 7px; }

.status-text {
  min-height: 1.4em;
  color: var(--purple-dark);
  font-weight: 800;
  text-align: center;
}

.summary-card { background: #eef5ff; }

.pattern-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pattern-item {
  border: 1px solid var(--border);
  border-radius: 17px;
  background: white;
  padding: 14px;
}

.pattern-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.full-width {
  width: 100%;
  margin-top: 16px;
}

@media (min-width: 650px) {
  .action-grid { grid-template-columns: 1fr 1fr; }
  .app-shell { padding-left: 24px; padding-right: 24px; }
}
