html,
body {
  background: #000;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: #e8e6e0;
  font-family: 'IBM Plex Mono', 'Consolas', 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
}

#stage {
  inset: 0;
  position: fixed;
}

#artCanvas {
  display: block;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

#overlay {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
}

/* ---- gallery title card (fades out after load) ---- */

#titleCard {
  animation: title-card-fade 9s ease forwards;
  left: 50%;
  pointer-events: none;
  position: fixed;
  text-align: center;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 40;
}

#titleCard h1 {
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: 0.55em;
  margin: 0 0 0.6em;
  text-indent: 0.55em;
}

#titleCard p {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  margin: 0;
  opacity: 0.65;
}

@keyframes title-card-fade {
  0% { opacity: 0; }
  18% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ---- HUD / control strip ---- */

#hud {
  background: rgba(6, 8, 12, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  bottom: 16px;
  font-size: 11px;
  left: 16px;
  letter-spacing: 0.04em;
  max-width: 340px;
  padding: 10px 12px;
  position: fixed;
  transition: opacity 0.6s ease;
  z-index: 60;
}

#hud.hidden {
  opacity: 0;
  pointer-events: none;
}

.hud-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.hud-row:last-child {
  margin-bottom: 0;
}

.hud-title {
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.92;
  text-transform: uppercase;
}

.hud-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #e8e6e0;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.08em;
  padding: 3px 9px;
}

.hud-btn:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

.hud-btn[data-active="true"] {
  background: #e8e6e0;
  border-color: #e8e6e0;
  color: #0a0c10;
}

.hud-tempo label {
  opacity: 0.6;
}

.hud-tempo input[type="range"] {
  accent-color: #e8e6e0;
  flex: 1;
  min-width: 90px;
}

.hud-status {
  opacity: 0.85;
}

.hud-status span {
  white-space: nowrap;
}

#hudStatus[data-state="live"] { color: #7fe8a2; }
#hudStatus[data-state="sim"] { color: #8fc7ff; }
#hudStatus[data-state="loading"] { color: #d8d8d8; }
#hudStatus[data-state="error"],
#hudStatus[data-state="warning"] { color: #ff8d7a; }

.hud-hint {
  font-size: 9.5px;
  opacity: 0.42;
}

#hudWarning {
  color: #ff8d7a;
  font-size: 10px;
  margin: 6px 0 0;
}

/* ---- scene 02: 산지.EXE — Win95 popups ---- */

.win {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  color: #000;
  font: 11px 'Courier New', monospace;
  max-width: 264px;
  min-width: 212px;
  pointer-events: auto;
  position: absolute;
  z-index: 10;
}

.win.dying {
  opacity: 0;
  transition: opacity 0.18s steps(3);
}

.win-title {
  align-items: center;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  display: flex;
  font-weight: bold;
  gap: 8px;
  justify-content: space-between;
  padding: 2px 4px;
  white-space: nowrap;
}

.win-title .win-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-close {
  background: #c0c0c0;
  border: 1px solid;
  border-color: #fff #404040 #404040 #fff;
  color: #000;
  cursor: pointer;
  flex: none;
  font: bold 9px 'Courier New', monospace;
  height: 14px;
  line-height: 11px;
  padding: 0;
  text-align: center;
  width: 16px;
}

.win-body {
  line-height: 1.45;
  padding: 7px 9px 8px;
}

.win-body .win-place {
  font-weight: bold;
}

.win-body .win-meta {
  color: #3a3a3a;
  font-size: 10px;
  margin-top: 3px;
}

.win-ok {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  cursor: pointer;
  display: block;
  font: 11px 'Courier New', monospace;
  margin: 7px auto 3px;
  padding: 1px 18px;
}

.win-ok:active {
  border-color: #404040 #fff #fff #404040;
}

.taskbar {
  align-items: center;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  bottom: 0;
  box-shadow: 0 -1px 0 #808080;
  color: #000;
  display: flex;
  font: bold 11px 'Courier New', monospace;
  gap: 8px;
  height: 30px;
  left: 0;
  padding: 0 6px;
  pointer-events: none;
  position: absolute;
  right: 0;
  z-index: 12;
}

.task-start {
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  padding: 2px 10px;
}

.task-counter {
  font-weight: normal;
  opacity: 0.85;
}

.task-clock {
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
  font-weight: normal;
  margin-left: auto;
  padding: 2px 10px;
}

/* ---- scene 05: 산지.LIVE — glassmorphism chat cards ---- */

.chat-card,
.chat-typing {
  backdrop-filter: blur(18px) saturate(1.45);
  -webkit-backdrop-filter: blur(18px) saturate(1.45);
  background: rgba(255, 255, 255, 0.085);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #f2f4f8;
  font-family: 'Inter', 'Pretendard', 'Segoe UI', 'Malgun Gothic', sans-serif;
  pointer-events: auto;
  position: absolute;
  z-index: 10;
}

.chat-card {
  font-size: 13px;
  max-width: 280px;
  min-width: 224px;
  opacity: 0;
  padding: 12px 15px 11px;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chat-card.visible {
  opacity: 1;
  transform: none;
}

.chat-card.leaving {
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.chat-head {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-avatar {
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
  flex: none;
  height: 9px;
  width: 9px;
}

.chat-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-time {
  font-size: 10.5px;
  margin-left: auto;
  opacity: 0.55;
}

.chat-msg {
  line-height: 1.5;
  opacity: 0.95;
}

.chat-meta {
  font-size: 10.5px;
  margin-top: 7px;
  opacity: 0.48;
}

.chat-typing {
  display: flex;
  gap: 4px;
  opacity: 0;
  padding: 11px 14px;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-typing.visible {
  opacity: 1;
  transform: none;
}

.chat-typing-dot {
  animation: chat-typing-bounce 1s infinite;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  height: 5px;
  width: 5px;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing-bounce {
  0%, 60%, 100% { opacity: 0.45; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---- scene 07: 만남 MEET — light-mode 3D speech bubbles ---- */

.meet-bubble {
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(28, 30, 38, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(28, 30, 38, 0.14);
  font-family: 'Inter', 'Pretendard', 'Segoe UI', 'Malgun Gothic', sans-serif;
  font-size: 12px;
  max-width: 212px;
  min-width: 176px;
  opacity: 0;
  padding: 9px 11px 10px;
  pointer-events: auto;
  position: absolute;
  transform: translate(-50%, -100%) scale(0.5);
  transform-origin: 50% 100%;
  transition: opacity 0.25s ease;
}

.meet-bubble::after {
  border: 7px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.78);
  bottom: -14px;
  content: '';
  left: 50%;
  margin-left: -7px;
  position: absolute;
}

.meet-bubble.visible {
  opacity: 1;
  transform: translate(-50%, -100%) scale(var(--bubble-scale, 1));
}

.meet-bubble.leaving {
  opacity: 0;
  transform: translate(-50%, -100%) scale(0.4);
  transition: opacity 0.28s ease;
}

.meet-head {
  align-items: center;
  color: #1c1e26;
  display: flex;
  font-size: 11.5px;
  font-weight: 700;
  gap: 6px;
}

.meet-node-dot {
  background: var(--node-color, currentColor);
  box-shadow: 0 0 10px color-mix(in srgb, var(--node-color, currentColor) 55%, transparent);
  border-radius: 50%;
  flex: none;
  height: 8px;
  width: 8px;
}

.meet-head .meet-place {
  color: #1c1e26;
}

.meet-time {
  color: #8a8d99;
  font-size: 10px;
  font-weight: 400;
  margin-left: auto;
}

.meet-msg {
  color: #23252e;
  line-height: 1.45;
  margin: 5px 0 7px;
}

.meet-ph {
  border: 1.5px solid #1c1e26;
  height: 54px;
  overflow: hidden;
  position: relative;
  transition: background-color 0.4s ease, height 0.4s ease;
  width: 100%;
}

.meet-ph svg {
  display: block;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.meet-ph svg line {
  stroke: #1c1e26;
  stroke-width: 1;
}

.meet-meta {
  color: #8a8d99;
  font-size: 9.5px;
  margin-top: 6px;
}

.meet-typing {
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(28, 30, 38, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(28, 30, 38, 0.14);
  display: flex;
  gap: 4px;
  opacity: 0;
  padding: 9px 12px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, -100%);
  transition: opacity 0.2s ease;
}

.meet-typing.visible {
  opacity: 1;
}

.meet-typing .meet-typing-dot {
  animation: chat-typing-bounce 1s infinite;
  background: var(--node-color, currentColor);
  box-shadow: 0 0 10px color-mix(in srgb, var(--node-color, currentColor) 55%, transparent);
  border-radius: 50%;
  height: 5px;
  width: 5px;
}

.meet-typing .meet-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.meet-typing .meet-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@media (max-width: 720px) {
  #titleCard h1 {
    font-size: 1.3rem;
  }

  #hud {
    bottom: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
  }
}
