:root {
  --ink: #18202a;
  --muted: #68727f;
  --line: #dfe4e8;
  --blue: #214d73;
  --blue-deep: #173a58;
  --cream: #f7f5ef;
  --white: #ffffff;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button, input, select { font: inherit; }
button { color: inherit; }

.app-shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 90% 3%, rgba(82, 142, 164, .13), transparent 28rem),
    var(--cream);
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 64px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
}

.brand {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: white;
  font: 800 30px/1 Georgia, serif;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .1);
}

.brand strong { display: block; font: 800 25px/1.05 Georgia, serif; color: var(--blue-deep); }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.language-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4f6f7;
}

.language-switch button {
  min-width: 44px;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.language-switch button.active { background: white; color: var(--blue); box-shadow: 0 2px 8px rgba(27, 55, 77, .12); }

.round-action, .profile-button {
  min-height: 47px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font-weight: 750;
}

.round-action { width: 47px; font-size: 26px; }
.profile-button { display: flex; gap: 8px; align-items: center; padding: 0 15px; }

.phrase-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px clamp(20px, 4vw, 64px) 14px;
  padding: 14px 16px 14px 18px;
  border: 2px solid #a9c4d4;
  border-radius: 20px;
  background: #edf7fb;
  box-shadow: 0 8px 24px rgba(27, 75, 104, .06);
}

.phrase-copy { display: flex; align-items: center; min-width: 0; gap: 14px; }
.sound-dot { flex: 0 0 auto; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: white; font-size: 24px; }
.phrase-copy small { display: block; color: #527287; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.phrase-copy strong { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; color: var(--blue-deep); font-size: clamp(17px, 2vw, 22px); white-space: nowrap; }
.phrase-actions { display: flex; gap: 8px; }
.speak-again, .clear-button { min-height: 48px; border-radius: 13px; padding: 0 18px; font-weight: 800; cursor: pointer; }
.speak-again { border: 0; background: var(--blue); color: white; }
.clear-button { border: 1px solid #b9ced9; background: white; color: var(--blue); }
.speak-again:disabled, .clear-button:disabled { opacity: .42; cursor: default; }

.quick-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 clamp(20px, 4vw, 64px) 16px;
}

.quick-card {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 17px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.quick-card:hover, .care-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(29, 42, 51, .12); }
.quick-card:active, .care-card:active { transform: scale(.98); }
.quick-card span { font-size: 24px; }
.quick-card strong { font-size: 17px; }
.quick-card.yes { background: #d9f0e4; color: #17603c; }
.quick-card.no { background: #f8dfdf; color: #842f33; }
.quick-card.help { background: #fff0c9; color: #775216; }
.quick-card.stop { background: #f0e4fa; color: #63338a; }

.board {
  flex: 1;
  padding: 24px clamp(20px, 4vw, 64px) 38px;
  background: white;
  border-radius: 32px 32px 0 0;
  box-shadow: 0 -4px 20px rgba(30, 51, 65, .05);
}

.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 92px;
  margin-bottom: 22px;
}

.heading-copy { min-width: 0; }
.board-heading p { max-width: 680px; margin: 8px 0 0; color: var(--muted); font-weight: 650; font-size: 15px; line-height: 1.45; }
.board-heading h1 { margin: 0; color: var(--blue-deep); font: 800 clamp(25px, 3.2vw, 38px)/1.1 Georgia, serif; }
.step-label { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.step-label span { padding: 5px 9px; border-radius: 999px; background: #e7f1f6; color: var(--blue); font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.step-label b { font-weight: 800; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.breadcrumb span + span::before { content: "›"; margin-right: 6px; color: #97a3ac; }
.navigation-actions { flex: 0 0 auto; display: flex; gap: 10px; }
.back-button, .start-over-button { min-height: 58px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; border-radius: 16px; font-weight: 900; font-size: 17px; cursor: pointer; }
.back-button { border: 2px solid #a9c4d4; background: #edf7fb; color: var(--blue-deep); }
.back-button span { font-size: 26px; line-height: 1; }
.start-over-button { border: 2px solid var(--blue); background: var(--blue); color: white; box-shadow: 0 8px 18px rgba(33, 77, 115, .18); }
.start-over-button span { font-size: 22px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 20px);
}

.care-card {
  position: relative;
  min-height: clamp(156px, 17vw, 220px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: clamp(18px, 2vw, 26px);
  overflow: hidden;
  border: 1px solid rgba(31, 53, 65, .08);
  border-radius: 24px;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.care-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  right: -35px;
  top: -38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .38);
}

.card-icon {
  min-width: 68px;
  min-height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, .68);
  font-size: clamp(36px, 4vw, 52px);
  line-height: 1;
}

.card-label { z-index: 1; max-width: 90%; font-size: clamp(18px, 2vw, 26px); font-weight: 850; line-height: 1.12; }
.card-copy { z-index: 1; display: grid; gap: 5px; margin-top: auto; padding-top: 20px; }
.card-description { max-width: 92%; font-size: 13px; font-weight: 650; line-height: 1.3; opacity: .72; }
.choice-count { width: fit-content; margin-top: 2px; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.55); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.card-arrow { position: absolute; right: 20px; bottom: 17px; font: 400 37px/1 Georgia, serif; opacity: .55; }
.tap-hint { z-index: 1; margin-top: 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .58; }
.care-card.sun { background: #fff1c7; color: #684c12; }
.care-card.sky { background: #dcedf7; color: #234f68; }
.care-card.mint { background: #dff1e6; color: #27573e; }
.care-card.lavender { background: #e9e4f6; color: #4e3d78; }
.care-card.rose { background: #f7dedf; color: #743234; }
.care-card.peach { background: #f8e5d3; color: #714829; }
.care-card.aqua { background: #d9f0ee; color: #235e5b; }
.care-card.blue { background: #dce6f3; color: #294f76; }
.care-card.custom { background: #eee8f4; color: #533a6a; }
.care-card.sage { background: #e1eee4; color: #315b3d; }
.care-card.lilac { background: #eee6f2; color: #5c3d69; }
.care-card.coral { background: #f7e1d9; color: #754230; }

footer {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px clamp(20px, 4vw, 64px);
  background: var(--blue-deep);
  color: white;
  font-size: 13px;
}

.status { display: flex; align-items: center; gap: 8px; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: #7ce1a8; box-shadow: 0 0 0 4px rgba(124, 225, 168, .12); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 35, 47, .55);
  backdrop-filter: blur(6px);
}

.modal {
  position: relative;
  width: min(100%, 480px);
  padding: 32px;
  border-radius: 26px;
  background: white;
  box-shadow: 0 22px 60px rgba(10, 30, 45, .28);
}

.modal-close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f1f3f4; font-size: 25px; cursor: pointer; }
.modal-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: #edf5f8; font-size: 30px; }
.modal h2 { margin: 20px 0 6px; color: var(--blue-deep); font: 800 30px/1.1 Georgia, serif; }
.modal p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.modal form { display: grid; gap: 16px; }
.modal label { display: grid; gap: 7px; font-size: 14px; font-weight: 800; color: #394754; }
.modal input, .modal select { width: 100%; min-height: 50px; padding: 0 14px; border: 1.5px solid #cfd7dc; border-radius: 12px; background: white; outline: none; }
.modal input:focus, .modal select:focus { border-color: #5086a8; box-shadow: 0 0 0 3px rgba(80, 134, 168, .14); }
.primary-submit { min-height: 52px; border: 0; border-radius: 13px; background: var(--blue); color: white; font-weight: 850; cursor: pointer; }
.voice-settings { margin: 2px 0 0; padding: 0; border: 0; }
.voice-settings legend { margin-bottom: 7px; color: #394754; font-size: 14px; font-weight: 800; }
.voice-settings p { margin: 0 0 12px; font-size: 13px; line-height: 1.45; }
.voice-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voice-options label {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px;
  border: 2px solid #d9e0e4;
  border-radius: 14px;
  background: #f8fafb;
  cursor: pointer;
}
.voice-options label:has(input:checked) { border-color: var(--blue); background: #eaf3f8; color: var(--blue-deep); }
.voice-options input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.voice-options span { font-size: 28px; }
.voice-options b { font-size: 15px; }

button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid #f1a71a; outline-offset: 3px; }

@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .care-card { min-height: 170px; }
  .board-heading { align-items: flex-start; }
  .navigation-actions { flex-direction: column; }
  .back-button, .start-over-button { min-width: 164px; }
}

@media (max-width: 680px) {
  .topbar { min-height: 78px; padding: 12px 16px; }
  .brand-mark { width: 46px; height: 46px; }
  .brand strong { font-size: 21px; }
  .brand small, .profile-copy { display: none; }
  .profile-button { width: 47px; justify-content: center; padding: 0; }
  .phrase-strip { align-items: stretch; margin: 14px 12px 10px; padding: 12px; }
  .phrase-copy { flex: 1; }
  .sound-dot { display: none; }
  .phrase-actions { flex-direction: column; }
  .speak-again, .clear-button { min-height: 38px; padding: 0 12px; }
  .quick-row { padding: 0 12px 12px; gap: 7px; }
  .quick-card { min-height: 60px; flex-direction: column; gap: 2px; }
  .quick-card span { font-size: 20px; }
  .quick-card strong { font-size: 13px; }
  .board { padding: 20px 12px 28px; border-radius: 24px 24px 0 0; }
  .board-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .navigation-actions { display: grid; grid-template-columns: 1fr 1.25fr; }
  .back-button, .start-over-button { min-width: 0; min-height: 58px; padding: 0 12px; font-size: 15px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .care-card { min-height: 155px; padding: 16px; border-radius: 20px; }
  .card-icon { min-width: 58px; min-height: 58px; font-size: 34px; }
  .card-label { font-size: 18px; }
  footer { justify-content: center; text-align: center; }
  footer > span:first-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Kintinuity Voice pilot enhancements */
.brand-mark {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #173f63, #2b6b7b);
}
.brand-mark span { position: relative; z-index: 2; }
.brand-mark i {
  position: absolute;
  width: 34px;
  height: 34px;
  right: -12px;
  bottom: -12px;
  border: 6px solid rgba(255,255,255,.28);
  border-radius: 50%;
}
.brand strong em {
  color: #2b7d77;
  font: inherit;
  font-style: normal;
}
.history-button {
  position: relative;
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font-weight: 800;
}
.history-button > span:first-child { font-size: 21px; }
.history-button b {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #2b7d77;
  color: white;
  font-size: 11px;
}
.phrase-strip.urgent {
  border-color: #d94f58;
  background: #fff0f0;
}
.smart-flow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr);
  gap: 22px;
  align-items: start;
}
.smart-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.smart-option {
  position: relative;
  min-height: 142px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 20px;
  border: 2px solid #d9e5ea;
  border-radius: 22px;
  background: #f4f9fb;
  color: var(--blue-deep);
  text-align: left;
  cursor: pointer;
  transition: .15s ease;
}
.smart-option:hover { transform: translateY(-2px); border-color: #87b2c5; box-shadow: 0 10px 22px rgba(29,42,51,.1); }
.smart-option.selected { border-color: #2b7d77; background: #e2f2ee; box-shadow: inset 0 0 0 2px rgba(43,125,119,.1); }
.smart-option > span { font-size: 40px; }
.smart-option strong { font-size: 19px; line-height: 1.15; }
.smart-option i {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: #2b7d77;
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(29,42,51,.1);
}
.request-preview {
  position: sticky;
  top: 18px;
  padding: 22px;
  border: 2px solid #aac9d6;
  border-radius: 24px;
  background: #edf7fb;
}
.request-preview > small {
  color: #527287;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.request-preview blockquote {
  margin: 14px 0 20px;
  color: var(--blue-deep);
  font: 800 24px/1.35 Georgia, serif;
}
.request-preview-actions { display: grid; gap: 9px; }
.say-request, .send-request, .reset-options, .preview-button {
  min-height: 50px;
  border-radius: 13px;
  font-weight: 850;
  cursor: pointer;
}
.say-request { border: 0; background: var(--blue); color: white; }
.send-request { border: 0; background: #26775d; color: white; }
.reset-options { border: 1px solid #b8cdd7; background: white; color: var(--blue); }
.reset-options:disabled { opacity: .4; cursor: default; }
.request-preview p { margin: 16px 0 0; color: #5f7480; font-size: 12px; line-height: 1.5; }
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  padding: 13px 19px;
  border-radius: 999px;
  background: #173a58;
  color: white;
  box-shadow: 0 12px 35px rgba(15,37,54,.24);
  font-weight: 850;
}
.urgent-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(80, 16, 21, .72);
  backdrop-filter: blur(8px);
}
.urgent-panel {
  width: min(100%, 560px);
  padding: 38px;
  border-radius: 28px;
  background: white;
  text-align: center;
  box-shadow: 0 26px 70px rgba(47,5,9,.34);
}
.urgent-icon { font-size: 64px; }
.urgent-panel h2 { margin: 16px 0 8px; color: #8f252c; font: 850 34px/1.1 Georgia, serif; }
.urgent-panel p { margin: 0 0 10px; color: #4d2427; font-size: 22px; font-weight: 800; line-height: 1.4; }
.urgent-panel small { display: block; color: #6f5a5c; line-height: 1.4; }
.urgent-panel button { min-height: 54px; margin-top: 24px; padding: 0 24px; border: 0; border-radius: 14px; background: #8f252c; color: white; font-weight: 850; cursor: pointer; }
.history-modal { width: min(100%, 700px); max-height: 82svh; overflow: auto; }
.request-list { display: grid; gap: 10px; }
.request-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border-left: 5px solid #7fa9bd;
  border-radius: 12px;
  background: #f5f8fa;
}
.request-item.important { border-left-color: #d1942d; }
.request-item.urgent { border-left-color: #c8434d; background: #fff1f1; }
.request-item div { display: grid; gap: 5px; }
.request-item small { color: var(--muted); }
.request-item > span { align-self: start; padding: 5px 8px; border-radius: 999px; background: white; color: var(--blue); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.settings-modal { width: min(100%, 650px); max-height: 88svh; overflow: auto; }
.tone-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tone-options label {
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px;
  border: 2px solid #d9e0e4;
  border-radius: 13px;
  background: #f8fafb;
  text-align: center;
  cursor: pointer;
}
.tone-options label:has(input:checked) { border-color: #2b7d77; background: #e7f4f1; }
.tone-options input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.tone-options small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview-button { border: 1px solid #a8c5d2; background: #edf7fb; color: var(--blue); }
.voice-count { display: block; margin-top: 13px; color: var(--muted); text-align: center; }
.modal label > small { display: inline; color: var(--muted); font-weight: 600; }
.modal input[type="range"] { padding: 0; }

@media (max-width: 1040px) {
  .smart-flow-layout { grid-template-columns: 1fr; }
  .request-preview { position: static; }
  .smart-option-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .history-button { width: 47px; justify-content: center; padding: 0; }
  .history-button b { position: absolute; top: -7px; right: -5px; }
  .smart-option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .smart-option { min-height: 128px; }
  .tone-options { grid-template-columns: repeat(2, 1fr); }
  .settings-actions { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
