/* ==========================================================================
   QUANZHOU DIGITAL TWIN — full-screen city cockpit
   ========================================================================== */
.twin {
  position: relative;
  height: 100svh;
  min-height: 760px;
  overflow: hidden;
  background:
    radial-gradient(55% 60% at 58% 46%, rgba(35, 105, 86, .22), transparent 70%),
    #030506;
  isolation: isolate;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
#twinStage { position: absolute; inset: 0; z-index: 0; }
#twinStage .twin-canvas { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; display: block; opacity: 0; transition: opacity 1.6s var(--ease); }
#twinStage.is-ready .twin-canvas { opacity: 1; }
.twin__grain {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .16;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.2) 3px 4px);
  mix-blend-mode: multiply;
}
.twin__vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(70% 70% at 50% 48%, transparent 38%, rgba(2,5,5,.62) 100%),
    linear-gradient(180deg, rgba(2,5,5,.62), transparent 20%, transparent 74%, rgba(2,5,5,.75));
}
.twin__frame {
  position: absolute; inset: 16px; z-index: 3; pointer-events: none;
  border: 1px solid rgba(185,255,207,.13);
  box-shadow: inset 0 0 80px rgba(0,0,0,.3);
}
.twin__frame::before, .twin__frame::after {
  content: ''; position: absolute; width: 74px; height: 12px; border-color: var(--at-mint); opacity: .55;
}
.twin__frame::before { left: -1px; top: -1px; border-left: 1px solid; border-top: 1px solid; }
.twin__frame::after { right: -1px; bottom: -1px; border-right: 1px solid; border-bottom: 1px solid; }
.twin__ui { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.twin__ui button, .twin__ui a, .twin__ui select { pointer-events: auto; }
.twin__top {
  position: absolute; left: 34px; right: 34px; top: 78px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
}
.twin__brandline { display: flex; align-items: center; gap: 10px; color: rgba(185,255,207,.7); font-family: var(--mono); font-size: 8px; letter-spacing: .16em; text-transform: uppercase; }
.twin__brandline i { width: 5px; height: 5px; border-radius: 50%; background: var(--at-mint); box-shadow: 0 0 10px var(--at-mint); }
.twin__title { margin: 18px 0 0; font-size: clamp(42px, 6.1vw, 92px); line-height: .9; letter-spacing: -.075em; font-weight: 560; color: #f3f6f4; }
.twin__title span { display: block; color: var(--at-mint); }
.twin__sub { margin: 15px 0 0; max-width: 43ch; color: rgba(243,246,244,.48); font-size: 12px; line-height: 1.75; }
.twin__status {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid rgba(185,255,207,.2); background: rgba(3,7,6,.6);
  color: rgba(185,255,207,.8); font-family: var(--mono); font-size: 8px; letter-spacing: .1em;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.twin__status i { width: 5px; height: 5px; border-radius: 50%; background: var(--at-mint); box-shadow: 0 0 8px var(--at-mint); animation: twinPulse 2s infinite; }
@keyframes twinPulse { 50% { opacity: .25; } }

.twin__panel {
  position: absolute; top: 360px; width: 252px; padding: 14px;
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(3,8,7,.62);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  pointer-events: auto;
}
.twin__panel--left { left: 34px; }
.twin__panel--right { right: 34px; width: 300px; }
.twin__panel h4 { margin: 0 0 13px; color: rgba(255,255,255,.35); font-family: var(--mono); font-size: 7px; font-weight: 400; letter-spacing: .15em; text-transform: uppercase; display: flex; justify-content: space-between; }
.twin__panel h4 span { color: rgba(185,255,207,.55); }
.twin__metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.09); }
.twin__metric { background: rgba(3,8,7,.8); padding: 11px 10px; }
.twin__metric b { display: block; font-family: var(--mono); font-size: 18px; font-weight: 400; color: #f3f6f4; letter-spacing: -.04em; }
.twin__metric b em { font-style: normal; color: var(--at-mint); font-size: .7em; }
.twin__metric span { display: block; margin-top: 5px; color: rgba(255,255,255,.3); font-family: var(--mono); font-size: 6px; letter-spacing: .1em; text-transform: uppercase; }
.twin__layers { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; }
.twin__layer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.025);
  color: rgba(255,255,255,.4); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; text-align: left;
  transition: .25s;
}
.twin__layer:hover { color: #fff; border-color: rgba(185,255,207,.28); }
.twin__layer.is-on { color: rgba(185,255,207,.9); border-color: rgba(185,255,207,.25); background: rgba(185,255,207,.06); }
.twin__layer i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }
.twin__alert { display: grid; grid-template-columns: 26px 1fr auto; gap: 9px; align-items: start; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.twin__alert:last-child { border: 0; }
.twin__alert .code { color: rgba(255,255,255,.28); font-family: var(--mono); font-size: 7px; }
.twin__alert b { display: block; color: rgba(243,246,244,.78); font-size: 10px; font-weight: 500; line-height: 1.4; }
.twin__alert span { display: block; margin-top: 4px; color: rgba(255,255,255,.3); font-family: var(--mono); font-size: 6px; letter-spacing: .05em; }
.twin__alert em { font-style: normal; color: #ff956b; font-family: var(--mono); font-size: 7px; }
.twin__alert em.ok { color: var(--at-mint); }
.twin__clock { color: rgba(255,255,255,.35); font-family: var(--mono); font-size: 8px; letter-spacing: .1em; }
.twin__clock b { color: rgba(255,255,255,.75); font-weight: 400; }

.twin__bottom {
  position: absolute; left: 34px; right: 34px; bottom: 28px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 22px;
  color: rgba(255,255,255,.28); font-family: var(--mono); font-size: 7px; letter-spacing: .1em; text-transform: uppercase;
}
.twin__legend { display: flex; flex-wrap: wrap; gap: 14px; }
.twin__legend span { display: flex; align-items: center; gap: 5px; }
.twin__legend i { width: 13px; height: 1px; background: currentColor; }
.twin__hint { color: rgba(185,255,207,.5); }
.twin__actions { display: flex; gap: 6px; }
.twin__action { padding: 8px 10px; border: 1px solid rgba(255,255,255,.13); color: rgba(255,255,255,.55); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; background: rgba(3,7,6,.5); transition: .25s; }
.twin__action:hover { border-color: var(--at-mint); color: var(--at-mint); }

.twin__selected {
  position: relative;
  margin-top: 12px;
  padding: 9px 11px;
  border-left: 1px solid rgba(185,255,207,.7);
  background: rgba(185,255,207,.045);
  display: flex; flex-direction: column; gap: 3px;
  opacity: .55; transition: opacity .3s ease;
}
.twin__selected.is-on { opacity: 1; }
.twin__selected em { font-style: normal; color: rgba(255,255,255,.3); font-family: var(--mono); font-size: 6px; letter-spacing: .12em; }
.twin__selected b { color: #f3f6f4; font-size: 13px; font-weight: 500; letter-spacing: -.02em; }
.twin__selected span { color: rgba(185,255,207,.55); font-family: var(--mono); font-size: 6px; letter-spacing: .08em; }

/* district / school HTML tags */
.twin-tag {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 7px; border-left: 1px solid rgba(255,255,255,.45);
  background: rgba(3,7,6,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: rgba(255,255,255,.6); font-family: var(--mono); font-size: 6px; letter-spacing: .08em; white-space: nowrap;
  transition: opacity .3s;
}
.twin-tag b { color: rgba(255,255,255,.85); font-weight: 400; }
.twin-tag.school { border-color: #7ee8ff; }
.twin-tag.hazard { border-color: #ff956b; color: #ffb499; }

@media (max-width: 1100px) {
  .twin__panel { width: 220px; top: 330px; }
  .twin__panel--right { width: 260px; }
  .twin__title { font-size: clamp(38px, 6vw, 68px); }
}
@media (max-width: 820px) {
  .twin { min-height: 720px; }
  .twin__top { left: 18px; right: 18px; top: 70px; }
  .twin__title { font-size: clamp(38px, 10vw, 58px); }
  .twin__sub { max-width: 34ch; font-size: 10px; }
  .twin__status { display: none; }
  .twin__panel { top: auto; bottom: 86px; width: calc(50% - 22px); padding: 10px; }
  .twin__panel--left { left: 18px; width: calc(100% - 36px); }
  .twin__panel--right { right: 18px; width: calc(50% - 22px); }
  .twin__panel h4 { font-size: 6px; margin-bottom: 8px; }
  .twin__metrics { grid-template-columns: 1fr 1fr; }
  .twin__metric { padding: 8px 7px; }
  .twin__metric b { font-size: 14px; }
  .twin__metric span { font-size: 5px; }
  .twin__selected { margin-top: 7px; padding: 6px 8px; }
  .twin__selected b { font-size: 11px; }
  .twin__layers { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
  .twin__layer { padding: 6px 7px; font-size: 6px; }
  .twin__panel--right .twin__alert:nth-child(n+3) { display: none; }
  .twin__bottom { left: 18px; right: 18px; bottom: 16px; }
  .twin__legend { display: none; }
  .twin__hint { display: none; }
  .twin__actions { margin-left: auto; }
}
@media (max-width: 560px) {
  .twin { min-height: 780px; }
  .twin__panel--right { display: none; }
  .twin__panel--left { width: calc(100% - 36px); bottom: 78px; }
  .twin__title { font-size: clamp(34px, 10.8vw, 48px); }
  .twin__sub { max-width: 28ch; }
  .twin__bottom { bottom: 12px; }
  .twin__actions .twin__action:first-child { display: none; }
}
