html, body, * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1326;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #cfd8ef;
  position: fixed;
  inset: 0;
  touch-action: manipulation;
}

canvas#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#veil {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: transparent;
  mix-blend-mode: multiply;
  opacity: 0;
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform-origin: center 70%;
  will-change: transform, opacity;
  transition: none;
}

.pg > * {
  pointer-events: auto;
}

.t {
  color: #cfd8ef;
  line-height: 1.35;
  font-weight: 500;
}
.t.sm { font-size: 11px; }
.t.xs { font-size: 9px; }
.t.lb { font-size: 13px; letter-spacing: 0.04em; }
.t.dim { color: #6a7699; opacity: 0.85; }
.t.tt {
  font-size: 38px;
  letter-spacing: 0.35em;
  font-weight: 300;
  color: #f5a142;
  text-indent: 0.35em;
}
.t.tt2 {
  font-size: 22px;
  letter-spacing: 0.25em;
  font-weight: 400;
  color: #f5a142;
}
.t.num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.t.rd-k {
  color: #6a7699;
  font-size: 10px;
  margin-right: 6px;
  letter-spacing: 0.15em;
}
.t.rd-v {
  color: #f5a142;
  font-size: 18px;
}
.t.rd-u {
  color: #6a7699;
  font-size: 10px;
  margin-left: 3px;
}
.t.dno {
  color: #f5a142;
  font-size: 26px;
  font-weight: 300;
}
.t.dtt {
  color: #cfd8ef;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
}

#pg-thread {
  position: relative;
}
#pg-thread .thread-foot {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

#pg-porch {
  position: relative;
}
#pg-porch .porch-head {
  position: absolute;
  top: 10%;
  left: 16px;
  text-align: left;
}
#pg-porch .porch-foot {
  position: absolute;
  bottom: 8%;
  left: 0;
  text-align: left;
}
#pg-porch .start-btn {
  width: 72px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#pg-porch .porch-nav {
  position: absolute;
  right: 12px;
  bottom: 14%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#pg-porch .prelook-btn {
  position: absolute;
  top: 14px;
  right: 14px;
}

#pg-run {
  position: relative;
}
#pg-run .hud-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#pg-run .hud-top-left .rd {
  display: flex;
  align-items: baseline;
}
#pg-run .pause-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
}
#pg-run #pad {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 132px;
  height: 132px;
  pointer-events: none;
}
#pg-run #pad .pad-disc {
  position: absolute;
  inset: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(106, 118, 153, 0.12);
  border: 1px solid rgba(106, 118, 153, 0.25);
  pointer-events: auto;
}
#pg-run #pad .pad-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(245, 161, 66, 0.08);
  border: 1px solid rgba(245, 161, 66, 0.3);
  color: #f5a142;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}
#pg-run #pad .pad-btn:active {
  transform: scale(0.92);
  background: rgba(245, 161, 66, 0.18);
}
#pg-run #pad .pad-btn.up {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}
#pg-run #pad .pad-btn.down {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
#pg-run #pad .pad-btn.left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
#pg-run #pad .pad-btn.right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.kbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-width: 44px;
  min-height: 44px;
  background: rgba(245, 161, 66, 0.06);
  border: 1px solid rgba(245, 161, 66, 0.35);
  color: #f5a142;
  cursor: pointer;
  border-radius: 3px;
  overflow: hidden;
  backdrop-filter: blur(2px);
}
.kbtn:hover {
  background: rgba(245, 161, 66, 0.12);
}
.kbtn:active {
  transform: scale(0.96);
}
.kbtn.sm {
  padding: 6px 10px;
  min-width: 36px;
  min-height: 36px;
}
.kbtn.xs {
  padding: 4px 8px;
  min-width: 28px;
  min-height: 28px;
}
.kbtn .t {
  color: inherit;
}
.kcor {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(245, 161, 66, 0.75);
}
.kcor.tl { top: 3px; left: 3px; border-right: none; border-bottom: none; }
.kcor.tr { top: 3px; right: 3px; border-left: none; border-bottom: none; }
.kcor.bl { bottom: 3px; left: 3px; border-right: none; border-top: none; }
.kcor.br { bottom: 3px; right: 3px; border-left: none; border-top: none; }

aside.side {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(82vw, 360px);
  pointer-events: none;
  transform: translateX(100%);
  will-change: transform;
  z-index: 30;
}

.side-cloth {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(13, 19, 38, 0.78) 6%,
    rgba(13, 19, 38, 0.94) 20%,
    rgba(13, 19, 38, 0.98) 100%);
  clip-path: polygon(
    0 0, 100% 0, 100% 100%, 0 100%,
    3% 98%, 1% 94%, 2% 88%, 0 82%,
    2% 76%, 1% 70%, 2% 64%, 0 58%,
    3% 52%, 1% 46%, 2% 40%, 0 34%,
    3% 28%, 1% 22%, 2% 16%, 0 10%, 2% 4%);
  backdrop-filter: blur(6px);
}

.side-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 58px 20px 30px 22px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.side-foot {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px dashed rgba(245, 161, 66, 0.18);
}

.drow {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}
.drow .dno-col {
  flex-shrink: 0;
  min-width: 36px;
}
.drow .dtext {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drow .dtext p {
  margin: 0;
}

.srow {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.srow .label {
  flex-shrink: 0;
}
.seg {
  display: inline-flex;
  gap: 6px;
}

.fog-ledger {
  max-height: 160px;
  overflow: auto;
  font-size: 11px;
}
.fog-ledger .fl-row {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fog-ledger .fl-row:nth-child(odd) {
  background: rgba(106, 118, 153, 0.08);
}
.fog-ledger .fl-row:nth-child(even) {
  background: rgba(106, 118, 153, 0.04);
}

.lost-vis {
  width: 200px;
  height: 100px;
  background: rgba(13, 19, 38, 0.9);
  border: 1px solid rgba(245, 161, 66, 0.2);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.lost-vis::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(45deg, transparent 48%, rgba(245, 161, 66, 0.4) 49%, rgba(245, 161, 66, 0.6) 50%, rgba(245, 161, 66, 0.4) 51%, transparent 52%),
    linear-gradient(-30deg, transparent 48%, rgba(245, 161, 66, 0.3) 49%, rgba(245, 161, 66, 0.5) 50%, rgba(245, 161, 66, 0.3) 51%, transparent 52%);
  background-size: 80px 80px, 60px 60px;
  animation: crackMove 3s linear infinite;
}
@keyframes crackMove {
  0% { background-position: 0 0, 20px 10px; }
  100% { background-position: 80px 80px, 80px 70px; }
}

.dawn-stats {
  margin-bottom: 18px;
}
.monu-rows {
  margin-bottom: 18px;
}
.bell-rows {
  margin-bottom: 18px;
}

.restore-btn {
  background: rgba(245, 161, 66, 0.18);
  border: 1px solid rgba(245, 161, 66, 0.55);
}
