* { box-sizing: border-box; }

:root {
  --bg: #070d1a;
  --bg-2: #0a1c35;
  --card: rgba(13, 25, 46, 0.72);
  --line: rgba(110, 183, 255, 0.26);
  --text: #e9f2ff;
  --muted: #9fb6d4;
  --accent: #3ea6ff;
  --accent-2: #34d8c8;
  --danger: #d94f63;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: radial-gradient(circle at 20% 20%, #10305f 0%, transparent 35%),
              radial-gradient(circle at 80% 0%, #123f55 0%, transparent 35%),
              linear-gradient(140deg, var(--bg), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
}

#twinCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  width: 240px;
  height: 240px;
  background: #34d8c8;
  left: 6%;
  top: 18%;
  animation: floatOrb 10s ease-in-out infinite;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: #3ea6ff;
  right: 4%;
  bottom: 8%;
  animation: floatOrb 12s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -20px, 0); }
}

header,
main {
  position: relative;
  z-index: 1;
}

header {
  padding: 24px 20px 14px;
  background: linear-gradient(120deg, rgba(11, 42, 84, 0.8), rgba(22, 67, 81, 0.75));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

header h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 1px;
}

header p {
  margin: 0;
  color: var(--muted);
}

main {
  padding: 20px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.login-card {
  max-width: 520px;
  margin: 32px auto 16px;
  transform-style: preserve-3d;
  transition: transform .2s ease;
}

.login-card h2 {
  margin-top: 0;
  font-size: 24px;
  text-shadow: 0 0 18px rgba(62, 166, 255, .35);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

input, select, textarea, button {
  border: 1px solid rgba(129, 170, 219, 0.45);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
}

input, select, textarea {
  background: rgba(6, 18, 37, 0.75);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: #88a6cb;
}

button {
  background: linear-gradient(120deg, #2d8ef0, #2bcdbf);
  color: #fff;
  cursor: pointer;
  border: none;
  font-weight: 600;
}

button:hover { filter: brightness(1.08); }
button.danger { background: linear-gradient(120deg, #d24e65, #b03e52); }
button.light {
  background: rgba(112, 168, 232, 0.2);
  color: #eaf5ff;
  border: 1px solid rgba(130, 187, 255, 0.35);
}
button:disabled { opacity: .6; cursor: not-allowed; }

.hidden { display: none; }
.hint { color: var(--muted); font-size: 13px; }

.demo-accounts {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.demo-line {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(19, 41, 75, 0.75);
  border: 1px solid rgba(102, 168, 244, 0.25);
}

.identity {
  background: rgba(9, 29, 58, 0.66);
  border: 1px solid rgba(115, 175, 240, 0.25);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab {
  background: rgba(80, 133, 197, 0.15);
  color: #d8ebff;
  border: 1px solid rgba(120, 180, 246, 0.2);
}
.tab.active {
  background: linear-gradient(120deg, #2d8ef0, #2bcdbf);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.metric {
  background: rgba(16, 38, 69, 0.72);
  border: 1px solid rgba(110, 183, 255, 0.25);
  border-radius: 10px;
  padding: 12px;
}

.metric b {
  display: block;
  font-size: 22px;
  margin-top: 6px;
  color: #8fd0ff;
}

.list { display: grid; gap: 8px; margin-top: 8px; }
.item {
  border: 1px solid rgba(110, 183, 255, 0.24);
  border-radius: 10px;
  padding: 10px;
  background: rgba(9, 27, 52, 0.72);
}
.item h4 { margin: 0 0 4px; }
.item p { margin: 4px 0; color: #cfe4ff; }

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(88, 154, 226, 0.2);
  border: 1px solid rgba(121, 183, 251, 0.25);
}

.avatar-tiny {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(83, 145, 219, 0.25);
  border: 1px solid rgba(121, 183, 251, 0.35);
  font-size: 12px;
  vertical-align: middle;
}

.avatar-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  margin-right: 6px;
  background: rgba(79, 139, 214, 0.22);
  border: 1px solid rgba(124, 183, 255, 0.3);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.avatar-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(121, 183, 251, 0.24);
  background: rgba(14, 35, 64, 0.76);
}

.avatar-card .avatar-face {
  font-size: 26px;
}

.avatar-card.selected {
  border-color: rgba(78, 215, 193, 0.7);
  box-shadow: 0 0 0 1px rgba(78, 215, 193, 0.25) inset;
}

.chat-hall {
  display: grid;
  gap: 10px;
}

.chat-list {
  max-height: 440px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(121, 183, 251, 0.22);
  background: rgba(8, 25, 48, 0.8);
}

.chat-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.chat-item.mine {
  justify-content: flex-end;
}

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 154, 226, 0.2);
  border: 1px solid rgba(121, 183, 251, 0.3);
}

.chat-bubble {
  max-width: min(680px, 80vw);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(116, 176, 243, 0.25);
  background: rgba(12, 33, 62, 0.75);
}

.chat-item.mine .chat-bubble {
  background: rgba(24, 73, 104, 0.72);
}

.chat-meta {
  font-size: 12px;
  color: #90b5dd;
  margin-bottom: 4px;
}

.chat-content {
  color: #e7f3ff;
  white-space: pre-wrap;
  word-break: break-word;
}

a { color: #8edbff; }

hr {
  border: none;
  border-top: 1px dashed rgba(138, 183, 232, 0.35);
  margin: 14px 0;
}

.news-box {
  margin-top: 14px;
  border: 1px solid rgba(117, 182, 255, 0.25);
  background: rgba(8, 26, 50, 0.7);
  border-radius: 10px;
  padding: 10px;
}

.news-box h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.news-list {
  display: grid;
  gap: 8px;
}

.news-item {
  border: 1px solid rgba(121, 188, 255, 0.2);
  background: rgba(12, 33, 61, 0.72);
  border-radius: 8px;
  padding: 8px;
}

.news-item h4 {
  margin: 0 0 4px;
}

.news-item p {
  margin: 0;
  color: #bfd9f8;
  font-size: 13px;
}

.news-item .meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #8db1db;
}

.compact .news-item h4 {
  font-size: 14px;
}

.compact .news-item p {
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.kv {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kv > label {
  color: #9fb6d4;
  min-width: 90px;
}

.log-list {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.log-line {
  border-left: 2px solid rgba(98, 178, 255, 0.38);
  padding-left: 8px;
  font-size: 12px;
  color: #cde2fa;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid rgba(128, 174, 224, 0.2);
  padding: 8px;
  text-align: left;
}

th {
  color: #8bb3df;
}

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-block;
}

.s-good {
  background: rgba(43, 197, 140, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #9ff2c8;
}

.s-warn {
  background: rgba(232, 181, 57, 0.18);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #ffe08a;
}

.s-bad {
  background: rgba(225, 79, 95, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #ffc6ce;
}

.map3d {
  border: 1px solid rgba(118, 183, 255, 0.24);
  border-radius: 12px;
  padding: 14px;
  background: rgba(5, 17, 34, 0.8);
}

.map-scene {
  position: relative;
  height: 420px;
  perspective: 900px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(120, 184, 255, 0.2);
  background: radial-gradient(circle at 50% 5%, rgba(61, 125, 215, 0.28), transparent 48%),
    linear-gradient(180deg, rgba(12, 30, 58, 0.75), rgba(7, 22, 44, 0.92));
}

.map-plane {
  position: absolute;
  width: 120%;
  height: 125%;
  left: -10%;
  bottom: -45%;
  transform: rotateX(66deg);
  transform-origin: center;
  background-image:
    linear-gradient(rgba(86, 157, 237, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 157, 237, 0.11) 1px, transparent 1px);
  background-size: 36px 36px;
}

.map-road,
.map-pipe {
  position: absolute;
  height: 8px;
  border-radius: 10px;
  transform-origin: left center;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.map-road { opacity: 0.95; }
.map-pipe {
  height: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.5);
}

.map-light,
.map-resident {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.map-light {
  box-shadow: 0 0 14px currentColor;
}

.map-resident {
  width: 12px;
  height: 12px;
  background: #8fddff;
  box-shadow: 0 0 10px rgba(143, 221, 255, 0.9);
}

.map-tip {
  position: absolute;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(6, 22, 44, 0.82);
  border: 1px solid rgba(119, 178, 248, 0.3);
  color: #d2e8ff;
  font-size: 11px;
  transform: translate(-50%, -120%);
  white-space: nowrap;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.tmap-box {
  width: 100%;
  min-height: 360px;
  border-radius: 10px;
  border: 1px solid rgba(117, 182, 255, 0.24);
  overflow: hidden;
  background: rgba(8, 23, 44, 0.7);
}

.site-footer {
  position: relative;
  z-index: 1;
  margin: 8px auto 20px;
  max-width: 1200px;
  padding: 12px 16px;
  color: #9cb8d8;
  font-size: 13px;
  border-top: 1px solid rgba(125, 184, 245, 0.25);
  display: grid;
  gap: 4px;
}

.site-footer a {
  color: #8edbff;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .login-card { margin-top: 18px; }
  header h1 { font-size: 22px; }
  .map-scene { height: 340px; }
  .tmap-box { min-height: 280px; }
}
