/* =========================================================================
   The Kintsugi Mender — Reception in steps
   1 Listen → 2 Welcome Brew → 3 Inspect → 4 Choose the Mend
   One clear step on screen at a time (desktop, tablet and phone).
   ========================================================================= */

.stage-split-grid.rs-mode {
  grid-template-columns: minmax(0, 1fr);
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  gap: var(--space-lg);
}

/* Show only the blocks of the current step */
.rs-mode.rs-step-1 [data-rstep]:not([data-rstep~="1"]),
.rs-mode.rs-step-2 [data-rstep]:not([data-rstep~="2"]),
.rs-mode.rs-step-3 [data-rstep]:not([data-rstep~="3"]),
.rs-mode.rs-step-4 [data-rstep]:not([data-rstep~="4"]) {
  display: none !important;
}

.rs-mode.rs-step-1 .workbench-col,
.rs-mode.rs-step-2 .workbench-col,
.rs-mode.rs-step-3 .narrative-col,
.rs-mode.rs-step-4 .narrative-col {
  display: none;
}

.rs-mode .narrative-col,
.rs-mode .workbench-col {
  max-width: none;
  width: 100%;
  margin: 0;
}

.rs-mode:not(.rs-step-3) .rs-step3-only,
.rs-mode:not(.rs-step-4) .rs-step4-only {
  display: none;
}

/* ---------------- Stepper ---------------- */
.rs-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: none;
}

.rs-stepper::-webkit-scrollbar {
  display: none;
}

.rs-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: var(--tap-min);
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-sans);
  cursor: pointer;
}

.rs-step:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.rs-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
}

.rs-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
}

.rs-label small {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.rs-step.is-current {
  border: 2px solid var(--accent-gold);
  box-shadow: var(--shadow-sm);
}

.rs-step.is-current .rs-num {
  background: var(--accent-gold);
  color: var(--btn-primary-ink);
}

.rs-step.is-done .rs-num {
  background: rgba(217, 167, 62, 0.22);
}

.rs-line {
  flex: 0 0 18px;
  height: 2px;
  background: var(--border);
}

/* ---------------- Nav ---------------- */
.rs-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--border);
}

.rs-hint {
  flex: 1 1 200px;
  text-align: center;
  font-size: var(--text-base);
  color: var(--text-muted);
  font-style: italic;
}

#rs-next:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 2px dashed var(--border);
  box-shadow: none;
  cursor: not-allowed;
}

.rs-pulse {
  animation: rsPulse 1.4s ease-in-out 3;
}

@keyframes rsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 167, 62, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(217, 167, 62, 0); }
}

/* Step 4 shows its own Enter Workbench button: hide the old waiting hint */
.rs-mode .cv-wb-hint {
  display: none !important;
}

/* ---------------- Step 1: portrait beside the conversation ---------------- */
.narrative-portrait-wrap {
  aspect-ratio: 1 / 1;
}

.narrative-portrait-wrap img {
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

@media (min-width: 761px) {
  .rs-mode.rs-step-1 .narrative-card {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-auto-rows: min-content;
    column-gap: var(--space-xl);
    align-items: start;
  }

  .rs-mode.rs-step-1 .narrative-card > [data-rstep] {
    grid-column: 2;
  }

  .rs-mode.rs-step-1 .narrative-card > .narrative-portrait-wrap {
    grid-column: 1;
    grid-row: 1 / span 6;
    position: sticky;
    top: 84px;
  }
}

@media (max-width: 760px) {
  .rs-mode.rs-step-1 .narrative-portrait-wrap {
    max-width: 260px;
    margin: 0 auto;
  }
}

/* ---------------- Step 2: the welcome brew, centred ---------------- */
.rs-mode.rs-step-2 .narrative-card {
  max-width: 820px;
  margin: 0 auto;
}

.rs-mode.rs-step-2 .tea-ritual-box {
  margin: 0;
}

.rs-mode .tea-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.rs-mode .tea-btn {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .rs-mode .tea-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------- Step 3: a bigger piece to turn under the lamp ---------------- */
.rs-mode.rs-step-3 .vessel-inspect-stage {
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.rs-mode.rs-step-3 .vessel-inspect-svg-wrap {
  width: 240px;
  height: 240px;
}

.rs-mode.rs-step-3 .vessel-inspect-svg-wrap svg {
  flex: 0 0 auto;
  width: 240px !important;
  height: 240px !important;
  transition: transform 160ms ease-out, filter 160ms ease-out;
}

.inspect-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.15;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 244, 214, 0.55) 50%, transparent 62%);
  background-size: 260% 100%;
  background-position: 50% 50%;
  mix-blend-mode: soft-light;
  transition: opacity 160ms ease-out, background-position 160ms ease-out;
}

.rs-mode.rs-step-3 #inspector-tilt-range {
  width: min(360px, 100%);
}

/* ---------------- Technique cards: tidy cost chip ---------------- */
.technique-header {
  align-items: flex-start;
  gap: 8px;
}

.technique-name {
  min-width: 0;
}

.technique-cost-badge {
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.2;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-top: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .rs-pulse { animation: none; }
}

/* =========================================================================
   Phone HUD: two independent rows, big buttons
   Row 1: day (shortens with "…" if long) + the five actions (44px taps)
   Row 2: home crest · stats (centred, close together) · guide "?" · wind chime
   ========================================================================= */
.hud-break {
  display: none;
}

#hud-bar .gd-help-hud {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-gold-ink);
}

@media (max-width: 640px) {
  #hud-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 4px;
    column-gap: 4px;
    padding: 6px 8px;
  }

  #hud-bar .hud-left {
    display: contents;
  }

  #hud-bar .hud-day-badge {
    order: 5;
    flex: 0 1 auto;
    min-width: 0;
    max-width: max-content;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-sm);
    padding: 4px 10px;
    letter-spacing: 0;
  }

  #hud-bar .hud-right {
    order: 3;
    flex: 0 0 auto;
    gap: 2px;
  }

  #hud-bar .hud-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  #hud-bar .hud-btn-icon {
    width: 22px;
    height: 22px;
  }

  #hud-bar .hud-break {
    display: block;
    order: 4;
    flex-basis: 100%;
    height: 0;
  }

  #hud-bar .hud-brand {
    order: 1;
    flex: 0 0 auto;
    margin-right: auto;
  }

  #hud-bar .hud-center {
    order: 6;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    padding-top: 0;
    gap: 4px;
  }

  #hud-bar .gd-help-hud {
    order: 2;
    flex: 0 0 auto;
  }

  #hud-bar .hud-furin-badge {
    order: 7;
    flex: 0 0 auto;
    min-width: 40px;
    min-height: 40px;
  }

  #hud-bar .hud-pill {
    min-height: 34px;
    padding: 4px 7px;
    gap: 4px;
    font-size: var(--text-sm);
  }

  #hud-bar .gd-help-hud {
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
  }

  #hud-bar .hud-pill-icon {
    width: 14px;
    height: 14px;
  }
}

/* Muro: what the chosen emotional seal means */
.seal-meaning {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
}

.seal-meaning span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Technique cards never push past the screen: columns may shrink, long words wrap */
.technique-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.technique-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .technique-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  .technique-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
