/* 晴空糖果：明亮可爱的游戏 UI；老板键伪装页保持办公风，见文件后半段 */
:root {
  --sky: #8fd4ff;
  --cream: #fff6e8;
  --ink: #3a2f45;
  --muted: #6d6278;
  --line: #f0d9bf;
  --coral: #ff6b57;
  --coral-ink: #fffaf4;
  --lemon: #ffd84d;
  --sky-btn: #5ec8ff;
  --hud: rgba(255, 246, 232, 0.92);
  --hud-ink: #3a2f45;
  --nitro: #4fd2ff;
  --nitro-2: #ffd84d;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #8fd4ff;
  color: var(--ink);
}

#game-root, #game-canvas {
  width: 100%;
  height: 100%;
}
.start-panel { text-align: center; }
.rules {
  list-style: none;
  text-align: left;
  margin: 10px 0 14px;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid #ffe2b8;
  border-radius: 16px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}
.rules li { margin: 6px 0; }
.rules strong { color: #ff6b57; }

.btn.sound-cta {
  background: var(--lemon);
  color: var(--ink);
  border-color: #f0c54a;
  box-shadow: 0 4px 0 #e0a82a;
  animation: sound-pulse 1.2s ease-in-out infinite;
}
.btn.sound-cta:hover { filter: brightness(1.05); }
.btn.sound-cta[aria-pressed="false"] {
  background: #fff;
  border-color: #ffe2b8;
  box-shadow: 0 3px 0 #f0c58a;
  animation: none;
}
@keyframes sound-pulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 4px 0 #e0a82a; }
  50% { transform: translateY(-2px); box-shadow: 0 6px 0 #e0a82a, 0 0 0 6px rgba(255, 216, 77, 0.35); }
}

#hud-standings {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 268px;
  background: var(--hud);
  border: 2px solid #ffe2b8;
  border-radius: 16px;
  padding: 8px 8px 6px;
  box-shadow: 0 4px 0 #f0c58a, 0 8px 18px rgba(58, 47, 69, 0.12);
}
.stand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.stand-row.me { background: rgba(255, 107, 87, 0.16); }
.stand-place {
  width: 18px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff;
}
.stand-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hud-item {
  position: absolute;
  left: 16px;
  bottom: 18px;
  background: var(--hud);
  border: 3px solid #ffd84d;
  border-radius: 18px;
  padding: 10px 12px 12px;
  width: 268px;
  color: var(--hud-ink);
  box-shadow: 0 5px 0 #e0a82a, 0 10px 20px rgba(58, 47, 69, 0.16);
  pointer-events: none;
  z-index: 4;
}
.item-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
}
.item-key { letter-spacing: 0; font-size: 11px; color: var(--ink); }
.item-slots {
  display: flex;
  gap: 6px;
}
.item-slot {
  flex: 1;
  height: 78px;
  border-radius: 14px;
  background: #fff;
  border: 2px dashed #f0d9bf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  min-width: 0;
}
.item-slot.next { box-shadow: inset 0 0 0 2px rgba(255, 107, 87, 0.35); }
.item-slot.filled {
  border-style: solid;
  border-color: #ffd84d;
  background: #fff3c4;
}
.item-slot.next.filled { border-color: #ff6b57; }
.item-slot.pop { animation: item-pop 0.45s ease; }
@keyframes item-pop {
  0% { transform: scale(0.86); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.item-empty { color: #c9b8a4; font-weight: 600; }
.item-icon { font-size: 26px; line-height: 1; }
.item-name { font-size: 11px; margin-top: 3px; color: var(--ink); }
#item-toast {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--hud);
  border: 3px solid #ffd84d;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 5px 0 #e0a82a, 0 12px 24px rgba(58, 47, 69, 0.16);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
#item-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#nameplates {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.nameplate {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -120%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 246, 232, 0.92);
  border: 2px solid #ffe2b8;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 0 #f0c58a;
}
.nameplate.me { border-color: #ff6b57; }

#hud-hint { bottom: 18px; max-width: calc(100vw - 560px); white-space: normal; text-align: center; }

#game-canvas { display: block; }

#hud {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
}

.hud-top {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
}

.hud-pill {
  background: var(--hud);
  color: var(--hud-ink);
  border: 2px solid #ffe2b8;
  border-radius: 999px;
  padding: 7px 14px 6px;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 4px 0 #f0c58a, 0 8px 18px rgba(58, 47, 69, 0.12);
}

.hud-pill .label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hud-pill .value {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
}

.hud-nitro {
  position: absolute;
  right: 16px;
  bottom: 18px;
  background: var(--hud);
  border: 2px solid #ffe2b8;
  border-radius: 18px;
  padding: 8px 12px 10px;
  width: 210px;
  color: var(--hud-ink);
  box-shadow: 0 4px 0 #f0c58a, 0 8px 18px rgba(58, 47, 69, 0.12);
}

.nitro-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.nitro-bars { display: flex; gap: 6px; }

.nitro-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(58, 47, 69, 0.08);
  overflow: hidden;
  border: 1px solid #ffe2b8;
}

.nitro-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--nitro), #7af0c8);
  border-radius: 999px;
}

.nitro-bar:nth-child(2) .nitro-fill {
  background: linear-gradient(90deg, var(--nitro-2), #ff9f4a);
}

#hud-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: var(--ink);
  background: var(--hud);
  border: 2px solid #ffe2b8;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.6s ease;
  box-shadow: 0 4px 0 #f0c58a;
}

#hud-hint.fade { opacity: 0; }

#countdown {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 108px;
  font-weight: 800;
  color: #ff6b57;
  letter-spacing: 0.04em;
  min-height: 1em;
  line-height: 1;
  text-shadow:
    0 0 0 #fff,
    4px 0 0 #fff,
    -4px 0 0 #fff,
    0 4px 0 #fff,
    0 -4px 0 #fff,
    5px 5px 0 #ffd84d,
    0 10px 18px rgba(58, 47, 69, 0.18);
}

#countdown.tone-2 { color: #ff9f4a; }
#countdown.tone-1 { color: #5ec8ff; }
#countdown.tone-go { color: #7ad16a; font-size: 92px; }

#start-screen, #pause-overlay, #result-screen {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(120, 190, 255, 0.22);
}

#start-screen { background: rgba(120, 190, 255, 0.12); }

.panel {
  background: var(--cream);
  color: var(--ink);
  width: min(460px, calc(100vw - 32px));
  border-radius: 24px;
  padding: 28px 28px 24px;
  box-shadow: 0 8px 0 #f0c58a, 0 18px 40px rgba(58, 47, 69, 0.18);
  text-align: center;
  border: 3px solid #ffe2b8;
}

.panel.start-panel {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 22px 22px 18px;
}

.panel.compact { padding: 22px 24px; }

.map-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 6px;
  text-align: left;
}

.map-card {
  appearance: none;
  border: 3px solid #ffe2b8;
  background: #fff;
  border-radius: 16px;
  padding: 8px 8px 10px;
  cursor: pointer;
  box-shadow: 0 3px 0 #f0c58a;
  font: inherit;
  color: inherit;
  text-align: left;
}

.map-card:hover { background: #fff8ee; }

.map-card.selected {
  border-color: #ff6b57;
  box-shadow: 0 3px 0 #e24e3c, 0 0 0 3px rgba(255, 107, 87, 0.22);
}

.map-preview { display: block; }
.map-preview svg {
  width: 100%;
  height: 72px;
  display: block;
  border-radius: 10px;
}

.map-name {
  display: block;
  font-weight: 800;
  font-size: 15px;
  margin-top: 7px;
  color: var(--ink);
}

.map-blurb {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.map-best {
  display: block;
  font-size: 11px;
  color: #ff6b57;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

#hud-track { min-width: 108px; }
#hud-track .value { font-size: 15px; }

@media (max-width: 640px) {
  .map-picker { grid-template-columns: 1fr; }
  .hud-top { flex-wrap: wrap; max-width: calc(100vw - 200px); }
}


.eyebrow, .fineprint {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fineprint {
  letter-spacing: 0;
  text-transform: none;
  margin-top: 14px;
}

h1 {
  font-size: 36px;
  margin: 6px 0 8px;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: #ff6b57;
}

h2 { font-size: 28px; margin: 4px 0 10px; color: #ff6b57; }

.tagline, .result-time, .result-best, .panel.compact p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.result-time { font-size: 16px; margin-bottom: 4px; }
.result-time strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.result-best { margin-bottom: 18px; font-variant-numeric: tabular-nums; }

.btn {
  appearance: none;
  border: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 18px;
  min-width: 148px;
  margin: 6px 4px 0;
}

.btn.primary {
  background: var(--coral);
  color: var(--coral-ink);
  box-shadow: 0 4px 0 #e24e3c;
}

.btn.primary:hover { filter: brightness(1.05); }

.btn.ghost {
  background: #fff;
  border-color: #ffe2b8;
  color: var(--ink);
  box-shadow: 0 3px 0 #f0c58a;
}

.btn.ghost:hover { background: #fff3d9; }

#boss-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: #f3f3f3;
  color: #222;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  isolation: isolate;
}

.boss-app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.boss-titlebar {
  height: 32px;
  background: #217346;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.boss-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
}

.boss-filename { margin-left: 8px; }

.boss-toolbar {
  height: 28px;
  background: #f3f3f3;
  border-bottom: 1px solid #d0d0d0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  font-size: 13px;
  color: #333;
}

.boss-formula {
  height: 28px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #d0d0d0;
  background: #fff;
  font-size: 12px;
}

.cell-name {
  width: 64px;
  text-align: center;
  border-right: 1px solid #d0d0d0;
  color: #555;
}

.formula-text { padding: 0 10px; color: #333; }

.boss-sheet {
  flex: 1;
  overflow: hidden;
  background: #fff;
}

.boss-sheet table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.boss-sheet th, .boss-sheet td {
  border: 1px solid #d0d0d0;
  padding: 5px 8px;
  white-space: nowrap;
  text-align: left;
}

.boss-sheet thead th {
  background: #f5f5f5;
  font-weight: 600;
  text-align: center;
  color: #555;
  position: sticky;
  top: 0;
}

.boss-sheet .row-head, .boss-sheet td.row-head {
  width: 28px;
  text-align: center;
  background: #f5f5f5;
  color: #777;
}

.boss-sheet tr.active td { background: #e2efda; }
.boss-sheet td.selected { outline: 2px solid #217346; outline-offset: -2px; background: #fff; }

.boss-status {
  height: 24px;
  background: #217346;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

[hidden] { display: none !important; }

#game-root[hidden],
#boss-screen[hidden],
#pause-overlay[hidden],
#start-screen[hidden],
#result-screen[hidden],
#hud[hidden] {
  display: none !important;
  pointer-events: none !important;
}

body.boss-on #game-root,
body.boss-on #pause-overlay,
body.boss-on #start-screen,
body.boss-on #result-screen,
body.boss-on #hud {
  display: none !important;
  pointer-events: none !important;
}

body.boss-on #boss-screen {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  background: #f3f3f3 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
