:root {
  --rbfe-bg: #f7f5ef;
  --rbfe-text: #1b1b1b;
  --rbfe-accent: #1f4d45;
  --rbfe-button-text: #ffffff;
  --rbfe-muted: #6d6a63;
  --rbfe-border: rgba(27,27,27,.14);
  --rbfe-bg-image: none;
}

.rbfe-app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 2147483000;
  background-color: var(--rbfe-bg);
  background-image:
    linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)),
    var(--rbfe-bg-image);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  color: var(--rbfe-text);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", YuGothic, Meiryo, sans-serif;
}

body.rbfe-active { overflow: hidden !important; }

.rbfe-shell { min-height: 100%; display: flex; flex-direction: column; }
.rbfe-topbar { width: min(100%, 640px); margin: 0 auto; padding: 24px 22px 0; display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; transition: opacity .25s ease; }
.rbfe-app.is-start .rbfe-topbar { opacity: 0; pointer-events: none; }
.rbfe-back { border: 0; background: rgba(255,255,255,.44); color: var(--rbfe-text); font-size: 24px; line-height: 1; cursor: pointer; padding: 8px; border-radius: 999px; backdrop-filter: blur(4px); }
.rbfe-back:focus-visible { outline: 3px solid var(--rbfe-accent); outline-offset: 2px; }
.rbfe-progress { height: 3px; background: rgba(27,27,27,.09); border-radius: 99px; overflow: hidden; }
.rbfe-progress span { display: block; height: 100%; width: 0; background: var(--rbfe-accent); transition: width .28s ease; }
.rbfe-phase { grid-column: 2; font-size: 12px; letter-spacing: .08em; color: var(--rbfe-muted); min-height: 18px; }

.rbfe-stage { width: min(100%, 640px); margin: 0 auto; flex: 1; display: flex; align-items: center; justify-content: center; padding: 34px 24px 64px; }
.rbfe-app.is-start .rbfe-stage { padding-top: 12px; }
.rbfe-card { width: 100%; max-width: 540px; animation: rbfeFade .32s ease both; }
.rbfe-kicker { margin: 0 0 16px; text-align: center; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 14px; letter-spacing: .12em; color: var(--rbfe-muted); }
.rbfe-title { margin: 0; text-align: center; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: clamp(30px, 7vw, 42px); line-height: 1.48; font-weight: 600; letter-spacing: .02em; white-space: pre-line; }
.rbfe-title--question { font-size: clamp(23px, 5.8vw, 31px); line-height: 1.65; }
.rbfe-app.is-start .rbfe-title { font-size: clamp(30px, 6.2vw, 40px); }
.rbfe-body { margin: 30px auto 0; max-width: 31em; font-size: 16px; line-height: 2.05; color: var(--rbfe-text); white-space: pre-line; }
.rbfe-body--center { text-align: center; }
.rbfe-note { margin-top: 18px; text-align: center; font-size: 13px; line-height: 1.7; color: var(--rbfe-muted); }
/* START composition: intentional line breaks + duration above CTA */
.rbfe-start-card { text-align: center; }
.rbfe-start-lead {
  margin: 30px auto 0;
  max-width: 20em;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: clamp(22px, 5.2vw, 30px);
  line-height: 1.8;
  font-weight: 600;
  letter-spacing: .025em;
  color: var(--rbfe-accent);
  white-space: pre-line;
}
.rbfe-start-body { margin-top: 30px; }
.rbfe-start-note {
  margin: 30px auto 0;
  text-align: center;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 600;
  letter-spacing: .035em;
  color: var(--rbfe-text);
  white-space: pre-line;
}
.rbfe-start-actions { margin-top: 14px; }

.rbfe-actions { margin: 36px auto 0; display: grid; gap: 12px; max-width: 440px; }
.rbfe-btn { width: 100%; min-height: 56px; border: 1px solid var(--rbfe-border); border-radius: 14px; padding: 14px 18px; background: rgba(255,255,255,.82); color: var(--rbfe-text); font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; backdrop-filter: blur(3px); transition: transform .08s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.rbfe-btn:hover { border-color: var(--rbfe-accent); box-shadow: 0 5px 20px rgba(31,77,69,.08); }
.rbfe-btn:active { transform: translateY(1px); }
.rbfe-btn:focus-visible { outline: 3px solid var(--rbfe-accent); outline-offset: 2px; }
.rbfe-btn--primary { background: var(--rbfe-accent); color: var(--rbfe-button-text); border-color: var(--rbfe-accent); }
.rbfe-btn--ghost { background: transparent; }
.rbfe-linkbtn { border: 0; background: transparent; color: var(--rbfe-text); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 10px; font-size: 15px; }

.rbfe-grid { margin-top: 30px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.rbfe-grid .rbfe-btn { min-height: 64px; }

.rbfe-input { width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--rbfe-border); border-radius: 14px; padding: 16px; background: rgba(255,255,255,.86); color: var(--rbfe-text); font: inherit; line-height: 1.7; box-sizing: border-box; backdrop-filter: blur(3px); }
.rbfe-input:focus { outline: 3px solid color-mix(in srgb, var(--rbfe-accent) 28%, transparent); border-color: var(--rbfe-accent); }

.rbfe-door { text-align: center; }
.rbfe-door-name { display: block; margin: 20px 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(52px, 14vw, 78px); letter-spacing: .10em; font-weight: 600; color: var(--rbfe-accent); }
.rbfe-door-sub { font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 14px; color: var(--rbfe-muted); letter-spacing: .1em; }

.rbfe-space { min-height: 58vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.rbfe-space-wait { margin-top: 38px; display: grid; place-items: center; gap: 16px; color: var(--rbfe-muted); transition: opacity .4s ease, transform .4s ease; }
.rbfe-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(31,77,69,.15); border-top-color: var(--rbfe-accent); animation: rbfeSpin .9s linear infinite; }
.rbfe-loading-text { margin: 0; font-size: 13px; letter-spacing: .08em; }
.rbfe-space .rbfe-reveal { opacity: 0; transform: translateY(8px); pointer-events: none; max-height: 0; overflow: hidden; transition: opacity .7s ease, transform .7s ease, max-height .7s ease; }
.rbfe-space.is-ready .rbfe-space-wait { opacity: 0; transform: translateY(-5px); pointer-events: none; height: 0; margin: 0; overflow: hidden; }
.rbfe-space.is-ready .rbfe-reveal { opacity: 1; transform: translateY(0); pointer-events: auto; max-height: 520px; }

.rbfe-review { margin-top: 30px; display: grid; gap: 14px; }
.rbfe-review-item { background: rgba(255,255,255,.72); border: 1px solid var(--rbfe-border); border-radius: 14px; padding: 18px; backdrop-filter: blur(3px); }
.rbfe-review-label { display: block; font-size: 12px; color: var(--rbfe-muted); margin-bottom: 8px; }
.rbfe-review-value { font-size: 18px; line-height: 1.6; font-weight: 650; }
.rbfe-arrow { text-align: center; color: var(--rbfe-muted); }
.rbfe-cycle { margin: 34px auto 0; max-width: 360px; text-align: center; line-height: 2.05; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-weight: 600; }
.rbfe-footer-line { margin-top: 44px; text-align: center; color: var(--rbfe-muted); font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-size: 15px; }
.rbfe-days { margin: 28px auto 0; max-width: 420px; display: grid; gap: 8px; font-size: 14px; line-height: 1.65; }

@keyframes rbfeFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rbfeSpin { to { transform: rotate(360deg); } }

@media (min-width: 800px) {
  .rbfe-stage { padding-top: 12px; padding-bottom: 72px; }
  .rbfe-app.is-start .rbfe-card { transform: translateY(-18px); }
}

@media (max-width: 430px) {
  .rbfe-topbar { padding: 16px 14px 0; }
  .rbfe-stage { padding: 26px 18px 42px; align-items: flex-start; }
  .rbfe-app.is-start .rbfe-stage { padding-top: 36px; align-items: center; }
  .rbfe-title { font-size: clamp(27px, 8vw, 34px); }
  .rbfe-title--question { font-size: clamp(22px, 6.8vw, 28px); }
  .rbfe-body { font-size: 15px; line-height: 1.95; }
  .rbfe-start-lead { font-size: clamp(21px, 6.4vw, 27px); line-height: 1.75; }
  .rbfe-start-note { font-size: 16px; margin-top: 26px; }
  .rbfe-start-actions { margin-top: 12px; }
  .rbfe-grid { grid-template-columns: 1fr; }
  .rbfe-actions { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .rbfe-spinner { animation: none; border-top-color: rgba(31,77,69,.55); }
}

/* v0.2.2 iPhone / mobile hardening */
html.rbfe-html-active,
body.rbfe-active {
  width: 100% !important;
  min-height: 100% !important;
}
.rbfe-app {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100vw;
  height: 100vh;
  min-height: -webkit-fill-available;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.rbfe-btn,
.rbfe-review-item,
.rbfe-input,
.rbfe-back {
  -webkit-backdrop-filter: blur(3px);
}
.rbfe-input:focus {
  outline: 3px solid rgba(31,77,69,.22);
}
@supports (height: 100dvh) {
  .rbfe-app { height: 100dvh; }
}
@supports (padding: max(0px)) {
  .rbfe-topbar {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .rbfe-stage {
    padding-bottom: max(42px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 767px) {
  .rbfe-app { position: fixed !important; inset: 0 !important; z-index: 2147483000 !important; }
}
