:root{
  --bg:#020911;
  --panel:#03131e;
  --panel2:#041923;
  --line:rgba(39,192,246,.40);
  --line2:rgba(39,192,246,.78);
  --blue:#28c9ff;
  --blue2:#8be7ff;
  --gold:#f2b632;
  --gold2:#ffd46a;
  --green:#42e86f;
  --text:#edf8fc;
  --muted:#769eae;
}

*{box-sizing:border-box}

html,body{
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden;
  background:#020911;
  color:var(--text);
  font-family:Arial,Helvetica,sans-serif;
}

body{
  display:grid;
  grid-template-columns:286px minmax(760px,1fr) 292px 126px;
  grid-template-rows:64px 1fr;
  gap:12px;
  padding:10px;
}

.ef-bg{
  position:fixed;
  inset:0;
  z-index:-2;
  background:
    radial-gradient(circle at 48% 42%,rgba(0,95,145,.26),transparent 38%),
    radial-gradient(circle at 12% 70%,rgba(0,75,118,.10),transparent 30%),
    linear-gradient(180deg,#020a11,#01060b);
}

.ef-bg:after{
  content:"";
  position:absolute;
  inset:0;
  opacity:.12;
  background-image:
    radial-gradient(circle at 20% 30%,#1d9dd0 1px,transparent 1px),
    radial-gradient(circle at 70% 55%,#1d9dd0 1px,transparent 1px);
  background-size:39px 39px,53px 53px;
}

.ef-topbar{
  grid-column:1/5;
  grid-row:1;
  display:grid;
  grid-template-columns:360px 1fr 190px;
  align-items:center;
  gap:20px;
  padding:0 18px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,rgba(3,18,28,.98),rgba(2,13,21,.96));
  box-shadow:0 0 34px rgba(0,154,218,.08), inset 0 -1px 0 rgba(39,192,246,.08);
}

.ef-brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.ef-z{
  width:40px;height:40px;
  border:2px solid var(--gold);
  border-radius:50%;
  color:var(--gold);
  display:grid;
  place-items:center;
  font-size:25px;
  font-weight:800;
  box-shadow:0 0 16px rgba(242,182,50,.22);
}

.ef-brand b{
  display:block;
  letter-spacing:2.4px;
  font-size:15px;
}

.ef-brand small{
  color:#6fb6d0;
  font-size:8px;
  letter-spacing:1.6px;
}

.ef-top-status{
  display:flex;
  justify-content:center;
  gap:34px;
  color:#80aaba;
  font-size:8px;
  letter-spacing:.9px;
}

.ef-top-status span{
  white-space:nowrap;
}

.ef-top-status b{color:var(--green)}

.ef-clock{
  text-align:right;
  font-size:8px;
  color:#769dab;
  letter-spacing:1px;
}

.ef-clock b{
  display:block;
  color:var(--gold);
  font-size:12px;
  margin-top:3px;
}

.ef-left{
  grid-column:1;
  grid-row:2;
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:0;
}

.ef-center{
  grid-column:2;
  grid-row:2;
  min-width:0;
  min-height:0;
  display:grid;
  grid-template-rows:56px 1fr 26px;
  gap:10px;
}

.ef-right{
  grid-column:3;
  grid-row:2;
  display:grid;
  grid-template-rows:175px 150px 150px 1fr;
  gap:12px;
  min-height:0;
}

.ef-techrail{
  grid-column:4;
  grid-row:2;
  display:grid;
  grid-auto-rows:minmax(30px,1fr);
  gap:6px;
  overflow:hidden;
}

.ef-panel,
.ef-center-head,
.ef-stage{
  border:1px solid var(--line);
  background:linear-gradient(180deg,rgba(4,21,32,.96),rgba(2,14,22,.94));
  box-shadow:0 0 22px rgba(0,126,182,.05);
}

.ef-panel{
  padding:14px;
}

.ef-panel h3{
  margin:0 0 12px;
  color:var(--blue);
  font-size:9px;
  letter-spacing:1.9px;
}

.ef-status-panel{
  padding:14px 15px;
}

.ef-status-panel>div,
.ef-story-controls>div{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:7px 0;
  border-bottom:1px solid rgba(39,180,230,.12);
  color:#aacbd7;
  font-size:8px;
  letter-spacing:.35px;
}

.ef-status-panel>div:last-child,
.ef-story-controls>div:last-child{border-bottom:0}

.ef-status-panel b{color:var(--green)}
.ef-story-controls b{color:#f6fafc}

.ef-chapter-panel{
  flex:1;
  min-height:0;
  overflow:hidden;
}

.ef-chapters{
  height:calc(100% - 24px);
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:6px;
  padding-right:4px;
}

.ef-chapter{
  width:100%;
  display:grid;
  grid-template-columns:38px 1fr;
  align-items:center;
  gap:10px;
  min-height:52px;
  border:1px solid rgba(39,180,230,.20);
  background:rgba(1,14,22,.78);
  color:#dbeaf0;
  text-align:left;
  cursor:pointer;
  padding:7px 8px;
}

.ef-chapter:hover{
  border-color:var(--line2);
  background:rgba(4,28,40,.86);
}

.ef-chapter.active{
  border-color:rgba(242,182,50,.84);
  background:linear-gradient(90deg,rgba(242,182,50,.14),rgba(2,17,26,.90));
  box-shadow:0 0 16px rgba(242,182,50,.06);
}

.ef-num{
  width:32px;height:32px;
  border-radius:50%;
  display:grid;
  place-items:center;
  border:1px solid #258eb7;
  color:#6fd9ff;
  font-size:9px;
}

.ef-chapter.active .ef-num{
  border-color:var(--gold);
  color:var(--gold);
  box-shadow:0 0 13px rgba(242,182,50,.20);
}

.ef-chapter strong{
  display:block;
  font-size:8px;
  letter-spacing:.7px;
  line-height:1.25;
}

.ef-chapter small{
  display:block;
  margin-top:3px;
  color:#668e9e;
  font-size:7px;
  line-height:1.25;
}

.ef-center-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
}

.ef-center-head small{
  color:#6cc4e0;
  letter-spacing:1.5px;
  font-size:8px;
}

.ef-center-head strong{
  display:block;
  margin-top:5px;
  color:#f4f8fa;
  font-size:12px;
  letter-spacing:1.2px;
}

.ef-center-state{
  text-align:right;
  font-size:8px;
  color:#799eac;
  letter-spacing:.8px;
}

.ef-center-state b{
  display:block;
  color:var(--green);
  margin-top:3px;
}

.ef-stage{
  min-height:0;
  overflow:hidden;
  position:relative;
  box-shadow:
    inset 0 0 60px rgba(0,117,175,.035),
    0 0 24px rgba(0,126,182,.04);
}

#efStoryFrame{
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#020911;
}

.ef-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  color:#1fbef9;
  font-size:7px;
  letter-spacing:1.3px;
  padding:0 6px;
}

.ef-footer strong{
  font-size:8px;
}

.ef-ai{
  min-height:0;
}

.ef-ai-ring{
  width:66px;height:66px;
  border:5px solid #28c2ff;
  border-radius:50%;
  margin:12px auto 15px;
  display:grid;
  place-items:center;
  box-shadow:0 0 24px rgba(40,194,255,.36),inset 0 0 16px rgba(40,194,255,.22);
}

.ef-ai-ring i{
  width:38px;height:38px;
  border:1px solid rgba(40,194,255,.8);
  border-radius:50%;
  box-shadow:inset 0 0 12px rgba(40,194,255,.16);
}

.ef-kv{
  display:flex;
  justify-content:space-between;
  font-size:8px;
  color:#8cb1bf;
}

.ef-kv b{color:var(--green)}

.ef-chart{
  width:100%;
  height:92px;
}

.ef-health{
  height:82px;
  display:flex;
  align-items:flex-end;
  gap:10px;
}

.ef-health i{
  flex:1;
  min-width:13px;
  background:linear-gradient(180deg,#53f084,#32ce61);
  box-shadow:0 0 11px rgba(65,233,116,.18);
}

.ef-health-foot{
  text-align:right;
  color:var(--green);
  font-size:11px;
  font-weight:700;
  margin-top:5px;
}

.ef-story-controls{
  min-height:0;
}

.ef-tech-btn{
  min-height:30px;
  border:1px solid rgba(37,174,225,.44);
  background:linear-gradient(180deg,rgba(3,19,29,.96),rgba(2,13,21,.96));
  color:#7cdcff;
  cursor:pointer;
  font-size:7px;
  letter-spacing:1px;
  padding:5px 4px;
}

.ef-tech-btn:hover,
.ef-tech-btn.active{
  color:var(--gold2);
  border-color:rgba(242,182,50,.78);
  background:rgba(42,31,6,.78);
  box-shadow:0 0 12px rgba(242,182,50,.06);
}

.ef-tech-btn.gold{
  color:var(--gold);
  border-color:rgba(242,182,50,.50);
}

/* ------------------------------------------------------------
   Embedded story scaling.
   Important: visual runtime only, no permanent index modification.
   ------------------------------------------------------------ */

body.ef-loaded #efStoryFrame{
  transform:none;
}

@media(min-width:1700px){
  body{
    grid-template-columns:300px minmax(860px,1fr) 310px 132px;
  }
}

@media(max-width:1550px){
  body{
    grid-template-columns:245px minmax(610px,1fr) 245px 110px;
    gap:9px;
    padding:8px;
  }

  .ef-topbar{
    grid-template-columns:310px 1fr 150px;
  }

  .ef-top-status{
    gap:16px;
  }

  .ef-right{
    grid-template-rows:155px 130px 130px 1fr;
  }
}

@media(max-width:1250px){
  body{
    grid-template-columns:205px minmax(520px,1fr) 210px 94px;
  }

  .ef-top-status span:nth-child(n+3){
    display:none;
  }

  .ef-brand small{
    display:none;
  }
}
/* ============================================================
   ZENITH MOBILE STEP 3
   Smartphone responsive shell
   STEP 5 real-phone breakpoint active
   Desktop layout remains untouched
   ============================================================ */
@media (max-width:1100px), (hover:none) and (pointer:coarse){

  html{
    width:100%;
    min-height:100%;
    height:auto;
    overflow-x:hidden;
    overflow-y:auto;
  }

  body{
    width:100%;
    min-width:0;
    min-height:100vh;
    height:auto;
    margin:0;
    padding:7px;
    gap:8px;
    overflow-x:hidden;
    overflow-y:visible;

    display:flex;
    flex-direction:column;
  }

  .ef-bg{
    position:fixed;
  }

  .ef-topbar{
    order:1;
    width:100%;
    min-height:56px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    padding:7px 9px;
  }

  .ef-brand{
    min-width:0;
    gap:8px;
  }

  .ef-z{
    width:34px;
    height:34px;
    flex:0 0 34px;
    font-size:20px;
  }

  .ef-brand b{
    font-size:11px;
    letter-spacing:1.6px;
    white-space:nowrap;
  }

  .ef-brand small{
    display:none;
  }

  .ef-top-status{
    display:none;
  }

  .ef-clock{
    flex:0 0 auto;
    font-size:6px;
    letter-spacing:.6px;
  }

  .ef-clock b{
    font-size:10px;
    margin-top:2px;
  }

  .ef-center{
    order:2;
    width:100%;
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:7px;
  }

  .ef-center-head{
    min-height:50px;
    width:100%;
    padding:7px 10px;
    gap:8px;
  }

  .ef-center-head small{
    font-size:6px;
    letter-spacing:1px;
  }

  .ef-center-head strong{
    margin-top:3px;
    font-size:9px;
    letter-spacing:.7px;
  }

  .ef-center-state{
    flex:0 0 auto;
    font-size:6px;
  }

  .ef-stage{
    width:100%;
    height:62vh;
    min-height:430px;
    max-height:720px;
    overflow:hidden;
  }

  #efStoryFrame{
    width:100%;
    height:100%;
    min-width:0;
    border:0;
  }

  .ef-footer{
    min-height:22px;
    width:100%;
    padding:0 4px;
    gap:5px;
    font-size:5px;
    letter-spacing:.4px;
  }

  .ef-footer strong{
    font-size:7px;
  }

  .ef-footer span{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .ef-left{
    order:3;
    width:100%;
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:8px;
  }

  .ef-chapter-panel{
    order:1;
    width:100%;
    min-height:0;
    overflow:visible;
  }

  .ef-chapters{
    width:100%;
    height:auto;
    display:flex;
    flex-direction:row;
    gap:6px;
    overflow-x:auto;
    overflow-y:hidden;
    padding:0 0 5px;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
  }

  .ef-chapter{
    flex:0 0 150px;
    width:150px;
    min-height:48px;
    grid-template-columns:30px 1fr;
    gap:6px;
    padding:6px;
    scroll-snap-align:start;
  }

  .ef-num{
    width:27px;
    height:27px;
    font-size:8px;
  }

  .ef-chapter strong{
    font-size:7px;
  }

  .ef-chapter small{
    font-size:6px;
  }

  .ef-status-panel{
    order:2;
  }

  .ef-panel{
    width:100%;
    padding:11px;
  }

  .ef-panel h3{
    margin-bottom:8px;
    font-size:8px;
  }

  .ef-status-panel>div,
  .ef-story-controls>div{
    padding:6px 0;
    font-size:7px;
  }

  .ef-right{
    order:4;
    width:100%;
    min-width:0;
    min-height:0;
    display:grid;
    grid-template-columns:1fr 1fr;
    grid-template-rows:auto auto;
    gap:8px;
  }

  .ef-ai{
    min-height:150px;
  }

  .ef-ai-ring{
    width:55px;
    height:55px;
    margin:8px auto 10px;
  }

  .ef-chart{
    height:75px;
  }

  .ef-health{
    height:68px;
  }

  .ef-story-controls{
    min-height:0;
  }

  .ef-techrail{
    order:5;
    width:100%;
    min-width:0;
    min-height:44px;
    display:flex;
    flex-direction:row;
    gap:5px;
    overflow-x:auto;
    overflow-y:hidden;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
  }

  .ef-tech-btn{
    flex:0 0 auto;
    min-width:92px;
    min-height:36px;
    padding:5px 8px;
    font-size:6px;
    white-space:nowrap;
  }
}

@media (max-width:600px){

  body{
    padding:5px;
    gap:6px;
  }

  .ef-stage{
    height:68vh;
    min-height:420px;
  }

  .ef-right{
    grid-template-columns:1fr;
  }

  .ef-footer span:first-child{
    display:none;
  }

  .ef-chapter{
    flex-basis:138px;
    width:138px;
  }
}

/* ===== END ZENITH MOBILE STEP 3 ===== */

/* ============================================================
   ZENITH MOBILE STEP 7B - TRUE STORY MODE
   ============================================================ */
@media (max-width:1100px), (hover:none) and (pointer:coarse){
  html,body{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:100%!important;
    min-height:100%!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
  }

  body{
    display:block!important;
  }

  .ef-bg{
    display:none!important;
  }

  .ef-topbar{
    display:flex!important;
    position:relative!important;
    width:100%!important;
    height:54px!important;
    min-height:54px!important;
    margin:0!important;
    padding:6px 10px!important;
    border-left:0!important;
    border-right:0!important;
  }

  .ef-brand{
    display:flex!important;
  }

  .ef-z{
    width:34px!important;
    height:34px!important;
    flex:0 0 34px!important;
  }

  .ef-brand b{
    font-size:12px!important;
  }

  .ef-brand small,
  .ef-top-status,
  .ef-clock,
  .ef-left,
  .ef-right,
  .ef-techrail,
  .ef-center-head,
  .ef-footer{
    display:none!important;
  }

  .ef-center{
    display:block!important;
    position:absolute!important;
    left:0!important;
    right:0!important;
    top:54px!important;
    bottom:0!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
  }

  .ef-stage{
    display:block!important;
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-width:none!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    border-left:0!important;
    border-right:0!important;
    overflow:hidden!important;
  }

  #efStoryFrame,
  body.ef-loaded #efStoryFrame{
    display:block!important;
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    transform:none!important;
    transform-origin:top left!important;
  }
}
/* ===== END ZENITH MOBILE STEP 7B ===== */
