/* app-homework.css — the fix-it / writing conversation.
   Sugar Paper: Mirai speaks in white bubbles beside a sunflower sticker, the
   student's own attempts sit right in powder blue. See STYLE.md. */

.hw-chat-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 0;
  scrollbar-width: none;
}

.hw-chat-panel::-webkit-scrollbar {
  display: none;
}

.hw-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hw-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.hw-chat-row.user {
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

/* The sunflower sticker that stands in for Mirai. */
.hw-chat-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-feather);
}

.hw-bubble {
  position: relative;
  max-width: 84%;
  padding: 13px 16px;
  border-radius: 20px;
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-feather);
}

.hw-bubble-question {
  border-bottom-left-radius: 8px;
}

.hw-chat-eyebrow {
  margin: 0 0 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The quoted lesson line — the thing being fixed, set apart in powder. */
.hw-chat-quote {
  margin: 0 0 9px;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 15.5px;
  font-weight: 600;
  background: var(--powder);
}

.hw-chat-ask {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.hw-bubble-question .pill {
  margin-top: 9px;
}

.hw-chat-hint {
  display: flex;
  gap: 7px;
  margin: 9px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.hw-bubble-user {
  align-self: flex-end;
  border-bottom-right-radius: 8px;
  font-weight: 600;
  background: var(--powder);
  box-shadow: none;
}

.hw-chat-reaction {
  position: absolute;
  right: -6px;
  bottom: -10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-feather);
}

.hw-chat-receipt {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  opacity: 0.7;
}

.hw-chat-receipt.is-seen {
  color: var(--success);
  opacity: 1;
}

.hw-verdict-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.hw-bubble-reply,
.hw-bubble-coach {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 600;
}

.hw-bubble-reply.is-success { background: var(--mint); box-shadow: none; }
.hw-bubble-reply.is-miss { background: var(--pink); box-shadow: none; }
.hw-bubble-coach { background: var(--butter); box-shadow: none; }

.hw-chat-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
  color: #fff;
}

.hw-chat-mark.is-success { background: var(--success); }
.hw-chat-mark.is-miss { background: var(--danger); }
.hw-chat-mark.is-coach { background: transparent; font-size: 15px; }

.hw-chat-text {
  min-width: 0;
}

.hw-bubble-info {
  font-size: 14.5px;
  color: var(--ink-soft);
}

.hw-bubble-info.is-error {
  color: var(--danger);
  background: var(--pink);
  box-shadow: none;
}

/* Typing dots while Mirai reads the attempt. */
.hw-bubble-typing {
  display: flex;
  gap: 5px;
  padding: 15px 17px;
}

.hw-bubble-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.25;
  animation: hwTypingDot 1.1s ease-in-out infinite;
}

.hw-bubble-typing span:nth-child(2) { animation-delay: 0.15s; }
.hw-bubble-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes hwTypingDot {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(-3px); }
}

/* The dim "?" affordance: an explanation is one tap away, never on screen
   until it is asked for. */
.hw-why {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 6px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--wash);
}

.hw-why > span:first-child {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  color: var(--ink-soft);
  background: var(--surface);
}

.hw-why[disabled] {
  opacity: 0.45;
}

.hw-why.is-answered {
  display: none;
}

.hw-why .btn-spinner {
  width: 12px;
  height: 12px;
}

.hw-chat-checking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  border-radius: 26px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--shadow-feather);
}

/* --- the Homework tab's welcome (iOS HomeworkIntroView) ---------------------
   Date and title, the ring with its sunflower, "What's inside" and one CTA.
   Opening the tab lands here; only the CTA starts (or resumes) the session. */

.hw-intro-shell {
  align-items: stretch;
  gap: 14px;
}

.hw-intro-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
  padding-top: 6px;
  text-align: center;
}

.hw-intro-date {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.hw-intro-title {
  font-size: 30px;
}

/* The one flexible piece: on a short screen (the needs-AI line under three
   rows at 375×812) the ring gives up height first, so the CTA keeps its
   distance from the tab bar. The SVG keeps its aspect, so it only shrinks.
   Below its 88px floor, fitHomeworkWelcome (app.js) takes it away
   altogether (is-compact), and scrolls the shell as the last resort. */
.hw-intro-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 136px;
  align-self: center;
  width: 136px;
  min-height: 88px;
}

.hw-intro-sticker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 36px;
  line-height: 1;
  background: var(--surface);
  box-shadow: var(--shadow-sticker);
  transform: rotate(-5deg);
}

.hw-intro-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: none;
  padding: 18px 18px 20px;
}

.hw-intro-card-title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.hw-intro-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hw-intro-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hw-intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--wash);
}

.hw-intro-icon[data-tone="powder"] { background: var(--powder); }
.hw-intro-icon[data-tone="lilac"] { background: var(--lilac); }
.hw-intro-icon[data-tone="pink"] { background: var(--pink); }
.hw-intro-icon[data-tone="butter"] { background: var(--butter); }

.hw-intro-icon svg,
.hw-intro-ai-icon svg,
.hw-intro-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hw-intro-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hw-intro-row-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.hw-intro-row-detail {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.hw-intro-cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  /* Clear of the tab bar, as the Home rows are. */
  padding-bottom: 8px;
}

/* The needs-AI line sits right above the CTA it explains. */
.hw-intro-ai {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
}

.hw-intro-ai-icon {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
  color: var(--ink);
}

.hw-intro-ai-icon svg {
  width: 16px;
  height: 16px;
}

.hw-intro-start {
  flex: none;
  width: 100%;
}

.hw-intro-arrow {
  display: inline-flex;
}

/* Short phones: see fitHomeworkWelcome in app.js. */
.hw-intro-shell.is-compact .hw-intro-hero {
  display: none;
}

/* The last resort scrolls inside the shell, which already ends above the tab
   bar, so the CTA can always be reached and never sits under it. The shell
   reaches out to the screen edges so the card's and the CTA's shadows are not
   cut off at its sides. */
.hw-intro-shell.is-scroll {
  margin: 0 -16px;
  padding: 0 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hw-intro-shell.is-scroll::-webkit-scrollbar {
  display: none;
}

/* The done screen's one line when launch data has no completion summary. */
.hw-done-summary {
  align-self: center;
}
