/* Starwork 官网 · 首页
   颜色取自正式 VI v1.0：品牌黄 #FFDF00、图形黑 #111111、暖白 #F5F2E9。 */
:root{
  --ink:#111111;
  --yellow:#FFDF00;
  --paper:#F5F2E9;
  --white:#FFFFFF;
  --muted:#8A8A8A;
  --dim:#4A4A4A;
  --px:"Fusion Pixel 12px Proportional Simplified Chinese", "PingFang SC", monospace;

  --pad-y:clamp(16px, 3vmin, 36px);
  --pad-x:clamp(18px, 4vmin, 56px);
  /* 底部一整行：左边是小星星的家，中间是终端，右边是按键提示；海报只在它上面排。
     --mascot-h 是小星星的“家”的高度，也是小星星从鞋底到头顶的高度（画布上画，见 mascot.js）；
     沿用 T004 的尺寸：--star-h 是旧素材里星星图形的高度，909 / 812 是旧素材画布比图形大的那一圈。
     跳起来和冒 Z z z、! 的空间不算在这一行里：星星在最左边，头顶上方是海报区左侧的空白。 */
  --star-h:clamp(96px, 17vh, 168px);
  --mascot-h:calc(var(--star-h) * 909 / 812);
  /* 家的宽度：小星星平时两手摊开、甩手，比原来的素材宽，留够位置让手不伸进气泡挡字（T006） */
  --mascot-w:calc(var(--mascot-h) * 1.4);
  /* 终端留 5 行：记录 3 行、站点菜单 1 行、指令 1 行。菜单换行时，记录少露一行（T017：24 px 6 行 → 20 px 5 行，让出地方给海报） */
  --term-fs:20px;
  --term-lh:1.7;
  --term-h:calc(var(--term-fs) * var(--term-lh) * 5 + 22px);
  /* 终端尽量居中，窄桌面可使用两侧多出来的空间。家这边多让 40 px，留给小星星甩手。 */
  --term-left:calc(var(--mascot-w) + 40px);
  --term-right:306px;
  --osd-h:max(var(--mascot-h), var(--term-h));
  --label-h:64px;         /* 海报下方站名与地址的高度 */
  --gap:clamp(40px, 5.5vw, 110px);   /* 海报左右间距（T017 放宽） */
}
*{box-sizing:border-box}
html,body{margin:0; height:100%; background:#000; color:var(--white)}
body{font-family:var(--px); font-size:12px; -webkit-font-smoothing:none; overflow:hidden}
button{font:inherit}

/* ───────── 屏幕：铺满视口的黑屏 ───────── */
.screen{position:fixed; inset:0; overflow:hidden; isolation:isolate; background:#000}

/* 点阵星空（T012）：屏幕里最底层 */
.sky{position:absolute; inset:0; width:100%; height:100%; z-index:0; pointer-events:none; display:block}

.stage{
  position:absolute; inset:0; z-index:1;
  display:grid; grid-template-rows:auto minmax(0, 1fr) var(--osd-h);
  /* 列宽固定为可用宽度，不让底部一行（小星星、气泡、按键提示）的内容把整列撑宽，海报才能按真实宽度缩 */
  grid-template-columns:minmax(0, 1fr);
  padding:var(--pad-y) var(--pad-x);
  text-shadow:0 0 4px rgba(255,255,255,.2);
}

/* 玻璃效果只剩扫描线、轻微闪烁和很轻的暗角，没有弧形边 */
.fx{position:absolute; inset:0; z-index:50; pointer-events:none}
.fx i{position:absolute; inset:0; display:block}
.scan{
  background:repeating-linear-gradient(to bottom, rgba(0,0,0,.30) 0 1px, transparent 1px 3px);
  mix-blend-mode:multiply;
  animation:flicker 5s steps(1) infinite;
}
.vignette{background:radial-gradient(ellipse 85% 85% at 50% 50%, transparent 62%, rgba(0,0,0,.28) 100%)}
@keyframes flicker{0%{opacity:1}11%{opacity:.82}12%{opacity:1}63%{opacity:.9}64%{opacity:1}}

.topbar{display:flex; align-items:center; justify-content:space-between; gap:16px}
.brand{display:block; height:40px}
.brand img{height:100%; display:block}
.status{display:flex; gap:20px; color:var(--muted)}
.led{display:inline-block; width:6px; height:6px; background:var(--yellow); margin-right:8px; vertical-align:1px; box-shadow:0 0 6px var(--yellow); animation:blink 1.6s steps(1) infinite}
@keyframes blink{50%{opacity:.15}}

/* 标题和海报之间、站名和终端之间的留白（T017 放宽） */
.center{display:grid; grid-template-rows:auto minmax(0, 1fr); justify-items:center; gap:clamp(18px, 3.4vh, 44px); padding:8px 0 clamp(20px, 4vh, 48px); min-height:0}
.hello{text-align:center}
.prompt{color:var(--muted); margin-bottom:10px}
.hello h1{
  margin:0; font-weight:400; font-size:48px; line-height:1; color:var(--yellow);
  text-shadow:-2px 0 rgba(255,40,90,.35), 2px 0 rgba(0,200,255,.3), 0 0 18px rgba(255,223,0,.45);
}
.hello h1 .w{color:var(--white); text-shadow:-2px 0 rgba(255,40,90,.35), 2px 0 rgba(0,200,255,.3), 0 0 14px rgba(255,255,255,.35)}
.caret{display:inline-block; width:.5em; height:.12em; background:currentColor; margin-left:.08em; animation:blink 1s steps(1) infinite}
@media (min-height:960px){ .hello h1{font-size:72px} }

/* ───────── 三张海报 ─────────
   海报区是一个尺寸容器：海报宽度按剩下的高度和宽度取小，底部那一行留给小星星，互不遮挡。 */
.posters{
  container-type:size; width:100%; height:100%; min-height:0;
  display:flex; justify-content:center; align-items:center; gap:var(--gap);
  list-style:none; margin:0; padding:0;
}
.poster{
  width:min(calc((100cqh - var(--label-h) - 16px) * 2 / 3), calc((100cqw - 2 * var(--gap)) / 3), 520px);
}
.poster a{display:block; color:inherit; text-decoration:none; outline:none}
.sheet{
  position:relative; width:100%; aspect-ratio:2/3;
  transform:rotate(var(--tilt));
  transition:transform 180ms steps(3);
}
.sheet canvas{width:100%; height:100%; display:block}
.poster.is-active .sheet{
  transform:rotate(0deg) translateY(-8px) scale(1.04);
  filter:drop-shadow(0 0 18px rgba(255,223,0,.28));
}
.poster.is-locked .sheet canvas{filter:saturate(.75) brightness(.92)}
.poster.is-locked.is-active .sheet canvas{filter:none}
/* 键盘焦点：黄色像素描边，和“选中”的抬起与发光区分开 */
.poster a:focus-visible .sheet::after{
  content:""; position:absolute; inset:-10px; pointer-events:none;
  border:4px solid var(--yellow);
  /* 切掉四个角，做成像素的阶梯角 */
  clip-path:polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}

.label{margin-top:14px; display:flex; align-items:baseline; gap:8px}
.cur{width:12px; color:var(--yellow); visibility:hidden}
.poster.is-active .cur{visibility:visible; animation:blink .8s steps(1) infinite}
.name{font-size:24px; line-height:1; white-space:nowrap}
.poster.is-active .name{color:var(--yellow); text-shadow:0 0 10px rgba(255,223,0,.5)}
.host{margin:8px 0 0 20px; color:var(--dim)}
.poster.is-active .host{color:var(--muted)}

/* ───────── 底部一行：左下角小星星的家，海报正下方是终端 ───────── */
.osd{position:relative; display:flex; align-items:flex-end; justify-content:space-between; gap:24px; min-height:0}
/* 小星星的“家”：只占位置，小星星画在下面那层画布上，脚踩在这块的底边中点，高度决定小星星多大 */
.mascot{flex:0 0 auto; width:var(--mascot-w); height:var(--mascot-h)}

/* 星星的场景与舞台分开，坐标一直按视口计算 */
.star-scene{position:fixed; inset:0; z-index:60; pointer-events:none}
.screen > .star-scene{z-index:35}
/* 鼠标由系统画（T015：页面自己画会比系统指针晚约 1.5 帧）。图由 tools/cursors.py 生成：每格 3 px，
   四周各 2 格荧光，每格底下 1 px 扫描线；高清屏用 2、3 倍图。热点 = (原图格数 + 2) × 3 px，和 cursor.js 的 SHAPES 一致。
   优先顺序：关机隐藏 > 沙漏 > 握拳 > 张开手 > 竖线 > 手指 > 箭头。
   残影图自带扫描线，所以残影层放在屏幕扫描线（.fx，50）上面，不再被压暗一遍 */
.cursor-overlay{position:absolute; inset:0; z-index:51; pointer-events:none}
.cursor-trail{position:absolute; left:0; top:0}
@media (any-hover:hover) and (any-pointer:fine){
  .screen{
    cursor:url("../assets/cursor/arrow.svg") 6 6, default;
    cursor:-webkit-image-set(url("../assets/cursor/arrow.svg") 1x, url("../assets/cursor/arrow@2x.svg") 2x, url("../assets/cursor/arrow@3x.svg") 3x) 6 6, default;
    cursor:image-set(url("../assets/cursor/arrow.svg") 1x, url("../assets/cursor/arrow@2x.svg") 2x, url("../assets/cursor/arrow@3x.svg") 3x) 6 6, default;
  }
  .screen :is(a[href],button:not(:disabled)){
    cursor:url("../assets/cursor/hand.svg") 21 6, pointer;
    cursor:-webkit-image-set(url("../assets/cursor/hand.svg") 1x, url("../assets/cursor/hand@2x.svg") 2x, url("../assets/cursor/hand@3x.svg") 3x) 21 6, pointer;
    cursor:image-set(url("../assets/cursor/hand.svg") 1x, url("../assets/cursor/hand@2x.svg") 2x, url("../assets/cursor/hand@3x.svg") 3x) 21 6, pointer;
  }
  .screen input{
    cursor:url("../assets/cursor/text.svg") 15 27, text;
    cursor:-webkit-image-set(url("../assets/cursor/text.svg") 1x, url("../assets/cursor/text@2x.svg") 2x, url("../assets/cursor/text@3x.svg") 3x) 15 27, text;
    cursor:image-set(url("../assets/cursor/text.svg") 1x, url("../assets/cursor/text@2x.svg") 2x, url("../assets/cursor/text@3x.svg") 3x) 15 27, text;
  }
  html.star-over, html.star-over *{
    cursor:url("../assets/cursor/open-hand.svg") 30 36, grab !important;
    cursor:-webkit-image-set(url("../assets/cursor/open-hand.svg") 1x, url("../assets/cursor/open-hand@2x.svg") 2x, url("../assets/cursor/open-hand@3x.svg") 3x) 30 36, grab !important;
    cursor:image-set(url("../assets/cursor/open-hand.svg") 1x, url("../assets/cursor/open-hand@2x.svg") 2x, url("../assets/cursor/open-hand@3x.svg") 3x) 30 36, grab !important;
  }
  html.star-holding, html.star-holding *{
    cursor:url("../assets/cursor/closed-hand.svg") 30 33, grabbing !important;
    cursor:-webkit-image-set(url("../assets/cursor/closed-hand.svg") 1x, url("../assets/cursor/closed-hand@2x.svg") 2x, url("../assets/cursor/closed-hand@3x.svg") 3x) 30 33, grabbing !important;
    cursor:image-set(url("../assets/cursor/closed-hand.svg") 1x, url("../assets/cursor/closed-hand@2x.svg") 2x, url("../assets/cursor/closed-hand@3x.svg") 3x) 30 33, grabbing !important;
  }
  .screen:is(.posting,.booting,.cursor-opening),.screen:is(.posting,.booting,.cursor-opening) *{
    cursor:url("../assets/cursor/hourglass.svg") 24 30, wait !important;
    cursor:-webkit-image-set(url("../assets/cursor/hourglass.svg") 1x, url("../assets/cursor/hourglass@2x.svg") 2x, url("../assets/cursor/hourglass@3x.svg") 3x) 24 30, wait !important;
    cursor:image-set(url("../assets/cursor/hourglass.svg") 1x, url("../assets/cursor/hourglass@2x.svg") 2x, url("../assets/cursor/hourglass@3x.svg") 3x) 24 30, wait !important;
  }
  .screen:is(.off,.shutting),.screen:is(.off,.shutting) *{cursor:none !important}
}
.screen .star{filter:drop-shadow(0 0 5px rgba(255,223,0,.28))}
.screen .say{box-shadow:0 -4px var(--ink), 0 4px var(--ink), -4px 0 var(--ink), 4px 0 var(--ink), 0 0 7px rgba(255,255,255,.3)}
.star{position:absolute; inset:0; width:100%; height:100%}
html.star-over, html.star-over *{cursor:grab}
html.star-holding, html.star-holding *{cursor:grabbing; user-select:none}
/* 键盘用的按钮：透明，盖在星星身上，只在键盘选中时露出焦点框 */
.star-hit{
  position:fixed; left:0; top:0; z-index:61; padding:0; border:0; background:none; pointer-events:none;
  outline:none; border-radius:50%;
}
.star-hit:focus-visible{outline:2px dashed var(--yellow); outline-offset:2px}
/* 头顶小气泡：一句话的反应，跟着头走 */
.say{
  position:fixed; left:0; top:0; z-index:62; pointer-events:none;
  max-width:min(240px, calc(100vw - 16px)); padding:4px 10px; line-height:1.8; white-space:nowrap;
  background:var(--paper); color:var(--ink); font-size:12px;
  box-shadow:0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink);
  visibility:hidden;
}
.say.on{visibility:visible}
.thrown-option{
  position:absolute; z-index:62; padding:0 4px; white-space:nowrap; color:var(--yellow);
  text-shadow:0 0 6px rgba(255,223,0,.45);
}

/* 终端：不用卡片，白字写在黑底上，黄色做重点；和顶上的 C:\STARWORK> 是同一种样子 */
.term{
  --centered-inset:max(calc((100% - 880px) / 2), min(max(var(--term-left), var(--term-right)), calc((100% - 530px) / 2)));
  position:absolute; left:max(var(--term-left), var(--centered-inset)); right:max(var(--term-right), var(--centered-inset)); bottom:0;
  max-height:var(--term-h);
  display:flex; flex-direction:column;
  font-size:var(--term-fs); line-height:var(--term-lh); color:var(--white);
}
/* 记录固定留 3 行；站点菜单折行时，记录让出位置。 */
.log{flex:0 1 auto; min-height:calc(var(--term-lh) * 1em); height:calc(var(--term-lh) * 3em); overflow-y:auto; overflow-wrap:anywhere; scrollbar-width:none}
.log::-webkit-scrollbar{display:none}
.log > div{white-space:pre-wrap}
.log .out::before{content:"STAR> "; color:var(--yellow); text-shadow:0 0 6px rgba(255,223,0,.45)}
.log .in{color:var(--muted)}
.log .in::before{content:"> "; color:var(--yellow); text-shadow:0 0 6px rgba(255,223,0,.45)}
.more{margin-left:.5em; color:var(--yellow); animation:blink .7s steps(1) infinite}
.choices{position:relative; display:flex; flex-wrap:wrap; gap:0 20px; margin-top:6px; flex:0 0 auto; overflow-x:auto; scrollbar-width:none}
.choices::-webkit-scrollbar{display:none}
.choices.has-more{mask-image:linear-gradient(to right, #000 calc(100% - 36px), transparent)}
.choices button{
  flex:0 0 auto; white-space:nowrap; color:var(--yellow); background:transparent; cursor:pointer;
  border:0; padding:0 4px; font-size:inherit; line-height:inherit; text-align:left;
  text-shadow:0 0 6px rgba(255,223,0,.45);
}
.choices button:hover, .choices button:focus-visible{background:var(--yellow); color:#000; text-shadow:none; outline:none}
.cmd{display:flex; align-items:center; gap:.5em; margin-top:6px; color:var(--yellow); text-shadow:0 0 6px rgba(255,223,0,.45); flex:0 0 auto}
.cmd input{flex:1; min-width:0; font:inherit; color:var(--white); background:transparent; border:0; outline:none; caret-color:var(--yellow); padding:0; text-shadow:inherit}
.cmd input{text-shadow:0 0 4px rgba(255,255,255,.2)}
.cmd input::placeholder{color:var(--dim)}

.hint{color:var(--dim); white-space:nowrap; padding-bottom:4px; align-self:flex-end}
.hint b{color:var(--muted); font-weight:400; border:1px solid var(--dim); padding:1px 6px; margin:0 4px}

/* ICP 备案号（T013）：电脑版面放在舞台底边的留白里，居中，在终端下面，不占底部那一行 */
.icp{position:absolute; left:0; right:0; bottom:0; height:var(--pad-y); margin:0; display:flex; align-items:center; justify-content:center; pointer-events:none}
.icp a{color:var(--muted); text-decoration:none; pointer-events:auto}
.icp a:hover, .icp a:focus-visible{color:var(--white); outline:none; text-decoration:underline}

/* ───────── 开关机 ───────── */
.tube{position:absolute; inset:0; z-index:40; pointer-events:none}
.tube i{display:block; width:100%; height:100%; background:#fff; opacity:0}
.screen.booting :is(.stage, .sky){animation:power-on 760ms cubic-bezier(.2,.7,.2,1) both}
.screen.booting .tube i{animation:flash 760ms ease-out both}
@keyframes power-on{
  0%{transform:scale(.002,.002); opacity:0}
  10%{opacity:1}
  25%{transform:scale(1,.004)}
  60%{transform:scale(1,1.02)}
  100%{transform:scale(1,1)}
}
@keyframes flash{0%{opacity:0}20%{opacity:.6}60%{opacity:.1}100%{opacity:0}}
.screen.shutting :is(.stage, .star-scene, .sky){animation:power-off 520ms cubic-bezier(.7,0,.8,.3) both}
.screen.shutting .tube i{animation:flash 520ms ease-in both}
@keyframes power-off{
  0%{transform:scale(1,1)}
  45%{transform:scale(1,.004)}
  80%{transform:scale(.004,.004); opacity:1}
  100%{transform:scale(0,0); opacity:0}
}
.screen.off :is(.stage, .star-scene, .sky), .screen.posting :is(.stage, .star-scene, .sky){visibility:hidden}
.screen:is(.off, .posting) .say{visibility:hidden}
.screen.off .scan{animation:none}
.offhint{position:absolute; inset:0; z-index:30; display:none; place-items:center; color:#3a3a3a; cursor:pointer}
.screen.off .offhint{display:grid}

.post{position:absolute; inset:0; z-index:20; padding:clamp(20px, 5vmin, 60px); color:#B8B8B8; line-height:2; white-space:pre; display:none}
.screen.posting .post{display:block}

/* 桌面版面里按键提示放在右下角；窗口不到 1000 宽时放不下，先藏起来，终端两边只让出家的位置 */
@media (max-width:999px){ .hint{display:none} :root{--term-right:0px} }

/* ───────── 窄屏：上下排，海报横向滑动，小星星和终端在海报下面 ─────────
   切换点：宽不超过 860，或高不到 720。高不到 720 时，桌面版面的海报会小于 1280 × 720 下的 159 px 宽，
   与其继续缩，不如换成这个版面（整页上下滚，海报横向滑）。 */
@media (max-width:860px), (max-height:719px){
  :root{--pad-y:14px; --pad-x:14px; --osd-h:auto; --term-fs:18px; --term-max:760px}
  .stage{display:flex; flex-direction:column; overflow-y:auto; overflow-x:hidden; scrollbar-width:none}
  .stage::-webkit-scrollbar{display:none}
  .brand{height:30px}
  .status .clock{display:none}
  .center{display:block; padding:18px 0 4px}
  .hello h1{font-size:40px}
  .prompt{margin-bottom:8px}
  .posters{
    container-type:normal; height:auto; justify-content:flex-start;
    width:calc(100% + 2 * var(--pad-x)); margin:16px calc(-1 * var(--pad-x)) 0; padding:10px var(--pad-x) 4px;
    gap:18px; overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none;
  }
  .posters::-webkit-scrollbar{display:none}
  /* 手机上约 56% 屏宽；屏越宽占比越小，最多 45% 屏宽，平板竖屏一屏能看到一张半以上。
     矮的屏按高度缩：海报下面还要放小星星和占满整行的终端（T008），520 px 是除海报外其余部分的高度。
     海报图最小缩到 84 px；站名、地址那一栏至少 108 px，不然相邻两张的地址挤到一起，图比栏窄时靠左 */
  .poster{--pw:max(84px, min(56vw, max(210px, 45vw), calc((100dvh - 520px) * 2 / 3))); flex:0 0 auto; width:max(108px, var(--pw)); scroll-snap-align:center}
  .poster .sheet{width:var(--pw)}
  .host{white-space:nowrap}
  /* 三张放得下时居中，放不下时从左排起、可以横向滑 */
  .poster:first-child{margin-left:auto}
  .poster:last-child{margin-right:auto}
  /* 终端占满整行（最宽和电脑版面的终端差不多，居中），小星星的家在终端上方、和终端左边对齐（T008，用户选“整行，星星在上”） */
  .osd{display:flex; flex-direction:column; align-items:center; gap:8px; margin-top:auto; padding-top:8px}
  .hint{display:none}
  .term{position:static; width:100%; max-width:var(--term-max); max-height:none; margin-bottom:6px}
  .log{height:calc(var(--term-lh) * 3em)}
  /* 站点菜单一行放不下时横向滑，和海报一样。 */
  .choices{flex-wrap:nowrap}
  /* 家的下边是地面，坐下伸腿时鞋会画到地面下约 25 px，所以家下面留 20 px（加上 gap 8 px），免得压住终端第一行（T008） */
  .mascot{width:106px; height:76px; align-self:flex-start; margin-bottom:20px; margin-left:max(0px, calc((100% - var(--term-max)) / 2))}
  /* 内容不够放时整屏上下滚动，不让各块互相压住 */
  .topbar, .center, .osd{flex-shrink:0}
  /* 横滑版面：备案号接在终端后面、跟着整页滚动；用负边距把它放进终端下边距和舞台底边的留白里（上 −4、下 4 − 14），总高不变，不把页面撑高，离屏幕底边 4 px */
  .icp{position:static; flex-shrink:0; height:14px; line-height:14px; margin:-4px 0 calc(4px - var(--pad-y))}
}
/* 横滑版面里宽一些的窗口（宽 ≥ 660，如 1366 × 650、900 × 700、768 × 1024）：小星星站在终端左边，和 T007 一样。
   660 宽时家右边的终端约 490 px，放得下约 30 个字；更窄才把家放到终端上面（T008，产品经理 2026-11-16）。
   海报按 T007 的算法，不比 T007 小 */
@media (min-width:660px) and (max-width:860px), (min-width:660px) and (max-height:719px){
  .poster{--pw:max(120px, min(56vw, max(210px, 45vw), calc((100dvh - 400px) * 2 / 3)))}
  .osd{flex-direction:row; align-items:flex-end; justify-content:flex-start; gap:32px}   /* 32 px：小星星甩手时手套不伸进终端的字 */
  .term{flex:1; min-width:0; width:auto}
  .mascot{align-self:auto; margin:0}
}
@media (max-height:640px){
  .osd{padding-top:4px}
  .prompt{display:none}
  .hello h1{font-size:32px}
  .center{padding-top:10px}
  .posters{margin-top:8px}
}
/* 320 × 568 这类最矮的手机：海报再缩，站名下的地址会折行反而更高，所以从标题和间距里省出地方（T008） */
@media (max-height:600px){
  :root{--term-fs:16px}
  .hello h1{font-size:24px}
  .center{padding:4px 0 0}
  .posters{margin-top:2px; padding-top:4px; padding-bottom:0}
  .osd{padding-top:0}
  .term{margin-bottom:0}
  .icp{margin:0 0 calc(-1 * var(--pad-y))}   /* 终端没有下边距了，备案号直接接在终端下面，贴着屏幕底边 */
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none !important; transition:none !important}
}
