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

body {
  background: #1d150e;
  color: #efe5d0;
  font-family: 'DotGothic16', 'MS Gothic', monospace;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14px;
}

#wrap { display: flex; gap: 14px; flex-wrap: wrap; }

#left { display: flex; flex-direction: column; gap: 8px; }

#titlebar {
  display: flex; align-items: center; gap: 16px;
  background: #332416; border: 3px solid #5a4030; border-radius: 6px;
  padding: 8px 14px; font-size: 18px;
}
#logo { color: #ffd866; letter-spacing: 1px; }
#clock { color: #9be8ff; margin-left: auto; }
#conn { font-size: 13px; }
#conn.on { color: #7ee787; }
#conn.off { color: #ff7b72; }

canvas#office {
  border: 3px solid #5a4030; border-radius: 6px;
  background: #15100a;
  image-rendering: pixelated;
  display: block;
  max-width: 100%;
  height: auto;
}

#controls { display: flex; gap: 10px; align-items: center; }
button {
  font-family: inherit; font-size: 14px;
  background: #54381f; color: #efe5d0;
  border: 2px solid #8a5a32; border-radius: 4px;
  padding: 6px 14px; cursor: pointer;
}
button:hover { background: #6b4a2e; }
button.on { background: #2d5a3d; border-color: #5fae7d; }
#hint { font-size: 12px; color: #a89378; }

#side {
  width: 300px; min-height: 660px;
  background: #332416; border: 3px solid #5a4030; border-radius: 6px;
  padding: 12px; font-size: 13px;
}
#side h2 { font-size: 15px; color: #ffd866; margin: 6px 0 8px; }

#staff-count {
  font-size: 12px; color: #a8d8ff;
  margin-bottom: 8px; padding: 4px 6px;
  background: #1d150e; border-radius: 3px;
  border-left: 3px solid #4a6e8e;
}

.staff-card {
  background: #241a10; border-left: 4px solid #8a5a32;
  border-radius: 3px; padding: 6px 8px; margin-bottom: 6px;
}
.staff-card .nm { font-size: 14px; }
.staff-card .st { color: #9be8ff; font-size: 12px; }
.staff-card .ds { color: #a89378; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 帰宅中カード */
.staff-home {
  opacity: 0.55;
  font-style: italic;
  border-left-color: #4a6e8e;
}

/* 社長の指示パネル */
#ceo-directive { margin-bottom: 10px; }
.ceo-item {
  background: #241a10; border-left: 4px solid #8a5a32;
  border-radius: 3px; padding: 6px 8px; margin-bottom: 6px;
}
.ceo-item.ceo-current { border-left-color: #ffd866; background: #2c2113; }
.ceo-text { font-size: 13px; color: #efe5d0; line-height: 1.4; }
.ceo-item.ceo-current .ceo-text { color: #ffe9a8; }
.ceo-meta { font-size: 11px; color: #a89378; margin-top: 3px; }
.ceo-empty { font-size: 12px; color: #a89378; font-style: italic; padding: 4px 6px; }

#ticker { max-height: 280px; overflow-y: auto; }
.tick {
  padding: 3px 4px; font-size: 12px; color: #d4c4a8;
  border-bottom: 1px dashed #54381f;
}
.tick .t { color: #8a5a32; margin-right: 6px; }

/* ---- 設定ボタン ---- */
#btnSettings {
  margin-left: 8px;
  font-size: 18px;
  padding: 4px 10px;
  background: #54381f;
  border-color: #8a5a32;
}
/* ---- 設定モーダル ---- */
#settings-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
#settings-modal.hidden { display: none; }
#settings-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
#settings-panel {
  position: relative; z-index: 1;
  background: #2a1d10; border: 3px solid #8a5a32; border-radius: 8px;
  width: 480px; max-width: 96vw; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
#settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #332416; border-bottom: 2px solid #5a4030;
  font-size: 16px; color: #ffd866;
}
#settings-close {
  background: none; border: none; color: #a89378; font-size: 18px; cursor: pointer; padding: 2px 6px;
}
#settings-close:hover { color: #ffd866; background: none; }
#settings-tabs {
  display: flex; gap: 0; border-bottom: 2px solid #5a4030;
}
.stab {
  flex: 1; background: #1d150e; border: none; border-right: 1px solid #5a4030;
  color: #a89378; padding: 8px; font-family: inherit; font-size: 13px; cursor: pointer;
}
.stab:last-child { border-right: none; }
.stab:hover { background: #2a1d10; color: #efe5d0; }
.stab.active { background: #2a1d10; color: #ffd866; border-bottom: 2px solid #ffd866; }
#settings-body { flex: 1; overflow-y: auto; padding: 14px; }
.stab-pane { display: none; }
.stab-pane.active { display: block; }
.srow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.srow label { min-width: 100px; font-size: 13px; color: #c8b89a; }
.srow input[type="text"] {
  flex: 1; background: #1d150e; border: 1px solid #5a4030; border-radius: 3px;
  color: #efe5d0; padding: 4px 8px; font-family: inherit; font-size: 13px;
}
.srow input[type="text"]:focus { outline: none; border-color: #ffd866; }
.stoggle {
  min-width: 56px; padding: 4px 10px; font-size: 13px;
  background: #3a2418; border-color: #5a4030; color: #a89378;
}
.stoggle.on { background: #2d5a3d; border-color: #5fae7d; color: #7ee787; }
.shint { font-size: 11px; color: #8a7060; margin-bottom: 10px; line-height: 1.5; }
.sreset { margin-top: 12px; text-align: right; }
.sreset button { font-size: 12px; padding: 4px 10px; }
/* ラベル 表示/非表示トグル */
.slabel-vis {
  min-width: 52px; padding: 3px 8px; font-size: 12px;
  background: #3a2418; border: 1px solid #5a4030; border-radius: 3px;
  color: #a89378; cursor: pointer;
}
.slabel-vis.on { background: #2d5a3d; border-color: #5fae7d; color: #7ee787; }
/* ラベル 削除ボタン */
.slabel-del {
  padding: 3px 8px; font-size: 13px;
  background: #3a1a1a; border: 1px solid #7a3a3a; border-radius: 3px;
  color: #c07070; cursor: pointer;
}
.slabel-del:hover { background: #5a2a2a; border-color: #a05a5a; color: #e09090; }
/* カスタムラベルのキー表示 */
.slabel-custom-key { min-width: 100px; font-size: 12px; color: #8aaa6a; font-style: italic; }
/* ラベル追加ボタン行 */
.slabel-add-row { margin-top: 10px; }
.slabel-add {
  padding: 5px 14px; font-size: 13px;
  background: #1e3a1a; border: 1px solid #4a8a3a; border-radius: 3px;
  color: #8ae060; cursor: pointer;
}
.slabel-add:hover { background: #2a5024; border-color: #6ab050; color: #aaf07a; }
/* エージェント行 */
.agent-row { margin-bottom: 10px; padding: 8px; background: #1d150e; border-radius: 4px; border: 1px solid #3a2820; }
.agent-key { font-size: 11px; color: #8a7060; margin-bottom: 6px; }
.agent-fields-inner { display: flex; gap: 6px; flex-wrap: wrap; }
.agent-fields-inner input, .agent-fields-inner select {
  flex: 1; min-width: 80px;
  background: #241a10; border: 1px solid #5a4030; border-radius: 3px;
  color: #efe5d0; padding: 3px 6px; font-family: inherit; font-size: 12px;
}
.agent-fields-inner select option { background: #241a10; }
/* ---- ラベル配置モード ---- */
.splace { margin-bottom: 10px; }
.splace button { font-size: 13px; }
#place-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1100;
  background: #2d5a3d; border: 2px solid #5fae7d; border-radius: 6px; color: #eaffea;
  padding: 8px 14px; font-size: 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#place-banner.hidden { display: none; }
#place-banner button { font-size: 13px; padding: 3px 12px; background: #1d150e; border-color: #5fae7d; color: #eaffea; }

#wall-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1100;
  background: #5a2d2d; border: 2px solid #d95f4e; border-radius: 6px; color: #ffeaea;
  padding: 8px 14px; font-size: 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#wall-banner.hidden { display: none; }
#wall-banner button { font-size: 13px; padding: 3px 12px; background: #1d150e; border-color: #d95f4e; color: #ffeaea; }
#btnWallEdit.on { background: #5a2d2d; border-color: #d95f4e; color: #ffeaea; }

#break-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1100;
  background: #2d4a3a; border: 2px solid #5fae7d; border-radius: 6px; color: #eaffea;
  padding: 8px 14px; font-size: 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#break-banner.hidden { display: none; }
#break-banner button { font-size: 13px; padding: 3px 12px; background: #1d150e; border-color: #5fae7d; color: #eaffea; }
#btnBreakEdit.on { background: #2d4a3a; border-color: #5fae7d; color: #eaffea; }

#seat-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1100;
  background: #2a3a55; border: 2px solid #6ea0e6; border-radius: 6px; color: #eaf2ff;
  padding: 8px 14px; font-size: 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
#seat-banner.hidden { display: none; }
#seat-banner button { font-size: 13px; padding: 3px 12px; background: #1d150e; border-color: #6ea0e6; color: #eaf2ff; }
#btnSeatEdit.on { background: #2a3a55; border-color: #6ea0e6; color: #eaf2ff; }

#sim-badge {
  position: fixed; top: 64px; left: 24px; z-index: 1090;
  background: rgba(30,20,40,0.82); border: 1px solid #e8c468; border-radius: 14px;
  color: #ffe9a8; padding: 4px 12px; font-size: 13px; letter-spacing: 0.04em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45); pointer-events: none;
}
#sim-badge.hidden { display: none; }

#onboarding {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(10,8,5,0.72);
  display: flex; align-items: center; justify-content: center;
}
#onboarding.hidden { display: none; }
#onboarding-panel {
  max-width: 520px; margin: 16px; padding: 22px 26px;
  background: #241c30; border: 2px solid #e8c468; border-radius: 10px;
  color: #f2ead8; line-height: 1.8; box-shadow: 0 6px 30px rgba(0,0,0,0.6);
}
#onboarding-panel h3 { margin: 0 0 10px; color: #ffd866; font-size: 18px; }
#onboarding-panel p { margin: 8px 0; font-size: 14px; }
#onboarding-panel small { color: #c8b89a; }
#onboarding-panel b { color: #ffe9a8; }
#onboarding-close {
  margin-top: 12px; padding: 8px 26px; font-size: 15px;
  background: #e8c468; color: #241c30; border: none; border-radius: 6px; cursor: pointer;
}
#onboarding-close:hover { background: #ffd866; }

/* ---- embedモード(コーポレートサイトへの iframe 埋め込み。?embed=1) ---- */
/* index.htmlのインラインスクリプトが <html class="embed"> を付与する */
html.embed, html.embed body {
  background: transparent;
}
html.embed body {
  padding: 0;
  min-height: 0;
  justify-content: flex-start;
  align-items: stretch;
  overflow: hidden;
}
html.embed #wrap { gap: 0; width: 100%; }
html.embed #side { display: none; }
html.embed #left { width: 100%; gap: 0; }
html.embed #titlebar { display: none; }
html.embed #controls { display: none; }
html.embed canvas#office {
  border: none; border-radius: 0;
  width: 100%; max-width: 100%;
  height: auto; display: block;
}
/* 観賞モードバッジは誠実性のため非表示にせず、控えめなサイズで残す */
html.embed #sim-badge {
  top: 8px; left: 8px;
  padding: 2px 8px; font-size: 11px;
}

/* ---------- demoモード(?demo=1: 全画面の訪問者向けデモ) ---------- */
/* 管理系UI(設定・接続状態・ヒント)を隠し、オフィス+サイドパネルだけ見せる */
html.demo #btnSettings,
html.demo #conn,
html.demo #controls { display: none; }
