:root {
  color-scheme: light;
  --ink: #2b2028;
  --muted: #745f6d;
  --paper: #fff1f3;
  --panel: #fffafa;
  --line: #f0ccd7;
  --teal: #5d8f89;
  --teal-2: #dff5f0;
  --coral: #e36f95;
  --coral-2: #ffe1eb;
  --gold: #d99f54;
  --gold-2: #fff0c9;
  --blue: #7a77b8;
  --blue-2: #ece9ff;
  --pink: #ffb4c8;
  --pink-2: #ffe6ee;
  --shadow: 0 22px 60px rgba(128, 74, 96, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 180, 200, 0.48), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(255, 235, 199, 0.68), transparent 26%),
    linear-gradient(135deg, #ffd9e4 0%, #fff0f3 42%, #fff7e8 100%);
}

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

.app-shell {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
}

.workspace {
  width: min(1280px, 100%);
  min-height: min(780px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: 386px 1fr;
  background: rgba(255, 250, 251, 0.94);
  border: 1px solid rgba(237, 214, 223, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.side-panel {
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(255, 225, 235, 0.96), rgba(255, 241, 219, 0.9)),
    radial-gradient(circle, rgba(255, 255, 255, 0.65) 1px, transparent 1px);
  background-size: auto, 18px 18px;
  border-right: 1px solid var(--line);
}

.brand-lockup,
.passport-top,
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  justify-content: flex-start;
}

.brand-mark {
  width: 58px;
  height: 58px;
  position: relative;
  display: grid;
  place-items: center;
  background: var(--coral);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(216, 111, 143, 0.24);
}

.brand-mark span {
  position: absolute;
  width: 32px;
  height: 14px;
  border-radius: 18px;
  background: #fff9ec;
  transform: rotate(-22deg);
}

.brand-mark span + span {
  background: #fff0c9;
  transform: rotate(22deg) translateY(10px);
}

.eyebrow {
  margin: 0 0 6px;
  color: #9f4f70;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

h3 {
  margin-bottom: 4px;
}

.mission {
  margin: 28px 0 16px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.55;
}

.mascot-card {
  height: 138px;
  margin: 0 0 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff7e5, #ffe3ed);
  box-shadow: 0 12px 28px rgba(128, 74, 96, 0.1);
  overflow: hidden;
}

.mascot-card svg {
  width: 170px;
  height: 126px;
}

.mascot-cloud {
  fill: #fffaf0;
  stroke: #f0ccd7;
  stroke-width: 2;
}

.mascot-body,
.mascot-ear {
  fill: #fffaf0;
  stroke: #6f5967;
  stroke-width: 3;
  stroke-linejoin: round;
}

.mascot-belly {
  fill: #ffcad9;
  stroke: #6f5967;
  stroke-width: 3;
}

.mascot-face,
.mascot-arm,
.mascot-star {
  fill: none;
  stroke: #6f5967;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mascot-star {
  fill: #ffe59d;
}

.moment-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #34423f;
  font-weight: 750;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdfb;
  color: var(--ink);
  padding: 12px 13px;
  border-radius: 8px;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(216, 111, 143, 0.18);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-action {
  min-height: 52px;
  border: 0;
  color: white;
  background: linear-gradient(135deg, #d86f8f, #b45f93);
  border-radius: 8px;
  font-weight: 850;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.primary-action span {
  font-size: 1.35rem;
  line-height: 1;
}

.main-panel {
  padding: 26px;
  background: var(--panel);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
}

.tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #fff1f6;
  border-radius: 8px;
  overflow: hidden;
}

.tab {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  padding: 0 10px;
}

.tab.active {
  background: #2b2028;
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.icon-button {
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--pink-2);
  color: #9f4f70;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.play-glyph {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
}

.story-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.story-card,
.choice-card,
.passport-card,
.mini-panel,
.rescue-card,
.rescue-step,
.translation-output,
.simple-line,
.phrase-builder,
.guess-panel,
.guess-output,
.decode-output,
.assist-card,
.now-step,
.caregiver-setup,
.learning-panel,
.pattern-card {
  border: 1px solid var(--line);
  background: #fffdfb;
  border-radius: 8px;
}

.assist-layout {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 14px;
  align-items: start;
}

.person-mode {
  display: grid;
  gap: 14px;
}

.assist-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.assist-card {
  min-height: 178px;
  padding: 16px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(128, 74, 96, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.assist-speak {
  min-width: 0;
  border: 0;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.assist-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(128, 74, 96, 0.13);
}

.assist-visual {
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 4px;
  overflow: hidden;
  background: #ffeef4;
  border: 2px solid rgba(86, 60, 73, 0.8);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 950;
  text-align: center;
}

.assist-icon {
  width: 50px;
  height: 50px;
  display: block;
}

.assist-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assist-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assist-card[data-kind="body"] .assist-visual {
  background: #ffe2ec;
}

.assist-card[data-kind="place"] .assist-visual {
  background: #fff0c7;
}

.assist-card[data-kind="person"] .assist-visual {
  background: #eee9ff;
}

.delete-card {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff1f6;
  color: #9f4f70;
  border-radius: 8px;
  font-weight: 850;
  cursor: pointer;
}

.assist-label {
  display: block;
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 950;
}

.assist-phrase {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.now-step,
.caregiver-setup,
.learning-panel {
  padding: 18px;
}

.learning-panel {
  display: grid;
  gap: 12px;
}

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

.pattern-card {
  padding: 14px;
  background: #fff3f7;
}

.pattern-card strong {
  display: block;
  margin-bottom: 4px;
}

.pattern-card span {
  color: var(--muted);
}

.now-step-body {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  align-items: center;
  margin: 12px 0 16px;
}

.step-visual {
  width: 84px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--gold-2);
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-size: 2rem;
  font-weight: 950;
}

.step-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.caregiver-setup {
  display: none;
  gap: 12px;
}

.caregiver-setup.open {
  display: grid;
}

.story-card {
  min-height: 132px;
  padding: 18px;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 16px;
  align-items: center;
}

.pictogram,
.choice-icon,
.avatar {
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
}

.pictogram {
  width: 70px;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  background: var(--gold-2);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.pictogram::before,
.pictogram::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.icon-car::before {
  width: 44px;
  height: 18px;
  border-radius: 18px 18px 6px 6px;
}

.icon-car::after {
  width: 48px;
  height: 8px;
  bottom: 14px;
  box-shadow: -14px 10px 0 -1px currentColor, 14px 10px 0 -1px currentColor;
}

.icon-chair::before {
  width: 34px;
  height: 24px;
  top: 16px;
}

.icon-chair::after {
  width: 8px;
  height: 38px;
  bottom: 10px;
  box-shadow: 24px 0 0 currentColor;
}

.icon-mirror::before {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 6px solid currentColor;
  background: transparent;
}

.icon-mirror::after {
  width: 8px;
  height: 24px;
  bottom: 9px;
  transform: rotate(-35deg);
}

.icon-hand::before {
  width: 12px;
  height: 42px;
  border-radius: 10px;
  box-shadow:
    12px 4px 0 currentColor,
    24px 9px 0 currentColor,
    36px 15px 0 currentColor;
}

.icon-hand::after {
  width: 38px;
  height: 22px;
  bottom: 12px;
  border-radius: 18px 18px 6px 6px;
}

.icon-home::before {
  width: 42px;
  height: 34px;
  bottom: 12px;
}

.icon-home::after {
  width: 40px;
  height: 40px;
  transform: rotate(45deg);
  top: 10px;
}

.icon-star::before {
  width: 44px;
  height: 44px;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 67% 56%, 79% 91%, 50% 70%, 21% 91%, 33% 56%, 2% 35%, 39% 35%);
}

.story-card:nth-child(2n) .pictogram,
.choice-card:nth-child(2n) .choice-icon {
  background: var(--blue-2);
}

.story-card:nth-child(3n) .pictogram,
.choice-card:nth-child(3n) .choice-icon {
  background: var(--pink-2);
}

.step-number {
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.story-card p,
.choice-card p,
.passport-card p,
.rescue-card p,
.rescue-step p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.support-strip {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 14px;
}

.mini-panel {
  padding: 18px;
}

.forecast-list,
.rescue-steps,
.translation-output {
  display: grid;
  gap: 10px;
}

.forecast-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
}

.forecast-item strong {
  color: var(--ink);
}

.first-then {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.first-then div {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--gold-2);
  border: 1px solid #e1ca8d;
  border-radius: 8px;
}

.first-then div + div {
  background: var(--teal-2);
  border-color: #abd2cb;
}

.first-then strong {
  color: var(--coral);
  text-transform: uppercase;
  font-size: 0.76rem;
}

.first-then span {
  font-size: 1.15rem;
  font-weight: 900;
}

.small-action {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #2b2028;
  color: white;
  padding: 0 18px;
  font-weight: 850;
  cursor: pointer;
  border-radius: 8px;
}

.rescue-layout,
.translator,
.speech-layout {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}

.speech-layout {
  grid-template-columns: 1fr 1fr;
}

.phrase-builder,
.guess-panel {
  padding: 20px;
}

#phraseOutput {
  min-height: 86px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #d86f8f, #7a77b8);
  color: white;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 900;
  text-align: center;
  border-radius: 8px;
}

.phrase-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.phrase-column {
  display: grid;
  align-content: start;
  gap: 8px;
}

.phrase-column h3 {
  font-size: 0.9rem;
  color: var(--muted);
}

.word-chip,
.clue-chip {
  min-height: 48px;
  border: 1px solid var(--line);
  background: #fff3f7;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
}

.word-chip.active,
.clue-chip.active {
  background: var(--pink-2);
  border-color: var(--coral);
}

.clue-grid {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.decoder-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.decoder-grid .small-action {
  align-self: end;
}

.decode-output,
.guess-output {
  padding: 16px;
  margin-top: 12px;
  background: var(--blue-2);
}

.decode-output {
  background: #fff3d6;
}

.decode-output strong,
.guess-output strong {
  display: block;
  margin-bottom: 8px;
}

.confirm-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.rescue-card {
  padding: 22px;
  background: var(--coral-2);
  position: relative;
}

.status-dot {
  width: 14px;
  aspect-ratio: 1;
  display: inline-block;
  background: var(--coral);
  margin-bottom: 12px;
}

.rescue-steps {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rescue-step {
  min-height: 172px;
  padding: 16px;
}

.rescue-step span {
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: var(--coral);
  color: white;
  font-weight: 900;
}

.translator textarea {
  resize: vertical;
}

.translation-output {
  padding: 14px;
  background: #fff3f7;
}

.simple-line {
  padding: 14px;
  background: #fffdfb;
  color: var(--ink);
  font-weight: 750;
}

.choice-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.choice-card {
  min-height: 144px;
  padding: 18px;
  display: grid;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(128, 74, 96, 0.07);
}

.choice-icon,
.avatar {
  width: 54px;
  aspect-ratio: 1;
  background: var(--teal-2);
  font-size: 1rem;
  letter-spacing: 0;
  border-radius: 8px;
}

.passport-card {
  margin-top: 22px;
  padding: 24px;
}

.avatar {
  flex: 0 0 auto;
  background: var(--coral);
  color: white;
}

.passport-list {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.passport-item {
  padding: 14px;
  background: #fff3f7;
  border-left: 5px solid var(--coral);
  border-radius: 8px;
}

.passport-item strong {
  display: block;
  margin-bottom: 5px;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .story-grid,
  .choice-grid,
  .passport-list,
  .support-strip,
  .rescue-steps,
  .speech-layout,
  .phrase-columns,
  .assist-layout,
  .assist-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .side-panel,
  .main-panel {
    padding: 20px;
  }

  .tabs {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .field-grid,
  .first-then {
    grid-template-columns: 1fr;
  }

  .story-card {
    grid-template-columns: 56px 1fr;
    min-height: 126px;
  }

  .pictogram {
    width: 56px;
  }
}

.feedback-page {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: start center;
}

.feedback-shell {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 18px;
}

.feedback-intro,
.feedback-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 251, 0.95);
  box-shadow: var(--shadow);
  padding: 24px;
}

.feedback-intro {
  align-self: start;
}

.feedback-intro p {
  color: var(--muted);
  line-height: 1.55;
}

.note {
  padding: 14px;
  border-radius: 8px;
  background: #fff0c7;
  color: var(--ink) !important;
  font-weight: 800;
}

.feedback-form {
  display: grid;
  gap: 16px;
}

.feedback-form fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
}

.feedback-form legend {
  padding: 0 6px;
  color: #34423f;
  font-weight: 850;
}

.feedback-form fieldset label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.hidden-field {
  display: none;
}

@media (max-width: 800px) {
  .feedback-page {
    padding: 0;
  }

  .feedback-shell {
    grid-template-columns: 1fr;
  }
}
