#home-brand {
  position: fixed; left: 20px; top: 20px; z-index: 96; width: 104px; height: auto;
  padding: 0; border: 0; background: transparent; cursor: pointer; transition: opacity .24s ease, transform .18s ease;
}
#home-brand { opacity: 1; }
body.home-top-visible #home-brand { opacity: 0; transform: translateY(-8px); pointer-events: none; }
#home-top-panel {
  --pull: 0px;
  position: fixed; left: 0; right: 0; top: 0; z-index: 94; display: grid; place-items: center;
  box-sizing: border-box; padding: max(12px,env(safe-area-inset-top)) 18px 12px; color: #fff; background: #111; transition: background .05s linear;
  border-radius: 0 0 48px 48px; touch-action: none; user-select: none; cursor: grab;
  translate: 0 var(--pull); will-change: transform,translate;
}
#home-top-panel:active { cursor: grabbing; }
#home-top-panel::before { content:""; position:absolute; left:0; right:0; bottom:100%; height:100vh; background:inherit; pointer-events:none; }
#home-top-panel > img { width: min(104px,26vw); filter: invert(1); }
#home-top-panel:not(.is-ready) { pointer-events: none; }
#share-pull-overlay { position: fixed; inset: 0; z-index: 295; background: rgba(154,154,154,.78); backdrop-filter: grayscale(1) brightness(.78) blur(1px); opacity: 0; pointer-events: none; transition: opacity .16s linear; }
#share-pull-overlay.is-active { display: block; }
#share-pull-overlay.is-committing { transition-duration: .16s; }
#home-brand img { display: block; width: 100%; height: auto; }
#home-brand:hover { transform: translateY(-2px); }
#home-brand:active { transform: scale(.97); }
#add-memory-button {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 110;
  width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%;
  color: #fff; background: #171717; display: grid; place-items: center; cursor: pointer;
  transform: translateX(-50%); transition: transform .18s ease, opacity .24s ease;
}
#add-memory-button:hover { transform: translateX(-50%) scale(1.05); }
#add-memory-button:active { transform: translateX(-50%) scale(.96); }
#add-memory-button .material-symbols-rounded { font-size: 31px; }
body.experience-open #home-brand,
body.experience-open #home-top-panel,
body.experience-open #add-memory-button,
body.experience-open #settings-button,
body.experience-open #settings-panel { opacity: 0; pointer-events: none; }
.memory-card > p[role="button"] { cursor: pointer; border-radius: 6px; transition: color .18s ease; }
.memory-card > p[role="button"]:hover { color: #171717; }

#experience-root { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
#experience-root.is-home { display: none; }
.experience-view {
  position: absolute; inset: 0; overflow: hidden; color: #171717; background: #fff;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .26s ease, transform .32s cubic-bezier(.22,.61,.36,1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.experience-view.is-active { opacity: 1; transform: none; pointer-events: auto; }
.experience-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.experience-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 8; height: 76px;
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  pointer-events: none;
}
.experience-header > * { pointer-events: auto; }
.experience-header.is-light { color: #fff; }
.brand-image { width: 104px; height: auto; display: block; }
.experience-header.is-light .brand-image { filter: invert(1); }
.icon-button {
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  border: 1px solid rgba(20,20,20,.12); border-radius: 50%; color: inherit;
  background: rgba(255,255,255,.78); backdrop-filter: blur(12px); cursor: pointer;
}
.experience-header.is-light .icon-button { border-color: rgba(255,255,255,.26); background: rgba(0,0,0,.25); }
.plain-button, .primary-button, .secondary-button {
  min-height: 48px; border-radius: 999px; padding: 0 22px; font: 600 15px/1 inherit; cursor: pointer;
}
.primary-button { border: 0; color: #fff; background: #171717; }
.secondary-button { border: 1px solid #c9c9c7; color: #171717; background: #fff; }
.plain-button { border: 0; color: inherit; background: transparent; }

/* Capture */
#capture-view { background: #090909; color: #fff; }
.capture-shell { height: 100%; max-width: 680px; margin: 0 auto; padding: 84px 18px 24px; display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 20px; }
.camera-stage {
  position: relative; min-height: 0; overflow: hidden; border-radius: 32px;
  background: #b8b8b6; isolation: isolate;
}
.camera-stage::before {
  content: ""; position: absolute; inset: 0; opacity: .42;
  background: radial-gradient(circle at 48% 42%, rgba(255,255,255,.38), transparent 42%), linear-gradient(145deg,#c7c7c5,#8e8e8c);
}
.camera-grid { position: absolute; inset: 0; opacity: .2; background: linear-gradient(90deg,transparent 33.2%,#fff 33.3%,#fff 33.7%,transparent 33.8%,transparent 66.2%,#fff 66.3%,#fff 66.7%,transparent 66.8%), linear-gradient(transparent 33.2%,#fff 33.3%,#fff 33.7%,transparent 33.8%,transparent 66.2%,#fff 66.3%,#fff 66.7%,transparent 66.8%); }
.camera-guide { position: absolute; left: 50%; top: 48%; width: min(68%,360px); aspect-ratio: 4/3; transform: translate(-50%,-50%); border: 2px solid rgba(255,255,255,.86); border-radius: 22px; transition: border-radius .3s ease, aspect-ratio .3s ease; }
.camera-guide.object-mode { aspect-ratio: 1; border-radius: 50%; border-style: dashed; }
.camera-hint { position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); width: 86%; text-align: center; font-size: 13px; color: rgba(255,255,255,.82); }
.capture-modes { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 24px; }
.capture-mode { border: 0; padding: 8px 2px; color: rgba(255,255,255,.48); background: transparent; font: 600 16px/1 inherit; cursor: pointer; }
.capture-mode.is-active { color: #fff; }
.capture-controls { display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; }
.shutter { grid-column: 2; justify-self: center; width: 74px; height: 74px; padding: 0; border: 4px solid #fff; border-radius: 50%; background: transparent; cursor: pointer; }
.shutter::after { content: ""; display: block; width: 58px; height: 58px; margin: 4px; border-radius: 50%; background: #fff; transition: transform .16s ease; }
.shutter:active::after { transform: scale(.88); }
.repair-toggle { justify-self: end; display: none; flex-direction: row; gap: 8px; align-items: center; color: rgba(255,255,255,.72); font-size: 12px; white-space: nowrap; }
.repair-toggle.is-visible { display: flex; }
.switch { width: 38px; height: 22px; border: 0; border-radius: 999px; padding: 3px; background: #4b4b4b; cursor: pointer; }
.switch::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s ease; }
.switch.is-on { background: #fff; }
.switch.is-on::after { background: #171717; transform: translateX(16px); }
.capture-processing { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; overflow: hidden; background: rgba(20,20,20,.56); opacity: 0; pointer-events: none; transition: opacity .16s ease; }
.capture-processing.is-visible { opacity: 1; }
.capture-processing img { width: min(72%,360px); height: min(58%,420px); object-fit: contain; transform: scale(.97); opacity: .86; transition: transform .3s ease, filter .6s ease; }
.capture-processing.is-visible img { transform: scale(1); }
.capture-processing i { position: absolute; left: 12%; right: 12%; top: 24%; height: 2px; opacity: 0; background: #fff; box-shadow: 0 0 20px 8px rgba(255,255,255,.62); }
.capture-processing.is-repairing i { opacity: 1; animation: repair-sweep .86s ease-in-out; }
@keyframes repair-sweep { from { transform: translateY(0); } to { transform: translateY(42vh); } }
.shutter:disabled { opacity: .45; cursor: default; }

/* Interview */
#interview-view { background: #fff; color-scheme: light; }
.interview-shell { position: relative; height: 100%; max-width: 720px; margin: 0 auto; overflow: hidden; touch-action: pan-y; }
.subject-stage { position: absolute; left: 50%; top: 34%; width: min(92vw,620px); height: min(52vh,520px); transform: translate(-50%,-50%); animation: subject-stage-float 4s ease-in-out infinite; }
@keyframes subject-stage-float { 0%,100%{transform:translate(-50%,-50%)} 50%{transform:translate(-50%,calc(-50% - 9px))} }
.ripple-field { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.ripple-field.is-visible { opacity: 1; }
.ripple-field span { position: absolute; left: 50%; top: 50%; width: 190px; height: 190px; border: 0; border-radius: 50%; background: radial-gradient(circle,transparent 53%,rgba(54,54,54,.025) 54%,rgba(54,54,54,.09) 61%,transparent 72%); filter: blur(3px); transform: translate(-50%,-50%) scale(.4); animation: ripple 4.2s ease-out infinite; }
.ripple-field span:nth-child(2){animation-delay:1.05s}.ripple-field span:nth-child(3){animation-delay:2.1s}.ripple-field span:nth-child(4){animation-delay:3.15s}
@keyframes ripple { 0%{opacity:0;transform:translate(-50%,-50%) scale(.35)} 18%{opacity:1} 100%{opacity:0;transform:translate(-50%,-50%) scale(4.2)} }
.subject-float { position: absolute; left: 50%; top: 50%; width: min(54vw,280px); height: min(30vh,270px); object-fit: contain; transform: translate(-50%,-50%); z-index: 2; }
.interview-panel { position: absolute; left: 24px; right: 24px; bottom: max(54px,calc(env(safe-area-inset-bottom) + 30px)); z-index: 3; max-width: 480px; margin: auto; text-align: center; }
.interview-ready { display: grid; justify-items: center; gap: 14px; }
.mode-switcher { position: relative; width: min(270px,72vw); height: 30px; overflow: hidden; }
.mode-switcher button { position:absolute; inset:0; min-height:30px; padding:0; border:0; color:#171717; background:transparent; font:500 15px/1.2 inherit; cursor:pointer; opacity:0; transition:opacity .22s ease; }
.mode-switcher button.is-active { opacity:1; }
.mode-dots { display: flex; gap: 7px; height: 6px; align-items: center; }
.mode-dots i { width: 5px; height: 5px; border-radius: 50%; background: #c7c7c5; transition: width .2s ease, background .2s ease; }
.mode-dots i.is-active { width: 14px; border-radius: 5px; background: #4a4a4a; }
.record-button { width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: #171717; cursor: pointer; }
.record-button .material-symbols-rounded { font-size: 30px; }
.interview-running { display: none; }
.interview-running.is-visible { display: block; }
.interview-ready.is-hidden { display: none; }
.question-number { font-size: 13px; color: #888; letter-spacing: .12em; }
.question-number:empty,.question-text:empty { display: none; }
.question-text { min-height: 68px; margin: 13px 0 22px; font-size: clamp(21px,5.4vw,28px); line-height: 1.35; letter-spacing: -.025em; opacity: 1; transition: opacity .18s ease; }
.question-text.is-changing { opacity: 0; }
.live-wave { height: 0; display: flex; align-items: center; justify-content: center; gap: 3px; margin: 0 auto; overflow: hidden; opacity: 0; transition: height .18s ease, margin .18s ease, opacity .18s ease; }
.interview-shell.is-listening .live-wave { height: 54px; margin: 0 auto 18px; opacity: 1; }
.live-wave i { width: 2px; height: var(--h); border-radius: 4px; background: #555; animation: live-wave .62s ease-in-out infinite alternate; animation-delay: calc(var(--i)*-35ms); }
@keyframes live-wave { to { transform: scaleY(.35); opacity: .42; } }
.record-meta { display:none; margin-bottom: 18px; color: #777; font-variant-numeric: tabular-nums; }
.interview-shell.has-active-audio .record-meta { display:block; }
.interview-status { min-height:18px; margin:0 0 10px; color:#777; font-size:12px; line-height:1.4; }
.interview-status.is-error { color:#a2332c; }
.finish-row { display:flex; justify-content:center; gap:8px; }
.interview-running .record-button { width:64px; height:64px; background:#171717; transition:transform .18s ease,background .18s ease; }
.interview-running .record-button.is-listening { background:#555; transform:scale(.94); }
.interview-running .record-button:disabled,
.interview-running .record-button.is-disabled { color:#9c9c9c; background:#e6e6e4; cursor:default; transform:none; }
.interview-running .record-button:disabled .material-symbols-rounded { animation: button-spin 1.1s linear infinite; }
@keyframes button-spin { to { transform:rotate(360deg); } }

/* Detail */
#detail-view { background: #fff; color-scheme: light; }
.detail-page { width: min(100%,760px); margin: 0 auto; padding: 104px 24px 100px; }
.detail-hero { position: relative; min-height: 300px; display: grid; place-items: center; text-align: center; }
.detail-subject { width: min(58vw,300px); height: 260px; object-fit: contain; animation: detail-float 5s ease-in-out infinite; }
@keyframes detail-float { 0%,100%{transform:translateY(0) rotate(-1deg)} 50%{transform:translateY(-9px) rotate(1deg)} }
.detail-meta { position: absolute; left: 0; top: 12px; z-index: 2; text-align: left; }
.detail-label { display: table; margin: 0 0 4px; padding: 5px 8px; color: #fff; background: #171717; font-size: 16px; font-weight: 650; }
.detail-time { display: table; margin: 0; padding: 4px 7px; color: #fff; background: #171717; font-size: 13px; }
.detail-number { margin: 64px 0 18px; font-size: 64px; line-height: .9; letter-spacing: -.06em; }
.detail-title { max-width: 620px; margin: 0 0 18px; font-family: Georgia,"Noto Serif SC",serif; font-size: clamp(30px,7vw,48px); line-height: 1.16; letter-spacing: -.04em; }
.detail-deck { max-width: 620px; margin: 0 0 26px; color: #666; font-size: 16px; line-height: 1.75; }
.detail-actions { width: min(100%,486px); display: grid; grid-template-columns: minmax(0,420px) 52px; gap: 14px; align-items: center; margin-bottom: 52px; }
.detail-audio { max-width: 420px; margin: 0; }
.detail-interview-entry { width: 52px; height: 52px; border: 0; border-radius: 50%; display: grid; place-items: center; padding: 0; color: #fff; background: linear-gradient(180deg,#555,#3f3f3f); box-shadow: none; cursor: pointer; }
.detail-interview-entry .material-symbols-rounded { font-size: 31px; }
.detail-body { max-width: 620px; }
.detail-body p { margin: 0 0 1.25em; color: #292929; font-family: Georgia,"Noto Serif SC",serif; font-size: 17px; line-height: 1.92; }
.detail-body h2 { margin: 2.4em 0 .8em; font-size: 23px; }
.needs-confirmation { max-width:620px; margin:0 0 32px; padding:12px 14px; border-left:3px solid #999; color:#666; background:#f6f6f4; font-size:13px; line-height:1.6; }
.needs-confirmation strong { margin-right:8px; color:#333; }
#detail-view .experience-header { justify-content: center; }

/* Keep native scrolling available, without exposing a desktop-style rail. */
.experience-scroll,
.share-shell {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.experience-scroll::-webkit-scrollbar,
.share-shell::-webkit-scrollbar { width: 0; height: 0; display: none; }

.toast-message { position: fixed; left: 50%; bottom: 28px; z-index: 500; transform: translate(-50%,12px); padding: 10px 16px; border-radius: 999px; color: #fff; background: rgba(20,20,20,.9); opacity: 0; pointer-events: none; transition: .2s ease; white-space: nowrap; }
.toast-message.is-visible { opacity: 1; transform: translate(-50%,0); }

/* Share game */
#share-view { background: rgba(154,154,154,.78); backdrop-filter: grayscale(1) brightness(.78) blur(1px); }
#share-view .experience-header .brand-image { filter: invert(1); }
#share-view .experience-header .icon-button { border:0; background:#fff; }
.share-shell { height: 100%; overflow-y: auto; padding: 98px 24px 42px; text-align: center; overscroll-behavior: contain; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.share-heading { display:none; }
.share-heading .eyebrow { margin-bottom: 8px; color: #888; font-size: 11px; letter-spacing: .14em; }
.share-heading h1 { margin: 0; font-family: Georgia,"Noto Serif SC",serif; font-size: clamp(25px,5vw,36px); letter-spacing: -.035em; }
.share-preview-wrap { position: relative; width: min(84vw,520px); aspect-ratio: 736/800; margin: 0 auto; overflow: visible; border: 0; background: transparent; box-shadow: none; }
.share-preview { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s ease; }
.share-preview-wrap.is-ready .share-preview { opacity: 1; }
.share-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #888; font-size: 13px; }
.share-preview-wrap.is-ready .share-loading { display: none; }
.share-actions { display: flex; justify-content: center; gap: 14px; width:min(84vw,560px); margin: 30px auto 0; }
.share-actions > * { flex:1; }
.share-actions button,.share-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.share-actions .material-symbols-rounded { font-size: 20px; }
@media (max-width:600px) {
  #home-brand { width: 88px; left: 16px; top: 16px; }
  #home-top-panel { border-radius: 0 0 46px 46px; }
  #add-memory-button { width: 54px; height: 54px; }
  .experience-header { height: 68px; padding: 12px 14px; }
  .brand-image { width: 92px; }
  .capture-shell { padding: 72px 10px 18px; }
  .capture-controls { grid-template-columns: 90px 1fr 90px; }
  .camera-stage { border-radius: 24px; }
  .interview-panel { left: 18px; right: 18px; }
  .subject-stage { top: 34%; width: 90vw; height: 38vh; }
  .subject-float { width: 62vw; height: 30vh; }
  .detail-page { padding: 84px 20px 80px; }
  .detail-subject { height: 220px; }
  .share-shell { padding: 84px 16px 54px; }
  .share-preview-wrap { width: min(88vw,440px); }
  .share-actions { flex-direction: row; width: min(88vw,440px); }
  .share-actions button,.share-actions a { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
