/* =========================
   GLOBAL COLORS & VARIABLES
   ========================= */
:root {
  --bg: #e1f0f5;
  --panel-bg: #fff6e3;
  --panel-border: #d0c0a8;

  --building-bg: #ffe9c4;
  --elevator: #ff944d;

  --text-main: #3b3b3b;

  --esc-gray: #cccccc;   /* 購入不可 */
  --esc-white: #ffffff;  /* 購入可能 */
  --esc-blue: #1e88e5;   /* 設置済 */
}

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

/* BODY */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  max-width: 1300px;
  margin: auto;
  padding: 16px;
}

h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 12px;
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* BUTTONS */
.btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #bbb;
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover {
  filter: brightness(0.95);
}
.btn-primary {
  background: #ff944d;
  border-color: #ff944d;
  color: #fff;
  font-weight: 600;
}
.btn-toggle {
  font-size: 12px;
  padding: 6px 10px;
}

/* LAYOUT */
.top-bar {
  margin-bottom: 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:center;
}
.top-bar > div:first-child {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:center;
}
.top-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  justify-content:center;
}

.speed-box {
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: flex-start;
  margin: 12px auto 0;
  max-width: 960px;
}

/* =========================
   SCORE SUMMARY BAR
   ========================= */
.score-summary {
  background: #fee6bb;
  border-radius: 16px;
  padding: 14px 28px;
  margin: 0 auto 16px;
  max-width: 960px;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}
.score-summary-row {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}
.score-summary-top {
  font-size: 15px;
  font-weight: 700;
}
.score-summary-bottom {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}
.score-label {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.4px;
}
.score-value {
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}
.combo-main {
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #ff944d;
}
.combo-sub {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.score-summary.combo-active {
  box-shadow: 0 6px 18px rgba(255,148,77,.45);
}
.score-summary.combo-active .combo-main {
  color: #ff6f00;
}

/* INFO ROW */
.info-row {
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  align-items: center;
}
.value-pill {
  padding: 3px 8px;
  border: 1px solid #d1c7b4;
  background: #fff;
  border-radius: 6px;
  font-family: "Consolas", "Menlo", monospace;
}

/* LOG WINDOW */
.log {
  display: none;
  margin: 16px auto 0;
  max-width: 960px;
  background: #fff;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 11px;
  height: 160px;
  overflow-y: auto;
  border: 1px solid #ddd;
  white-space: pre-wrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
body.debug-mode .log {
  display: block;
}

.debug-info {
  max-width: 960px;
  margin: 12px auto 0;
  background: var(--panel-bg);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

/* LEGEND */
.legend {
  display: flex;
  flex-wrap: wrap;
  font-size: 10px;
  gap: 8px;
  margin-top: 8px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.legend-dot.short { background: #4b9cff; }
.legend-dot.medium { background: #ffca28; }
.legend-dot.long { background: #ef5350; }

/* =========================
   BUILDING (CENTER)
   ========================= */
.building-wrapper {
  background: var(--building-bg);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.building-header,
.building-footer {
  background: #cf7c33;
  height: 10px;
  border-radius: 10px;
  margin: 4px 26px;
}
.building {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
}

.floor-row {
  display: grid;
  /* label / waiting / main shaft / escalator / auto shaft */
  grid-template-columns: 35px 1fr 60px 40px 60px;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid rgba(0,0,0,.08);
}
.floor-label {
  text-align: right;
  font-weight: 700;
  font-size: 11px;
}
.floor-waiting {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* Passengers */
.person {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
}
.person.wait-short { background: #4b9cff; }
.person.wait-medium { background: #ffca28; color: #5d3b00; }
.person.wait-long { background: #ef5350; }
.person.influencer {
  background: #000;
  color: #ffeb3b;
}

/* ELEVATOR SHAFT */
.shaft-cell {
  height: 38px;
  position: relative;
}

.shaft-line {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  background: #d9b388;
  border-radius: 4px;
}

/* ELEVATOR CAR：各シャフトの中央に表示 */
.elevator-car {
  width: 52px;
  height: 34px;
  background: var(--elevator);
  border-radius: 8px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display:flex;
  align-items:center;
  justify-content:center;
}

/* メインエレベーター：見た目の違いを付けたい場合だけ使う */
.main-car {
  /* 位置指定は不要（flex がよしなに並べてくれます） */
}

/* 自動エレベーター：色を変えたい場合など */
.auto-car {
  /* 例えば色だけ変えるなら：
     background: #4b9cff;
  */
}
.car-dots {
  display:flex;
  flex-wrap:wrap;
  gap:3px;
  justify-content:center;
}
.car-dot {
  width:6px;
  height:6px;
  border-radius:50%;
  background:#fff;
}
/* 乗降アニメーション用レイヤー */
.drop-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 3;    /* エレベーター車両より前面に */
}

/* 乗降の「粒」共通 */
.drop-dot,
.board-dot {
  position: absolute;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;        /* 中央揃え用 */
  border-radius: 50%;
}

/* 降車アニメーションの粒（オレンジ系） */
.drop-dot {
  background: #ffb347;
  animation: dropDot 0.45s ease-out forwards;
}

/* 乗車アニメーションの粒（グリーン系） */
.board-dot {
  background: #4cd964;
  animation: boardDot 0.45s ease-out forwards;
}

/* 降車：ちょっと下に落ちてフェードアウト */
@keyframes dropDot {
  from {
    opacity: 1;
    transform: translateY(-4px);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* 乗車：ちょっと上に上がってフェードアウト */
@keyframes boardDot {
  from {
    opacity: 1;
    transform: translateY(4px);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ESCALATOR ICON (斜めバー＋人アイコン) */
/* ESCALATOR ICON STATES */
.escalator-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  /* 枠線は不要なので削除 */
  border: none;

  position: relative;           /* 斜めバー（::before）の基準にする */
  display: flex;
  align-items: center;
  justify-content: center;

  /* テキストは使っていないのであればなくてもOK */
  font-size: 0;
  user-select: none;
}

/* 斜めのエスカレーター本体（バー部分） */
.escalator-icon::before {
  content: "";
  position: absolute;

  /* バーの長さ：幅を大きめにして、上下方向に伸びて見えるようにする */
  width: 38px;      /* 元より長くして上下に広がるイメージ */
  height: 10px;      /* 太さ（お好みで 4〜6px 程度） */

  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;

  /* 中心から少し傾けて、角度＆高さを強調 */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-40deg);
}

/* 人の丸 */
.escalator-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  background: currentColor;
  border-radius: 50%;
  /* 左寄り・少し上に配置（元画像に寄せた位置） */
  left: 26%;
  top: 1%;
}

/* ▼ 以下は「状態ごとの色」だけを制御 */

/* 購入不可（灰色） */
.esc-gray {
  background: transparent;
  border-color: #999;
  color: var(--esc-gray);     /* グレーのエスカレーター */
  box-shadow: none;
}

/* 購入可能（白） */
.esc-white {
  background: transparent;
  color: var(--esc-white);    /* 白いエスカレーター */
  box-shadow: none;
}

/* 設置済（青） */
.esc-blue {
  background: transparent;
  color: var(--esc-blue);     /* 青いエスカレーター */
  box-shadow: none;
}

/* =========================
   CONTROL PANEL (RIGHT SIDE)
   ========================= */
.control-panel {
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.control-panel h2 {
  text-align:center;
  margin-bottom:8px;
}

/* LCD */
.lcd-panel {
  display:flex;
  justify-content:center;
  margin-bottom: 8px;
}
.lcd-outer {
  background:#121212;
  padding:4px 10px;
  border-radius:6px;
  display:flex;
  gap:8px;
  align-items:center;
}
.lcd-arrow,
.lcd-floor {
  color:#ffb74d;
  font-family:"Courier New", monospace;
}
.lcd-floor {
  font-size:20px;
  font-weight:800;
}

/* FLOOR BUTTON MATRIX (678 / 345 / 12) */
.floor-buttons {
  display:flex;
  flex-direction:column;
  gap:6px;
  margin: 0 auto;
}
.floor-btn-row {
  display:flex;
  justify-content:center;
  gap:6px;
}
.btn-floor {
  width:38px;
  height:38px;
  border-radius:6px;
  font-size:15px;
  font-weight:700;
  border:1px solid #666;
  background: linear-gradient(#f0f0f0,#d0d0d0);
}
.btn-floor-active {
  color:#ff944d;
  border-color:#ff944d;
  box-shadow:0 0 6px rgba(255,148,77,.7);
}

/* PANEL BOTTOM BUTTONS */
.panel-controls {
  display:flex;
  justify-content:center;
  gap:10px;
  margin-top:8px;
}

/* Auto mode button active */
.btn-panel-auto.auto-on {
  color:#ff944d;
  border-color:#ff944d;
  box-shadow:0 0 6px rgba(255,148,77,.8);
}

/* =========================
   CABIN PANEL
   ========================= */
.cabin-panel {
  background: linear-gradient(135deg,#e0e0e0,#c2c2c2);
  border-radius: 16px;
  padding: 8px;
  margin-top: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.cabin-title {
  text-align:center;
  font-size:12px;
  margin-bottom:6px;
}
.cabin-grid {
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap:4px;
}
.cabin-slot {
  height:28px;
  border-radius:8px;
  display:flex;
  justify-content:center;
  align-items:center;
  font-size:13px;
  font-weight:700;
}
.cabin-slot.empty {
  background:#ffffff50;
  color:#888;
}
.cabin-slot.short { background:#4b9cff; color:#fff;}
.cabin-slot.medium { background:#ffca28; color:#5d3b00;}
.cabin-slot.long { background:#ef5350; color:#fff;}
.cabin-slot.influencer { background:#000; color:#ffeb3b; }

.cap-up-btn {
  margin-top:8px;
  width:100%;
  border-radius: 10px;
}
/* 自動エレベーター：AUTOモード（水色） */
.auto-car.auto-mode {
  background: #66c7ff;
}

/* 自動エレベーター：SHUTTLEモード（緑） */
.auto-car.shuttle-mode {
  background: #5edb76;
}
/* デバッグ表示用：通常は非表示 */
.debug-only {
  display: none;
}

/* DebugモードON時に表示 */
body.debug-mode .debug-only {
  display: block;
}
/* ================ END ================ */
