:root{
  --bg:#04060c; --ink:#dfe9f5; --dim:#7d8ea6; --cyan:#59d8ff; --cyan2:#1e7fb8;
  --amber:#ffb454; --red:#ff6a5e;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"Hiragino Kaku Gothic ProN","Noto Sans JP",system-ui,sans-serif;
  overflow:hidden;
}
.scene{
  min-height:100dvh; display:flex; flex-direction:column;
  padding:calc(14px + env(safe-area-inset-top)) 22px calc(16px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(30,90,140,.28), transparent 60%),
    radial-gradient(90% 55% at 8% 108%, rgba(14,50,86,.35), transparent 60%),
    var(--bg);
  position:relative;
}
.scene::before{ /* faint starfield dots */
  content:""; position:absolute; inset:0; pointer-events:none; opacity:.5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, #9fd8ff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #cfeaff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 34%, #7fb6dd 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 64%, #8fc3e8 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 58%, #bfe6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 45% 12%, #6fa8cf 50%, transparent 51%);
}
header{display:flex; justify-content:space-between; align-items:flex-start; position:relative; z-index:2;}
.brand{font-size:21px; letter-spacing:.42em; font-weight:200; color:#eaf6ff;}
.brand-sub{display:block; letter-spacing:.18em; font-size:10px; color:var(--dim); margin-top:5px;}
.head-btns{display:flex; gap:8px;}
.icon-btn{
  width:42px; height:42px; border-radius:50%; border:1px solid rgba(120,190,240,.25);
  background:rgba(10,22,38,.55); color:var(--ink); font-size:17px; cursor:pointer;
}
.icon-btn.off{opacity:.45;}
main{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; position:relative; z-index:1; padding-bottom:8px;}
.core-wrap{position:relative; width:230px; height:230px; display:grid; place-items:center;}
.ring{
  position:absolute; border-radius:50%; border:1px solid rgba(89,216,255,.28);
  animation:spin 26s linear infinite;
}
.r1{inset:0; border-style:dashed;}
.r2{inset:22px; border-color:rgba(89,216,255,.16); animation-duration:17s; animation-direction:reverse;}
.r3{inset:46px; border-color:rgba(89,216,255,.10); animation-duration:38s;}
@keyframes spin{to{transform:rotate(360deg);}}
#core{
  position:relative; width:128px; height:128px; border-radius:50%; border:none; cursor:pointer;
  background:radial-gradient(circle at 50% 42%, #0b2237, #050b16 72%);
  box-shadow:0 0 44px rgba(60,180,255,.35), inset 0 0 26px rgba(60,180,255,.28);
  animation:breathe 4.6s ease-in-out infinite;
}
.core-glow{
  position:absolute; inset:16px; border-radius:50%;
  background:radial-gradient(circle at 50% 45%, rgba(235,252,255,.95), rgba(110,215,255,.75) 42%, rgba(30,110,180,.25) 72%, transparent 76%);
  filter:blur(1px);
}
.core-inner{
  position:absolute; inset:44px; border-radius:50%;
  background:radial-gradient(circle at 50% 40%, #ffffff, #bfeaff 55%, rgba(120,210,255,.0) 78%);
  opacity:.9;
}
@keyframes breathe{0%,100%{transform:scale(1);}50%{transform:scale(1.035);}}
body.recording #core{animation:breathe 1.15s ease-in-out infinite; box-shadow:0 0 58px rgba(255,150,70,.5), inset 0 0 26px rgba(255,170,80,.35);}
body.recording .core-glow{background:radial-gradient(circle at 50% 45%, #fff6e8, rgba(255,190,100,.85) 45%, rgba(220,110,40,.25) 72%, transparent 76%);}
body.recording .ring{border-color:rgba(255,180,90,.35);}
body.speaking .ring{animation:spin 9s linear infinite; border-color:rgba(140,240,200,.35);}
body.speaking #core{box-shadow:0 0 60px rgba(90,255,190,.35), inset 0 0 26px rgba(90,255,190,.25);}
#status{margin-top:30px; font-size:19px; font-weight:300; letter-spacing:.06em; text-align:center; min-height:28px;}
#timer{font-size:13px; color:var(--amber); min-height:18px; letter-spacing:.2em;}
.convo{width:100%; max-width:520px; margin-top:16px; text-align:left;}
#heard{color:var(--dim); font-size:14px; line-height:1.7; margin:0 0 6px; min-height:0;}
#heard:not(:empty)::before{content:"🎙 "; }
#reply{font-size:16.5px; line-height:1.85; margin:0; white-space:pre-wrap;}
footer{position:relative; z-index:2;}
#factsMeta{font-size:11px; color:var(--dim); line-height:1.7; margin:0 0 4px;}
.hint{font-size:11px; color:#54657c; line-height:1.7; margin:0;}
.sheet{position:fixed; inset:0; background:rgba(2,4,9,.72); display:grid; place-items:end center; z-index:10;}
.sheet.hidden{display:none;}
.sheet-card{
  width:100%; max-width:560px; background:#0a1424; border:1px solid rgba(120,190,240,.2);
  border-radius:20px 20px 0 0; padding:22px 22px calc(20px + env(safe-area-inset-bottom));
}
.sheet-card h2{margin:0 0 14px; font-size:17px; font-weight:500; letter-spacing:.1em;}
.sheet-card label{display:block; font-size:13px; color:var(--dim); margin-bottom:14px;}
.sheet-card input{
  width:100%; margin-top:6px; padding:12px; border-radius:10px; font-size:15px;
  border:1px solid rgba(120,190,240,.3); background:#060d1a; color:var(--ink);
}
.note{font-size:12px; color:var(--dim); line-height:1.7;}
.sheet-btns{display:flex; gap:10px; margin-top:16px;}
.sheet-btns button{
  flex:1; padding:13px; border-radius:12px; font-size:15px; cursor:pointer;
  border:1px solid rgba(120,190,240,.3); background:transparent; color:var(--ink);
}
.sheet-btns .primary{background:#0f4d73; border-color:#1e7fb8;}
