/* ═══════════════════════════════════════════════════════════════
   Academy desktop stage
   Perspective is drawn with a trapezoid mask instead of a CSS 3D
   transform, so icons and the taskbar keep stable hit coordinates.
   ═══════════════════════════════════════════════════════════════ */

#background-panel {
  position: absolute;
  left: -1.5vw;
  top: 7vh;
  width: 96vw;
  height: 79vh;
  overflow: hidden;
  z-index: 2;
  isolation: isolate;
  clip-path: polygon(0 0, 100% 11%, 98.5% 100%, 0 100%);
  background: #d8871e;
  border: 1px solid rgba(255, 231, 184, 0.32);
  box-shadow:
    0 18px 70px rgba(0, 0, 0, 0.38),
    0 0 60px rgba(240, 166, 52, 0.08);
}

#background-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(98, 45, 0, 0.12), transparent 28%, transparent 70%, rgba(7, 13, 25, 0.18)),
    linear-gradient(180deg, rgba(255, 239, 202, 0.1), transparent 22%, rgba(8, 14, 26, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 245, 220, 0.16);
}

#background-panel::after {
  content: 'MENTAL OUT  //  LEVEL 5  //  22005 19003';
  position: absolute;
  z-index: 4;
  right: 4.5vw;
  top: 13%;
  color: rgba(255, 249, 232, 0.62);
  font-family: 'PixelFont', 'Consolas', monospace;
  font-size: clamp(8px, 0.6vw, 11px);
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
  pointer-events: none;
}

#panel-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 48%;
  background-repeat: no-repeat;
  filter: saturate(0.88) contrast(1.02) brightness(0.92);
  transform: scale(1.015);
  transition: filter 1.4s ease, transform 1.4s ease;
}

body[data-time-phase="dawn"] #panel-wallpaper {
  filter: sepia(0.08) saturate(0.78) contrast(0.96) brightness(1.03);
}
body[data-time-phase="day"] #panel-wallpaper {
  filter: saturate(0.92) contrast(1.03) brightness(0.96);
}
body[data-time-phase="dusk"] #panel-wallpaper {
  filter: sepia(0.14) hue-rotate(-8deg) saturate(1.02) contrast(1.04) brightness(0.84);
}
body[data-time-phase="night"] #panel-wallpaper {
  filter: sepia(0.12) hue-rotate(158deg) saturate(0.58) contrast(1.1) brightness(0.48);
}

body[data-time-phase="dawn"] #background-panel::before {
  background:
    linear-gradient(112deg, rgba(255, 215, 184, 0.22), transparent 43%),
    linear-gradient(180deg, rgba(125, 206, 226, 0.08), transparent 54%);
}
body[data-time-phase="dusk"] #background-panel::before {
  background:
    linear-gradient(92deg, rgba(88, 35, 72, 0.17), transparent 34%, rgba(255, 164, 82, 0.08)),
    linear-gradient(180deg, rgba(24, 14, 42, 0.08), rgba(7, 12, 24, 0.18));
}
body[data-time-phase="night"] #background-panel::before {
  background:
    linear-gradient(90deg, rgba(2, 13, 35, 0.34), transparent 48%, rgba(3, 8, 18, 0.42)),
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(90, 182, 214, 0.025) 4px);
}

#panel-particles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.84;
  filter: saturate(1.04) drop-shadow(0 0 3px rgba(242, 198, 109, 0.18));
}

/* ─── P3R clock in the growing dark wedge above the panel ─── */
#time-hud {
  position: fixed;
  top: 1vh;
  left: clamp(390px, 43vw, 900px);
  z-index: 3;
  width: clamp(310px, 29vw, 560px);
  color: var(--shokuhou-white);
  pointer-events: none;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.55);
}

.hud-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  color: rgba(108, 217, 234, 0.8);
  font: 600 clamp(8px, 0.62vw, 11px)/1 'Consolas', monospace;
  letter-spacing: 0.18em;
}

.hud-signal {
  width: 22px;
  height: 2px;
  background: var(--p3r-cyan);
  box-shadow: 0 0 12px rgba(64, 200, 224, 0.7);
}

.hud-time-row {
  display: flex;
  align-items: baseline;
  height: clamp(52px, 6.4vh, 66px);
  font-family: 'PixelFont', 'Consolas', monospace;
  font-size: clamp(50px, 4.4vw, 78px);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.hud-colon {
  margin: 0 0.04em;
  color: var(--shokuhou-gold);
  animation: hud-colon-pulse 2s steps(1, end) infinite;
}

.hud-meta {
  position: absolute;
  left: clamp(220px, 13vw, 270px);
  top: 38px;
  display: grid;
  grid-template-columns: max-content 48px max-content;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  color: rgba(224, 232, 244, 0.72);
  font: 500 clamp(8px, 0.65vw, 11px)/1.4 'Consolas', monospace;
  letter-spacing: 0.12em;
}

.hud-meta-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--shokuhou-gold), transparent);
}

.hud-sector {
  grid-column: 1 / -1;
  color: rgba(240, 192, 96, 0.62);
  letter-spacing: 0.22em;
}

@keyframes hud-colon-pulse {
  50% { opacity: 0.35; }
}

/* ─── Reflective floor ─── */
#scene-floor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 17vh;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(18, 31, 52, 0.6), rgba(5, 10, 19, 0.98)),
    radial-gradient(ellipse at 75% 0%, rgba(240, 166, 52, 0.12), transparent 46%);
}

body[data-time-phase="dawn"] #scene-floor {
  background:
    linear-gradient(180deg, rgba(29, 42, 64, 0.62), rgba(6, 11, 20, 0.98)),
    radial-gradient(ellipse at 76% 0%, rgba(255, 178, 132, 0.18), transparent 48%);
}
body[data-time-phase="dusk"] #scene-floor {
  background:
    linear-gradient(180deg, rgba(28, 24, 52, 0.67), rgba(6, 9, 19, 0.99)),
    radial-gradient(ellipse at 76% 0%, rgba(221, 116, 109, 0.17), transparent 48%);
}
body[data-time-phase="night"] #scene-floor {
  background:
    linear-gradient(180deg, rgba(8, 21, 41, 0.78), rgba(1, 5, 12, 1)),
    radial-gradient(ellipse at 76% 0%, rgba(73, 137, 197, 0.14), transparent 50%);
}

.floor-horizon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 2%, rgba(240, 192, 96, 0.52) 28%, rgba(64, 200, 224, 0.3) 68%, transparent 96%);
  box-shadow: 0 0 20px rgba(240, 192, 96, 0.15);
}

.floor-grid {
  position: absolute;
  inset: 0;
  opacity: 0.09;
}

.floor-grid-a {
  background: repeating-linear-gradient(90deg, transparent 0 8vw, rgba(91, 150, 194, 0.5) 8vw calc(8vw + 1px));
  transform: perspective(220px) rotateX(58deg) scaleX(1.35);
  transform-origin: top center;
}

.floor-grid-b {
  background: repeating-linear-gradient(180deg, transparent 0 28px, rgba(91, 150, 194, 0.45) 28px 29px);
}

@media (max-width: 1100px) {
  #background-panel { width: 101vw; height: 80vh; }
  #time-hud { left: 31vw; width: 36vw; }
  .hud-meta { left: 205px; top: 36px; }
  .hud-sector { display: none; }
}

@media (max-width: 760px) {
  #background-panel {
    top: 10vh;
    width: 106vw;
    height: 76vh;
    clip-path: polygon(0 0, 100% 6%, 100% 100%, 0 100%);
  }
  #time-hud { left: 24px; top: 2vh; width: 270px; }
  .hud-time-row { font-size: 48px; height: 50px; }
  .hud-meta { position: static; margin: 5px 0 0 5px; font-size: 8px; }
  #scene-floor { height: 15vh; }
}
