/* ==========================================================================================
   screens/title.css — title screen: radar + ridgeline backdrop, dot-matrix emblem, big title,
   nickname console. Pure CSS/SVG art; an optional backdrop image fades in underneath.
   ========================================================================================== */

.title-screen { align-items: center; justify-content: center; }

/* ---- backdrop ----------------------------------------------------------------------------------- */
.title-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.title-bg__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  object-position: center 30%;
  filter: saturate(.8) brightness(.9);
  transition: opacity 600ms ease;
}
.title-bg.has-art .title-bg__art { opacity: .8; }
/* The real backdrop already carries a radar + target point; keep only the sweep over it. */
.title-bg.has-art .title-bg__target { display: none; }
.title-bg.has-art .title-bg__radar { opacity: .35; }
.title-bg__ridge-art {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-0.1 * var(--ui-unit, 1rem));
  height: calc(3.3 * var(--ui-unit, 1rem));
  background-repeat: repeat-x;
  background-position: center bottom;
  background-size: auto 100%;
  opacity: 0;
  transition: opacity 600ms ease;
}
.title-bg.has-ridges .title-bg__ridge-art { opacity: 1; }
.title-bg__ridges { animation: fade-in 600ms ease backwards; }
@keyframes fade-in { from { opacity: 0; } }
.title-bg__glow {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: calc(6 * var(--ui-unit, 1rem));
  background:
    radial-gradient(48% 42% at 50% 78%, rgba(23, 249, 183, .40), rgba(23, 249, 183, .08) 62%, transparent 76%),
    radial-gradient(26% 26% at 50% 80%, rgba(120, 255, 215, .30), transparent 70%);
  filter: blur(calc(0.06 * var(--ui-unit, 1rem)));
  animation: glow-breathe 7s ease-in-out infinite;
}
@keyframes glow-breathe { 50% { opacity: .78; } }

.title-bg__radar {
  position: absolute;
  left: 17%;
  top: 40%;
  width: calc(5.6 * var(--ui-unit, 1rem));
  height: calc(5.6 * var(--ui-unit, 1rem));
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 calc(0.05 * var(--ui-unit, 1rem)), rgba(78, 216, 175, .5) calc(0.05 * var(--ui-unit, 1rem)) calc(0.065 * var(--ui-unit, 1rem)), transparent calc(0.065 * var(--ui-unit, 1rem))),
    repeating-radial-gradient(circle, transparent 0 calc(0.69 * var(--ui-unit, 1rem)), rgba(78, 216, 175, .16) calc(0.69 * var(--ui-unit, 1rem)) calc(0.7 * var(--ui-unit, 1rem))),
    linear-gradient(rgba(78, 216, 175, .12), rgba(78, 216, 175, .12)) center / 100% 1px no-repeat,
    linear-gradient(rgba(78, 216, 175, .12), rgba(78, 216, 175, .12)) center / 1px 100% no-repeat;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 71%);
  mask-image: radial-gradient(circle, #000 55%, transparent 71%);
  opacity: .8;
}
.title-bg__sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* The bright edge must LEAD and the glow must trail BEHIND it. A conic gradient's angle grows
     clockwise from 0deg (12 o'clock), and radar-sweep rotates clockwise too — so the bright end has
     to sit at 100% (== 0deg) and fade counter-clockwise from there. Written the other way round
     (bright at 0% fading to 22%) the glow fans out AHEAD of the beam and the sweep reads backwards. */
  background: conic-gradient(from 0deg, transparent 0 78%, rgba(23, 249, 183, .28) 100%);
  animation: radar-sweep 6s linear infinite;
}
@keyframes radar-sweep { to { transform: rotate(360deg); } }

.title-bg__target {
  position: absolute;
  right: 12%;
  top: 22%;
  width: calc(1.3 * var(--ui-unit, 1rem));
  height: calc(1.3 * var(--ui-unit, 1rem));
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(246, 163, 41, .9) 0 calc(0.06 * var(--ui-unit, 1rem)), transparent calc(0.065 * var(--ui-unit, 1rem))),
    radial-gradient(circle, transparent 0 calc(0.2 * var(--ui-unit, 1rem)), rgba(246, 163, 41, .5) calc(0.2 * var(--ui-unit, 1rem)) calc(0.215 * var(--ui-unit, 1rem)), transparent calc(0.215 * var(--ui-unit, 1rem))),
    radial-gradient(circle, transparent 0 calc(0.5 * var(--ui-unit, 1rem)), rgba(246, 163, 41, .22) calc(0.5 * var(--ui-unit, 1rem)) calc(0.51 * var(--ui-unit, 1rem)), transparent calc(0.51 * var(--ui-unit, 1rem))),
    radial-gradient(circle, rgba(246, 163, 41, .18), transparent 70%);
  animation: target-pulse 3.2s ease-in-out infinite;
}
.title-bg__target::after {
  content: 'TARGET POINT';
  position: absolute;
  left: 110%;
  top: 50%;
  transform: translateY(-50%);
  padding: calc(0.02 * var(--ui-unit, 1rem)) calc(0.08 * var(--ui-unit, 1rem));
  border: 1px solid rgba(246, 163, 41, .35);
  font-family: var(--font-display);
  font-size: calc(0.1 * var(--utility-text, var(--t)));
  letter-spacing: .2em;
  color: rgba(246, 163, 41, .7);
  white-space: nowrap;
}
@keyframes target-pulse { 50% { transform: scale(1.06); opacity: .75; } }

.title-bg__ridges { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 40%; }
.title-bg__ridges .ridge { stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.title-bg__ridges .ridge--far { opacity: .95; }
.title-bg__haze {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 15, 14, .6) 0%, transparent 25%, transparent 70%, rgba(6, 8, 7, .7) 100%),
    radial-gradient(46% 42% at 50% 44%, rgba(10, 13, 12, .82), rgba(10, 13, 12, .4) 60%, transparent 80%);
}

/* ---- corners ------------------------------------------------------------------------------------- */
.title-corner { position: absolute; z-index: 2; display: flex; align-items: flex-start; gap: calc(0.12 * var(--ui-unit, 1rem)); line-height: 1.7; }
.title-corner--tl { left: calc(0.44 * var(--ui-unit, 1rem)); top: calc(0.38 * var(--ui-unit, 1rem)); }
.title-corner--tr { right: calc(0.44 * var(--ui-unit, 1rem)); top: calc(0.38 * var(--ui-unit, 1rem)); text-align: right; }
.title-corner__mark {
  width: calc(0.32 * var(--ui-unit, 1rem));
  height: calc(0.32 * var(--ui-unit, 1rem));
  margin-top: calc(0.02 * var(--ui-unit, 1rem));
  border: 1px solid var(--mint-700);
  background:
    linear-gradient(var(--mint-500), var(--mint-500)) center / 40% 2px no-repeat,
    linear-gradient(var(--mint-500), var(--mint-500)) center / 2px 40% no-repeat;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

/* ---- centre column ------------------------------------------------------------------------------- */
.title-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: calc(-0.3 * var(--ui-unit, 1rem));
}

.emblem { position: relative; display: flex; align-items: center; gap: calc(0.26 * var(--ui-unit, 1rem)); margin-bottom: calc(0.26 * var(--ui-unit, 1rem)); animation: rise-in 600ms var(--ease-out) backwards; }
.emblem__svg { width: calc(1.3 * var(--ui-unit, 1rem)); height: calc(1.4 * var(--ui-unit, 1rem)); overflow: visible; filter: drop-shadow(0 0 calc(0.12 * var(--ui-unit, 1rem)) rgba(210, 255, 240, .25)); }
.emblem__svg circle { fill: #dfe6e2; animation: dot-twinkle 4.8s ease-in-out infinite; }
.emblem__svg circle.d1 { animation-delay: -.7s; }
.emblem__svg circle.d2 { animation-delay: -1.4s; }
.emblem__svg circle.d3 { animation-delay: -2.1s; }
.emblem__svg circle.d4 { animation-delay: -2.8s; }
.emblem__svg circle.d5 { animation-delay: -3.5s; }
.emblem__svg circle.d6 { animation-delay: -4.2s; }
.emblem__svg circle.is-accent { fill: var(--mint-glow); filter: drop-shadow(0 0 calc(0.04 * var(--ui-unit, 1rem)) var(--mint-glow)); animation: none; }
@keyframes dot-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.emblem__bracket { width: calc(0.16 * var(--ui-unit, 1rem)); height: calc(1.7 * var(--ui-unit, 1rem)); border: 2px solid rgba(223, 230, 226, .45); }
.emblem__bracket--l { border-right: 0; }
.emblem__bracket--r { border-left: 0; }

.title-en {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(0.02 * var(--ui-unit, 1rem));
  font-family: var(--font-display);
  text-transform: uppercase;
  line-height: 1;
  animation: rise-in 600ms 80ms var(--ease-out) backwards;
}
.title-en__a { font-size: calc(0.34 * var(--utility-text, var(--t))); font-weight: 500; letter-spacing: .3em; padding-left: .3em; color: #cdd6d1; }
.title-en__b {
  font-size: calc(0.38 * var(--utility-text, var(--t)));
  font-weight: 700;
  letter-spacing: .34em;
  padding-left: .34em;
  color: var(--mint-500);
  text-shadow: 0 0 calc(0.18 * var(--ui-unit, 1rem)) rgba(23, 249, 183, .45);
}
.title-cn {
  margin-top: calc(0.14 * var(--ui-unit, 1rem));
  font-size: calc(1.02 * var(--utility-text, var(--t)));
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: .06em;
  color: #f4f6f5;
  text-shadow: 0 calc(0.04 * var(--ui-unit, 1rem)) calc(0.2 * var(--ui-unit, 1rem)) rgba(0, 0, 0, .7);
  animation: rise-in 600ms 140ms var(--ease-out) backwards;
}
.title-cn__colon { color: #f4f6f5; }
/* a title in an alphabetic script (English …; screens/title.js): the display face, smaller so "Stronghold Protocol: Alliance" fits one line */
.title-cn--latin { font-family: var(--font-display); font-size: calc(0.6 * var(--utility-text, var(--t))); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.title-cn em { font-style: normal; color: var(--mint-500); text-shadow: 0 0 calc(0.26 * var(--ui-unit, 1rem)) rgba(23, 249, 183, .45); }
.title-tag {
  margin-top: calc(0.12 * var(--ui-unit, 1rem));
  font-size: calc(.19 * var(--utility-text, var(--t)));
  color: var(--text-lo);
  letter-spacing: .1em;
  animation: rise-in 600ms 200ms var(--ease-out) backwards;
}
@keyframes rise-in { from { opacity: 0; transform: translateY(calc(0.14 * var(--ui-unit, 1rem))); } }

.title-login {
  --bk-c: var(--mint-500);
  position: relative;
  width: calc(4.9 * var(--ui-unit, 1rem));
  margin-top: calc(0.42 * var(--ui-unit, 1rem));
  display: flex;
  flex-direction: column;
  gap: calc(0.16 * var(--ui-unit, 1rem));
  padding: calc(0.24 * var(--ui-unit, 1rem)) calc(0.28 * var(--ui-unit, 1rem)) calc(0.2 * var(--ui-unit, 1rem));
  background: linear-gradient(180deg, rgba(20, 25, 23, .82), rgba(10, 13, 12, .88));
  border: 1px solid var(--line-2);
  box-shadow: 0 calc(0.2 * var(--ui-unit, 1rem)) calc(0.5 * var(--ui-unit, 1rem)) rgba(0, 0, 0, .5), 0 0 calc(0.5 * var(--ui-unit, 1rem)) rgba(23, 249, 183, .06);
  -webkit-backdrop-filter: blur(calc(0.04 * var(--ui-unit, 1rem)));
  backdrop-filter: blur(calc(0.04 * var(--ui-unit, 1rem)));
  animation: rise-in 600ms 260ms var(--ease-out) backwards;
}
.title-login::before {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--mint-500), transparent 60%);
}
.title-login .btn--xl { letter-spacing: .6em; padding-left: calc(calc(0.48 * var(--ui-unit, 1rem)) + .3em); }
.title-invite {
  display: flex;
  align-items: center;
  gap: calc(0.08 * var(--ui-unit, 1rem));
  padding: calc(0.08 * var(--ui-unit, 1rem)) calc(0.12 * var(--ui-unit, 1rem));
  background: rgba(246, 163, 41, .08);
  border: 1px solid rgba(246, 163, 41, .35);
  color: var(--amber);
  font-size: calc(.16 * var(--utility-text, var(--t)));
}
.title-invite .icon { width: calc(0.2 * var(--ui-unit, 1rem)); height: calc(0.2 * var(--ui-unit, 1rem)); }
.title-invite b { font-size: calc(.2 * var(--utility-text, var(--t))); letter-spacing: .2em; color: #ffd08a; }
.title-conn { display: flex; align-items: center; justify-content: center; gap: calc(0.1 * var(--ui-unit, 1rem)); min-height: calc(0.32 * var(--ui-unit, 1rem)); font-size: calc(.14 * var(--utility-text, var(--t))); color: var(--text-lo); }
/* 统计 (the local stats page) beside the language menu in the top-right corner */
.title-corner__tools { display: flex; align-items: center; justify-content: flex-end; gap: calc(0.1 * var(--ui-unit, 1rem)); margin-bottom: calc(0.1 * var(--ui-unit, 1rem)); }
.title-corner__tools .title-lang { margin-bottom: 0; }
/* language menu (中文 | English | …, ui/lang.js) in the top-right corner; more than four languages make it a list.
   The height is max(design, 1.4em) so the buttons still hold their text at 设置 →「文字大小」 大 / 特大 (on a phone
   1rem is clamped at 40 px and .3rem is only 12 px, less than the enlarged label). */
.title-lang { display: inline-flex; margin-bottom: calc(0.1 * var(--ui-unit, 1rem)); }
.title-lang button { min-width: calc(0.74 * var(--ui-unit, 1rem)); height: max(calc(0.3 * var(--ui-unit, 1rem)), 1.4em); font-size: calc(.14 * var(--utility-text, var(--t))); cursor: pointer; }
.lang-select select { height: max(calc(0.38 * var(--ui-unit, 1rem)), 1.4em); min-width: calc(1.6 * var(--ui-unit, 1rem)); padding: 0 calc(0.12 * var(--ui-unit, 1rem)); background: #0a0d0c; border: 0; color: var(--text-hi); font-size: calc(.16 * var(--utility-text, var(--t))); cursor: pointer; }
.title-lang.lang-select select { height: max(calc(0.3 * var(--ui-unit, 1rem)), 1.4em); font-size: calc(.14 * var(--utility-text, var(--t))); }
html[data-script="alphabetic"] .title-login .btn--xl { letter-spacing: .3em; }
.title-conn .ping { height: max(calc(0.26 * var(--ui-unit, 1rem)), 1.6em); font-size: calc(.15 * var(--utility-text, var(--t))); }

.title-foot {
  position: absolute;
  z-index: 2;
  left: calc(0.44 * var(--ui-unit, 1rem));
  right: calc(0.44 * var(--ui-unit, 1rem));
  bottom: calc(0.3 * var(--ui-unit, 1rem));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(0.18 * var(--ui-unit, 1rem));
  font-size: calc(.13 * var(--utility-text, var(--t)));
  color: var(--text-dim);
}

.title-about-wrap { display: flex; justify-content: center; gap: calc(0.1 * var(--ui-unit, 1rem)); margin-top: calc(0.1 * var(--ui-unit, 1rem)); }
.title-about-button { flex: none; height: max(calc(0.4 * var(--ui-unit, 1rem)), calc(0.28 * var(--ui-unit, 1rem))); font-size: max(calc(.16 * var(--utility-text, var(--t))), calc(0.12 * var(--ui-unit, 1rem))); }
.modal__box.title-about {
  max-height: min(88vh, calc(100vh - var(--sa-t, 0px) - var(--sa-b, 0px) - calc(0.24 * var(--ui-unit, 1rem))));
  max-height: min(88dvh, calc(100dvh - var(--sa-t, 0px) - var(--sa-b, 0px) - calc(0.24 * var(--ui-unit, 1rem))));
  min-height: 0;
}
.title-about .modal__head { flex: none; }
.title-about .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.title-about .modal__title { font-size: max(calc(.26 * var(--utility-text, var(--t))), calc(0.18 * var(--ui-unit, 1rem))); }
.title-about .modal__actions .btn { min-width: calc(0.44 * var(--ui-unit, 1rem)); height: max(calc(0.48 * var(--ui-unit, 1rem)), calc(0.44 * var(--ui-unit, 1rem))); font-size: max(calc(.18 * var(--utility-text, var(--t))), calc(0.13 * var(--ui-unit, 1rem))); }
.title-about__links { display: flex; flex-direction: column; gap: calc(0.24 * var(--ui-unit, 1rem)); margin: 0; }
.title-about__links dt { margin-bottom: calc(0.08 * var(--ui-unit, 1rem)); font-size: max(calc(.16 * var(--utility-text, var(--t))), calc(0.13 * var(--ui-unit, 1rem))); color: var(--text-lo); }
.title-about__links dd { margin: 0; font-size: max(calc(.2 * var(--utility-text, var(--t))), calc(0.14 * var(--ui-unit, 1rem))); line-height: 1.7; }
.title-about__links a { color: var(--mint-400); overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: .15em; }
.title-about__links a:hover { color: var(--text-hi); }
.title-about__hint { margin: calc(0.06 * var(--ui-unit, 1rem)) 0 0; color: var(--text-lo); font-size: max(calc(.16 * var(--utility-text, var(--t))), calc(0.13 * var(--ui-unit, 1rem))); line-height: 1.6; }
.title-about__disclaimer { margin-top: calc(0.28 * var(--ui-unit, 1rem)); padding-top: calc(0.18 * var(--ui-unit, 1rem)); border-top: 1px solid var(--line); }
.title-about__disclaimer h3 { margin: 0 0 calc(0.08 * var(--ui-unit, 1rem)); color: var(--text-lo); font-size: max(calc(.16 * var(--utility-text, var(--t))), calc(0.13 * var(--ui-unit, 1rem))); font-weight: 700; }
.title-about__disclaimer p { margin: 0; color: var(--text-md); font-size: max(calc(.16 * var(--utility-text, var(--t))), calc(0.13 * var(--ui-unit, 1rem))); line-height: 1.7; }
.title-about__disclaimer p + p { margin-top: calc(0.14 * var(--ui-unit, 1rem)); }
.title-about__disclaimer a { color: var(--mint-400); overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: .15em; }
.title-about__disclaimer a:hover { color: var(--text-hi); }

/* ---- offline resource preload (docs/ASSETS.md「Preload」): the home screen's own way in ---------------- */
.title-preload { position: absolute; z-index: 3; right: calc(0.44 * var(--ui-unit, 1rem)); bottom: calc(0.86 * var(--ui-unit, 1rem)); }
.res-pill { width: calc(2.7 * var(--ui-unit, 1rem)); padding: calc(0.1 * var(--ui-unit, 1rem)) calc(0.12 * var(--ui-unit, 1rem)); background: rgba(10, 14, 12, .74); border: 1px solid var(--line-2); }
.res-pill.is-on { border-color: var(--mint-800); background: rgba(13, 20, 17, .86); }
.res-pill__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: calc(0.12 * var(--ui-unit, 1rem)); width: 100%;
  padding: 0; background: none; border: 0; color: var(--text-hi); font-size: calc(.15 * var(--utility-text, var(--t))); text-align: left; cursor: pointer;
}
.res-pill__head:disabled { cursor: default; }
.res-pill__label { display: flex; align-items: baseline; gap: calc(0.06 * var(--ui-unit, 1rem)); }
.res-pill.is-on .res-pill__label { color: var(--mint-400); }
.res-pill__label .micro { color: var(--text-dim); }
.res-pill__state { font-size: calc(.14 * var(--utility-text, var(--t))); color: var(--mint-400); white-space: nowrap; }
.res-pill__body { display: flex; flex-direction: column; gap: calc(0.07 * var(--ui-unit, 1rem)); margin-top: calc(0.09 * var(--ui-unit, 1rem)); }
.res-pill__body .pbar { min-width: 0; }
.res-pill__text { margin: 0; font-size: calc(.13 * var(--utility-text, var(--t))); line-height: 1.6; color: var(--text-md); }
.res-pill__text.is-dim { color: var(--text-dim); }
.res-pill__text.is-warn { color: var(--amber); }
.res-pill__hint { margin: calc(0.06 * var(--ui-unit, 1rem)) 0 0; font-size: calc(.13 * var(--utility-text, var(--t))); line-height: 1.6; color: var(--text-dim); }
.res-pill:hover .res-pill__hint { color: var(--text-md); }
/* a development build (shared/constants.js DEV_BUILD): an unmissable tag in the footer */
.title-dev {
  padding: calc(0.03 * var(--ui-unit, 1rem)) calc(0.1 * var(--ui-unit, 1rem));
  border: 1px solid #ff9f43;
  border-radius: calc(0.04 * var(--ui-unit, 1rem));
  color: #ffb066;
  background: rgba(255, 159, 67, .14);
  font-weight: 700;
  letter-spacing: .02em;
}
/* the server's plugins (DESIGN §32 P1a): 「本服务器安装了 N 个插件」, a button listing them (ui/pluginPanel.js InstalledPlugins) */
.title-plugins {
  display: inline-flex; align-items: center; gap: calc(0.06 * var(--ui-unit, 1rem)); padding: calc(0.03 * var(--ui-unit, 1rem)) calc(0.1 * var(--ui-unit, 1rem));
  border: 1px solid rgba(255, 159, 67, .5); color: #ffb066; background: rgba(255, 159, 67, .08); font-size: inherit;
}
.title-plugins .icon { width: calc(0.15 * var(--ui-unit, 1rem)); height: calc(0.15 * var(--ui-unit, 1rem)); }
