:root {
  --bg: #0f1718;
  --text: #edf2e7;
  --muted: rgba(232, 239, 227, 0.56);
  --soft: rgba(232, 239, 227, 0.38);
  --line: rgba(236, 244, 231, 0.09);
  --panel: rgba(10, 17, 18, 0.12);
  --panel-strong: rgba(10, 17, 18, 0.22);
  --panel-heavy: rgba(10, 17, 18, 0.38);
  --glow: rgba(240, 247, 232, 0.08);
  --accent: #b7c77a;
  --accent-strong: #8fa35b;
  --danger: #c36b59;
  --danger-strong: #db846d;
  --meter-bg: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top, rgba(156, 181, 145, 0.12), transparent 34%),
    linear-gradient(180deg, #1a2421 0%, #0f1718 100%);
  color: var(--text);
}

.world-view {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #111a1a;
}

.world-canvas-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 10%, rgba(240, 248, 232, 0.08), transparent 32%),
    linear-gradient(180deg, #dce7d2 0%, #94a978 100%);
}

.world-canvas-shell canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  transform: translate(-50%, -50%);
  filter: saturate(1.02) contrast(1.01);
}

.world-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(6, 11, 12, 0.08) 66%, rgba(4, 8, 9, 0.4) 100%),
    linear-gradient(180deg, rgba(8, 12, 14, 0.34) 0%, transparent 18%, transparent 80%, rgba(8, 12, 14, 0.28) 100%);
}

.hud-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.hud-block {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.hud-top-left {
  top: 12px;
  left: 12px;
  max-width: min(280px, 28vw);
}

.hud-left-bottom {
  left: 12px;
  bottom: 12px;
  width: min(300px, calc(100vw - 24px));
}

.hud-top-right {
  top: 12px;
  right: 12px;
  width: min(260px, 28vw);
  align-items: flex-end;
}

.hud-bottom-right {
  right: 12px;
  bottom: 12px;
  width: min(208px, calc(100vw - 24px));
  align-items: flex-end;
}

.hud-brand,
.hud-phase,
.hud-note,
.world-meta,
.stack-line,
.meter-group {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(10, 17, 18, 0.08) 100%);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}

.hud-brand,
.hud-phase,
.hud-note,
.world-meta {
  border-radius: 10px;
  padding: 8px 10px;
}

.stack-line,
.meter-group {
  border-radius: 9px;
  padding: 7px 9px;
}

.hud-kicker,
.hud-chip-label,
.stack-label,
.modal-tag {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hud-brand h1 {
  margin: 3px 0 0;
  font-size: clamp(16px, 1.55vw, 20px);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hud-phase-value {
  margin-top: 3px;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  line-height: 1;
}

.hud-phase-timer {
  margin-top: 2px;
  color: var(--text);
  font-size: 12px;
}

.stack-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.subtle-line {
  align-items: start;
}

.stack-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.stack-copy {
  color: var(--text);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}

.hud-left-bottom .stack-copy,
.hud-left-bottom #auxText {
  text-align: left;
}

.meter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meter-head,
.meta-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.meter-value {
  color: var(--text);
  font-size: 11px;
}

.meter {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--meter-bg);
}

.slim-meter {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.meter-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transition: width 120ms linear;
}

.hunger-fill {
  background: linear-gradient(90deg, #d6aa5c 0%, #a8b75b 52%, #6b8441 100%);
}

.aux-fill {
  background: linear-gradient(90deg, #b76050 0%, #d1a54f 54%, #d8de95 100%);
}

.skill-fill {
  background: linear-gradient(90deg, #7f95ad 0%, #9fb4c9 52%, #d7e3ea 100%);
}

.hud-note {
  width: 100%;
}

.world-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-line .stack-copy {
  max-width: 96px;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(9, 16, 17, 0.12), rgba(8, 12, 13, 0.34));
}

.overlay.visible {
  display: flex;
}

.entry-panel {
  width: min(560px, calc(100vw - 40px));
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(240, 247, 232, 0.14);
  background:
    linear-gradient(180deg, rgba(8, 13, 14, 0.38) 0%, rgba(8, 13, 14, 0.18) 100%);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.entry-head h2 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 3.3vw, 38px);
  line-height: 1.04;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

.entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.entry-button {
  width: 100%;
  min-height: 56px;
}

.entry-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.entry-foot-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.entry-link {
  color: rgba(239, 244, 235, 0.86);
  font-size: 12px;
  text-decoration: none;
  border-bottom: 1px solid rgba(239, 244, 235, 0.24);
}

.primary-button,
.secondary-button {
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}

.primary-button {
  border: 1px solid rgba(208, 221, 167, 0.26);
  background: linear-gradient(135deg, rgba(172, 193, 105, 0.9) 0%, rgba(127, 150, 76, 0.92) 100%);
  color: #f7f9f2;
}

.secondary-button {
  border: 1px solid rgba(242, 247, 237, 0.16);
  background: rgba(244, 248, 240, 0.08);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.error-text {
  margin: 0;
  min-height: 18px;
  color: var(--danger-strong);
  font-size: 13px;
  text-align: right;
}

body.in-world .overlay {
  background: transparent;
}

@media (max-width: 1100px) {
  .hud-top-left,
  .hud-top-right {
    max-width: min(250px, 38vw);
    width: min(250px, 38vw);
  }

  .hud-left-bottom {
    width: min(280px, 38vw);
  }
}

@media (max-width: 820px) {
  .hud-top-left,
  .hud-top-right,
  .hud-left-bottom,
  .hud-bottom-right {
    width: min(240px, calc(100vw - 20px));
  }

  .hud-top-left {
    top: 10px;
    left: 10px;
  }

  .hud-top-right {
    top: 10px;
    right: 10px;
  }

  .hud-left-bottom {
    left: 10px;
    bottom: 10px;
  }

  .hud-bottom-right {
    right: 10px;
    bottom: 10px;
  }

  .entry-actions {
    grid-template-columns: 1fr;
  }

  .entry-foot {
    align-items: start;
    flex-direction: column;
  }

  .error-text,
  .meta-line .stack-copy,
  .stack-copy {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .hud-top-right {
    top: auto;
    right: 10px;
    bottom: 132px;
  }

  .hud-bottom-right {
    bottom: 10px;
  }

  .hud-phase-value {
    font-size: 22px;
  }
}
