:root {
  --bg: #0d0a12;
  --panel: #1a1424;
  --card: #241c32;
  --pink: #ff6b9d;
  --purple: #b388ff;
  --gold: #ffd54f;
  --text: #f0e6f6;
  --dim: #9a8aaa;
  --danger: #ff5252;
  --ok: #69f0ae;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

/* 关键：html/body背景铺满全屏，内容居中不拉伸 */
html, body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); 
  color: var(--text);
  width: 100vw;
  min-height: 100dvh;
  overflow-x: hidden;
}
#app {
  width: 100%;
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* 屏幕容器：背景占满，内部内容限制最大宽度居中 */
.screen { 
  width: 100%;
  min-height: 100dvh; 
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* 内容统一最大宽度，保证UI不变形 */
.content-wrap {
  width: 100%;
  max-width: 560px;
}

.panel {
  background: var(--panel); 
  border-radius: 16px; 
  padding: 20px;
  border: 1px solid #3a2a4a; 
  width: 100%;
  max-width: 480px;
}
.intro-panel { text-align: center; margin-top: 8vh; }

.guard-avatar {
  width: 112px; height: 112px; margin: 0 auto 12px;
  background: var(--card); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--pink); overflow: hidden;
}
.guard-avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.guard-avatar-fallback {
  font-size: 4rem; width: 100%; height: 100%;
  display: flex;
  align-items: center; justify-content: center;
}
h1 {
  font-size: 1.6rem; background: linear-gradient(90deg, var(--pink), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { color: var(--dim); font-size: 0.85rem; margin: 6px 0 16px; }
.intro-text {
  text-align: left; line-height: 1.7; font-size: 0.95rem;
  background: var(--card); padding: 14px; border-radius: 12px;
  min-height: 120px; margin-bottom: 16px; white-space: pre-wrap;
}
.intro-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hard-toggle {
  display: block; margin-top: 16px; font-size: 0.8rem; color: var(--dim); cursor: pointer;
}
.btn {
  background: linear-gradient(135deg, var(--pink), #c44dff);
  color: #fff; border: none; border-radius: 12px;
  padding: 12px 24px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost {
  background: transparent; border: 1px solid var(--purple); color: var(--purple);
}
.btn-icon {
  background: var(--card); border: 1px solid #3a2a4a; border-radius: 10px;
  width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; color: var(--text);
}
.btn-dice {
  width: 100%; max-width: 320px; padding: 16px; font-size: 1.15rem;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; max-width: 560px; margin: 0 auto 12px; gap: 8px;
}
.pos { font-weight: 700; color: var(--gold); }
.status-badges { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 0.7rem; padding: 3px 8px; border-radius: 999px;
  background: #3a2030; color: var(--pink); border: 1px solid var(--pink);
}
.board-wrap {
  width: 100%; max-width: 560px; margin: 0 auto 12px;
  overflow-x: auto; padding-bottom: 6px;
}
.board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  width: 100%;
}
.cell {
  aspect-ratio: 1; border-radius: 8px; background: var(--card);
  border: 1px solid #3a2a4a; font-size: 0.65rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; color: var(--dim);
}
.cell .n { font-weight: 700; color: var(--text); font-size: 0.75rem; }
.cell.start { border-color: var(--ok); }
.cell.goal { border-color: var(--gold); background: #3a3020; }
.cell.joi { border-color: var(--pink); }
.cell.ripen { border-color: var(--purple); }
.cell.rest { border-color: #4caf50; }
.cell.curse { border-color: var(--danger); }
.cell.here {
  box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(255,213,79,0.5);
  transform: scale(1.05); z-index: 1;
}
.cell.passed { opacity: 0.55; }
.cell-preview {
  width: 100%; max-width: 560px; margin: 0 auto 10px;
  display: flex; gap: 12px; align-items: center;
  background: var(--panel); border-radius: 14px; padding: 10px 12px;
  border: 1px solid #3a2a4a;
}
.cell-img-wrap {
  width: 72px; height: 72px; border-radius: 12px; overflow: hidden;
  background: var(--card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cell-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.cell-emoji { font-size: 2rem; }
.cell-type { font-size: 0.75rem; color: var(--pink); }
.cell-name { font-weight: 600; font-size: 0.95rem; }
.log {
  width: 100%; max-width: 560px; margin: 0 auto 12px; max-height: 80px; overflow-y: auto;
  font-size: 0.8rem; color: var(--dim); line-height: 1.5;
}
.log div { margin-bottom: 4px; }
.bottombar {
  width: 100%; max-width: 560px; margin: 0 auto; text-align: center; padding-bottom: 20px;
}
.dice-result {
  margin-top: 10px; font-size: 1.4rem; font-weight: 700; color: var(--gold);
}
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.82);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100; padding: 16px;
  width: 100vw;
  height: 100dvh;
}
.modal-box {
  background: var(--panel); border-radius: 20px 20px 16px 16px;
  padding: 12px 14px 16px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
  border: 1px solid #4a3a5a; text-align: center;
}
.modal-img-wrap {
  width: min(100%, 260px);
  max-height: min(36vh, 300px);
  height: auto;
  margin: 0 auto 8px;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.modal-img-wrap img {
  max-width: 100%;
  max-height: min(36vh, 300px);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
  display: block;
  vertical-align: top;
}
.task-emoji { font-size: 4rem; }
.flavor {
  text-align: left; line-height: 1.55; font-size: 0.9rem;
  background: var(--card); padding: 8px 10px; border-radius: 10px;
  margin: 6px 0 8px; white-space: pre-wrap; color: #e8d4e8;
}
#task-body { margin-bottom: 8px; }
.modal-box h2 { margin-bottom: 6px; font-size: 1.05rem; }
.metro-wrap { margin: 6px 0; }
.metro-circle {
  width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8fb8, #c44dff);
  transition: transform 0.05s;
}
.metro-circle.beat { transform: scale(1.18); box-shadow: 0 0 20px rgba(255,107,157,0.6); }
.metro-bpm { color: var(--dim); font-size: 0.85rem; }
.task-count { font-size: 1.1rem; margin: 8px 0; }
.task-count strong { color: var(--gold); font-size: 1.3rem; }
.btn-tick {
  background: var(--card); border: 1px solid var(--pink); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 1rem; cursor: pointer; margin: 8px 0;
}
.countdown {
  font-size: 2.5rem; font-weight: 700; color: var(--pink); margin: 12px 0;
}
.ripen-timer { font-size: 1.8rem; color: var(--purple); margin: 12px 0; }
@media (min-width: 600px) {
  .modal { align-items: center; }
}
.btn-danger {
  background: linear-gradient(135deg, #ff5252, #c62828);
  margin-top: 10px;
}
.task-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; margin-top: 4px; }
.bgm-row { margin-top: 12px; font-size: 0.8rem; color: var(--dim); }
.bgm-row input[type=range] { vertical-align: middle; width: 120px; accent-color: var(--pink); }
.climax-box { text-align: center; }
.climax-media {
  width: 100%; max-height: 55vh; margin: 0 auto 12px;
  border-radius: 14px; overflow: hidden; background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.climax-media video, .climax-media img {
  max-width: 100%; max-height: 55vh; width: auto; height: auto;
  object-fit: contain; object-position: center; display: block;
}
.climax-steps { text-align: left; font-size: 0.9rem; color: var(--dim); margin-bottom: 12px; line-height: 1.6; }
