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

:root {
  --gold: #ffd478;
  --gold-deep: #d6a84a;
  --vermilion: #e0553f;
  --sky-ink: #45509b;
  --cloud-a: #f8f6ff;
  --cloud-b: #dfe0fa;
  --desk-wood: linear-gradient(135deg, #a3543a, #7c3524);
  --text: #fff;
  --ink: #4a4370;
}

html, body { height: 100%; }

body {
  background:
    radial-gradient(ellipse at 18% 8%, rgba(255,240,200,.22) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 20%, rgba(255,190,220,.14) 0%, transparent 40%),
    linear-gradient(180deg, #454f9b 0%, #7b84cc 35%, #b3a6e3 65%, #ecd9ef 100%);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 天界に漂う雲 */
.sky-cloud {
  position: fixed;
  height: 60px; width: 200px;
  background: rgba(255,255,255,.55);
  border-radius: 60px;
  filter: blur(14px);
  z-index: 0;
  pointer-events: none;
  animation: drift 70s linear infinite;
}
.sky-cloud.c1 { top: 16%; left: -220px; }
.sky-cloud.c2 { top: 34%; left: -220px; width: 260px; animation-delay: -35s; opacity: .7; }
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100vw + 480px)); }
}

/* ============ HUD（社名看板・時計・神棚） ============ */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px 6px;
  gap: 16px;
  z-index: 10;
}

.neon-sign {
  text-align: center;
  font-size: 26px;
  letter-spacing: 3px;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 0 6px var(--gold), 0 0 18px var(--gold), 0 2px 24px rgba(214,168,74,.8);
}
.neon-sign em {
  font-style: normal;
  font-size: 34px;
  color: #eafcff;
  text-shadow: 0 0 8px #35e0ff, 0 0 26px #35a0ff, 0 0 52px #2563eb;
}
.flicker { animation: flicker 5s infinite; }
@keyframes flicker {
  0%, 93%, 97%, 100% { opacity: 1; }
  94%, 96% { opacity: .55; }
}

/* 神棚（主神） */
.shrine { position: relative; text-align: center; width: 110px; }
.shrine-gate { font-size: 46px; position: relative; z-index: 2; animation: hover-god 5s ease-in-out infinite; display: inline-block; }
@keyframes hover-god { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.shrine-aura {
  position: absolute; left: 50%; top: 50%;
  width: 90px; height: 90px; transform: translate(-50%, -55%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,225,140,.6), rgba(255,225,140,0) 70%);
  animation: aura 3s ease-in-out infinite;
}
@keyframes aura { 0%,100% { opacity: .6; transform: translate(-50%,-55%) scale(1); } 50% { opacity: 1; transform: translate(-50%,-55%) scale(1.25); } }
.shrine-label { font-size: 12px; color: #fff1c4; letter-spacing: 6px; margin-top: -4px; text-shadow: 0 0 8px rgba(255,215,120,.8); }

.hud-right { text-align: right; width: auto; min-width: 110px; flex: none; }
.clock {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  color: #fff1c4;
  text-shadow: 0 0 10px rgba(255,212,120,.9);
}
.open-badge {
  margin-top: 4px;
  font-size: 11px;
  color: #fff1c4;
  border: 1px solid rgba(255,212,120,.7);
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-block;
  white-space: nowrap;
  animation: flicker 4.2s infinite;
}

/* ============ 天界オフィス（3D） ============ */
.stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; z-index: 1; }
.stage { width: 980px; height: 640px; flex: none; }

.scene {
  width: 100%; height: 100%;
  perspective: 1500px;
  display: flex; align-items: center; justify-content: center;
}

/* 雲の大地 */
.floor {
  position: relative;
  width: 820px; height: 760px;
  transform: rotateX(58deg) rotateZ(45deg);
  transform-style: preserve-3d;
  background:
    repeating-linear-gradient(0deg, transparent 0 78px, rgba(214,168,74,.22) 78px 80px),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(214,168,74,.22) 78px 80px),
    linear-gradient(135deg, var(--cloud-a), var(--cloud-b));
  border-radius: 70px;
  box-shadow:
    0 0 0 10px rgba(255,255,255,.55),
    0 0 60px 30px rgba(255,255,255,.5),
    0 60px 140px rgba(80,70,150,.45);
}

.wall { display: none; }

/* ---- ワークステーション ---- */
.station {
  position: absolute;
  left: var(--x); top: var(--y);
  width: 0; height: 0;
  transform-style: preserve-3d;
}

.station .shadow {
  position: absolute; left: -58px; top: -36px;
  width: 116px; height: 76px;
  background: radial-gradient(ellipse, rgba(90,80,160,.28), transparent 70%);
  border-radius: 50%;
}

.desk-top {
  position: absolute; left: -55px; top: -34px;
  width: 110px; height: 62px;
  background: var(--desk-wood);
  border-radius: 8px;
  transform: translateZ(30px);
  box-shadow: 0 0 0 2px rgba(60,20,10,.35) inset, 0 14px 12px rgba(90,70,150,.35);
}

/* 上向き（カメラ向き）に立てる共通スプライト */
.sprite {
  position: absolute;
  transform-style: preserve-3d;
  text-align: center;
}
.sprite > .up {
  display: inline-block;
  transform: rotateZ(-45deg) rotateX(-58deg);
  transform-origin: center bottom;
}

.monitor { left: -2px; top: -30px; transform: translateZ(30px); }
.monitor .screen {
  width: 40px; height: 26px;
  background: #2a2450;
  border: 2px solid #8b7bc4;
  border-radius: 4px;
  position: relative;
  display: inline-block;
}
.monitor .screen::after {
  content: ""; position: absolute; left: 50%; bottom: -8px;
  width: 12px; height: 8px; background: #8b7bc4; transform: translateX(-50%);
}

.char { left: -42px; top: -44px; transform: translateZ(0px); }
.station.pm .char { left: -21px; top: 0; }

/* ---- ちび神様キャラ（CSS製） ---- */
.robo {
  position: relative;
  display: inline-block;
  width: 46px; height: 58px;
  filter: drop-shadow(0 5px 5px rgba(80,60,140,.4));
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* 天使の輪 */
.robo .halo {
  position: absolute; top: -19px; left: 50%;
  transform: translateX(-50%);
  width: 30px; height: 10px;
  border: 3px solid #ffd35e;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,211,94,.95), inset 0 0 4px rgba(255,240,180,.8);
}
/* お顔 */
.robo .head {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 42px; height: 34px;
  border-radius: 15px 15px 13px 13px;
  background: linear-gradient(160deg, rgba(255,255,255,.5) 0%, rgba(255,255,255,0) 45%), #ffe4c9;
  box-shadow: inset -4px -5px 8px rgba(190,120,80,.28);
}
/* 髪（神ごとに色が違う） */
.robo .hair {
  position: absolute; top: -3px; left: -2px; right: -2px;
  height: 15px;
  background: linear-gradient(160deg, rgba(255,255,255,.4) 0%, rgba(255,255,255,0) 50%), var(--c);
  filter: saturate(1.15);
  border-radius: 16px 16px 10px 10px;
}
.robo .hair::after {
  content: "";
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--c);
  filter: saturate(1.15) brightness(.96);
}
.robo .eye {
  position: absolute; top: 15px;
  width: 8px; height: 10px; border-radius: 50%;
  background: #3a2c50;
  animation: blink 4.6s infinite;
}
.robo .eye::after {
  content: ""; position: absolute; top: 1.5px; left: 1.5px;
  width: 3px; height: 3px; border-radius: 50%; background: #fff;
}
.robo .eye.l { left: 8px; }
.robo .eye.r { right: 8px; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.1); } }
.robo .cheek {
  position: absolute; bottom: 6px;
  width: 7px; height: 4px; border-radius: 50%;
  background: #ff9fb0; opacity: .8;
}
.robo .cheek.l { left: 4px; }
.robo .cheek.r { right: 4px; }
.robo .mouth {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 4.5px;
  border-radius: 0 0 9px 9px;
  background: #3a2c50;
}
/* 着物のお体 */
.robo .body {
  position: absolute; top: 33px; left: 50%; transform: translateX(-50%);
  width: 32px; height: 21px; border-radius: 10px 10px 12px 12px;
  background: linear-gradient(160deg, rgba(255,255,255,.35) 0%, rgba(255,255,255,0) 55%), var(--c);
  box-shadow: inset -3px -4px 6px rgba(60,40,120,.28);
}
.robo .body::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 14px; height: 9px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: .95;
}
/* 帯 */
.robo .belly {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 5px; border-radius: 3px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 4px rgba(255,212,120,.7);
}
.robo .arm {
  position: absolute; top: -2px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c); filter: brightness(.97);
}
.robo .arm.l { left: -6px; }
.robo .arm.r { right: -6px; }
/* 足元の雲 */
.robo .cloudpuff {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  width: 32px; height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: -13px 2px 0 -3px #fff, 13px 2px 0 -3px #fff, 0 0 12px rgba(255,255,255,.95);
  opacity: .95;
}
.robo .badge {
  position: absolute; top: -18px; right: -14px;
  font-size: 17px; font-style: normal;
  transform: rotate(14deg);
  filter: drop-shadow(0 2px 2px rgba(80,60,140,.4));
}

.plate { left: -60px; top: 64px; width: 120px; }
.plate .up span {
  font-size: 12px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(214,168,74,.7);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  color: var(--ink);
  font-weight: bold;
}

.bubble { left: -90px; top: -70px; width: 180px; transform: translateZ(56px); opacity: 0; transition: opacity .4s; }
.bubble .up span {
  font-size: 11.5px; font-weight: bold;
  background: #fff; color: #4a3560;
  border-radius: 10px; padding: 4px 10px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(80,60,140,.4);
}
.station.mutter .bubble { opacity: 1; }

/* 経理神の吹き出しはレビュアー神と被らないよう左に逃がす */
#st-keiri .bubble { left: -230px; top: -10px; }

/* ---- 御神業中（稼働中）の神 ---- */
.station.active .robo { animation: work-bob 1s ease-in-out infinite; }
@keyframes work-bob {
  0%,100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-3px) rotate(1.5deg); }
}
.station.active .robo .arm.l { animation: type .32s ease-in-out infinite; }
.station.active .robo .arm.r { animation: type .32s ease-in-out infinite .16s; }
@keyframes type { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.station.active .robo .halo { animation: halo-pulse .7s infinite; }
@keyframes halo-pulse {
  0%,100% { border-color: #ffd35e; box-shadow: 0 0 8px rgba(255,211,94,.95); }
  50% { border-color: #fff3b0; box-shadow: 0 0 20px #ffe9a0, 0 0 34px rgba(255,211,94,.7); }
}
.station.active .monitor .screen {
  background: #4a3f8a;
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255,212,120,.95), 0 0 30px rgba(255,212,120,.45);
}
.station.active .bubble { opacity: 1; }
.station.active .shadow {
  background: radial-gradient(ellipse, rgba(255,200,110,.6), transparent 70%);
  animation: pulse-ring 1.4s ease-in-out infinite;
}
@keyframes pulse-ring { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* ---- PM神（天界を巡回する） ---- */
.station.pm { animation: patrol 26s linear infinite; }
.station.pm .robo { width: 42px; height: 52px; }
.station.pm .robo .head { width: 38px; height: 31px; }
.station.pm .robo .body { top: 30px; }
@keyframes patrol {
  0%   { left: 400px; top: 250px; }
  22%  { left: 150px; top: 250px; }
  28%  { left: 150px; top: 250px; }
  47%  { left: 400px; top: 530px; }
  53%  { left: 400px; top: 530px; }
  72%  { left: 660px; top: 250px; }
  78%  { left: 660px; top: 250px; }
  100% { left: 400px; top: 250px; }
}

/* ---- 神託降臨（天からの光と巻物） ---- */
.oracle-beam {
  position: fixed; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 220px; height: 100vh;
  background: linear-gradient(180deg, rgba(255,235,170,.9), rgba(255,235,170,.25) 55%, rgba(255,235,170,0) 85%);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  z-index: 40; pointer-events: none;
  animation: beam-in .5s ease-out both, beam-fade 1.2s ease 3.6s forwards;
}
@keyframes beam-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes beam-fade { to { opacity: 0; } }

.oracle-scroll {
  position: fixed; top: -90px; left: 50%;
  transform: translateX(-50%);
  z-index: 41; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  max-width: 72vw;
  background: #fffbe8; color: #5a4a20;
  border: 2px solid var(--gold-deep);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13px; font-weight: bold;
  box-shadow: 0 0 34px rgba(255,212,120,.95), 0 8px 20px rgba(80,60,140,.4);
  animation: oracle-drop 1.7s cubic-bezier(.3, 1.35, .55, 1) forwards, beam-fade .8s ease 4.2s forwards;
}
.oracle-icon { font-size: 20px; flex: none; }
.oracle-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes oracle-drop {
  0% { top: -90px; opacity: 0; }
  25% { opacity: 1; }
  100% { top: 42vh; opacity: 1; }
}

/* 神々の「やるぞー！」 */
.floor.rally .robo { animation: party .45s ease-in-out infinite; }

/* ---- 納品完了の宴 ---- */
.floor.party .robo { animation: party .5s ease-in-out infinite; }
@keyframes party {
  0%,100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-16px) rotate(8deg); }
}

/* ---- 御神業モニター（天界パブリックビューイング・右上固定） ---- */
.pv-screen {
  position: fixed;
  top: 88px; right: 18px;
  width: 460px;
  z-index: 25;
}
.pv-frame {
  background: #171232;
  border: 3px solid var(--gold-deep);
  border-radius: 12px;
  box-shadow: 0 0 32px rgba(255,212,120,.5), 0 24px 34px rgba(80,60,140,.5);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  text-align: left;
  overflow: hidden;
}
.bs-head {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold);
  padding: 8px 14px;
  background: #241d3e;
  border-bottom: 1px solid rgba(214,168,74,.5);
}
.pv-status {
  display: flex;
  gap: 18px;
  padding: 6px 14px;
  background: #1d1738;
  border-bottom: 1px solid rgba(214,168,74,.35);
  font-size: 11px;
  color: #c3bde8;
}
.pv-status b { color: #fff; font-weight: bold; margin-left: 4px; }
.bs-body {
  display: block;
  padding: 10px 14px 12px;
  min-height: 300px;
  font-size: 12.5px;
  line-height: 2.0;
  color: #f5e6c4;
}
.bs-body .ln { display: block; white-space: normal; word-break: break-word; text-indent: -1em; padding-left: 1em; }
.bs-body .ln.cur::after {
  content: "▌";
  color: var(--gold);
  animation: curblink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes curblink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ============ 神託ポスト（発注フォーム） ============ */
.order-post {
  position: fixed;
  right: 18px; bottom: 100px;
  width: 300px;
  background: rgba(35,28,70,.94);
  border: 1px solid rgba(255,215,120,.65);
  border-radius: 12px;
  padding: 12px;
  z-index: 30;
  box-shadow: 0 0 26px rgba(255,215,120,.25);
}
.op-title { font-size: 13px; font-weight: bold; color: var(--gold); margin-bottom: 8px; }
.op-title span { font-weight: normal; font-size: 10px; color: #c3bde8; margin-left: 8px; }
.order-post textarea {
  width: 100%;
  background: #1c1740;
  color: #fff;
  border: 1px solid #55488f;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
}
.order-post button {
  margin-top: 8px;
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffd478, #ff9d4d);
  color: #3a2200;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
}
.order-post button:hover { filter: brightness(1.12); }
.order-post button:disabled { filter: grayscale(.6); cursor: wait; }
.op-file-label {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: #c3bde8;
  cursor: pointer;
  border: 1px dashed rgba(195,189,232,.5);
  border-radius: 6px;
  padding: 5px 10px;
}
.op-file-label:hover { color: #fff; border-color: var(--gold); }
.op-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.op-chip {
  font-size: 10.5px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,215,120,.4);
  border-radius: 999px;
  padding: 2px 8px;
  color: #e9e4ff;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.op-chip b { cursor: pointer; color: #ff9d9d; font-weight: bold; }
.op-result { margin-top: 6px; font-size: 11px; color: #ffe9b0; min-height: 14px; }

/* ============ ステータスボード ============ */
.status-board {
  background: rgba(28,22,58,.9);
  border-top: 1px solid rgba(255,212,120,.5);
  padding: 10px 24px 12px;
  z-index: 10;
}
.sb-row { display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; }
.sb-key {
  font-size: 11px; color: #c3bde8; margin-right: 8px;
  border: 1px solid rgba(195,189,232,.5); border-radius: 4px; padding: 1px 6px;
}
.sb-val { font-size: 15px; font-weight: bold; }
.sb-phase { color: var(--gold); text-shadow: 0 0 8px rgba(255,212,120,.6); }
.sb-msg { font-size: 13px; color: #e9e4ff; flex: 1; }
.sb-updated { font-size: 11px; color: #948dc2; }

.phase-track { display: flex; gap: 6px; margin-top: 8px; }
.phase-step {
  flex: 1; text-align: center;
  font-size: 11px; color: #948dc2;
  border: 1px solid rgba(148,141,194,.45);
  border-radius: 6px; padding: 4px 2px;
  transition: all .4s;
}
.phase-step.done { color: #8fe8b0; border-color: rgba(143,232,176,.55); background: rgba(143,232,176,.1); }
.phase-step.now {
  color: #fff; font-weight: bold;
  border-color: var(--gold);
  background: rgba(255,212,120,.18);
  box-shadow: 0 0 12px rgba(255,212,120,.4);
}

/* 御神業モニターと被らないよう、神々のステージは左に寄せる */
@media (min-width: 701px) {
  .stage-wrap { padding: 0 500px 0 12px; }
}

@media (max-width: 1100px) {
  .pv-screen { width: 340px; }
  .bs-body { min-height: 200px; font-size: 11px; }
  .stage-wrap { padding-right: 380px; }
}

@media (max-width: 700px) {
  .order-post { width: 230px; right: 10px; bottom: 118px; }
  .neon-sign { font-size: 16px; }
  .neon-sign em { font-size: 22px; }
  .shrine, .hud-right { width: 78px; }
  .shrine-gate { font-size: 32px; }
  .clock { font-size: 14px; }
  .pv-screen { width: 260px; top: 78px; right: 10px; }
  .bs-body { min-height: 120px; font-size: 10px; line-height: 1.8; }
}
