/* 미니월루천국 공용 — 가짜 엑셀 크롬(타이틀바/리본/수식줄/시트/탭/상태줄).
   마크업은 /assets/js/chrome.js mountChrome()이 주입한다.
   게임별 시트 "내용" 스타일(xs-* 등)은 각 게임의 stealth.css가 담당. */

body[data-theme="light"] {
  --xl-bg: #ffffff;
  --xl-grid: #d8d8d8;
  --xl-head-bg: #eceff1;
  --xl-head-border: #c2c7cb;
  --xl-head-text: #5b6166;
  --xl-text: #1f1f1f;
  --xl-green: #217346;
  --xl-btnface: #e9ecef;
  --xl-btnface-hover: #dde1e5;
  --xl-btnborder: #a9b0b6;
  --xl-titlebar-bg: #217346;
  --xl-titlebar-text: #ffffff;
  --xl-ribbon-bg: #f3f2f1;
}

body[data-theme="dark"] {
  --xl-bg: #212226;
  --xl-grid: #3a3d44;
  --xl-head-bg: #2b2e35;
  --xl-head-border: #454952;
  --xl-head-text: #b8bcc6;
  --xl-text: #e8e8ec;
  --xl-green: #4fbe8a;
  --xl-btnface: #3a3d44;
  --xl-btnface-hover: #454952;
  --xl-btnborder: #555a64;
  --xl-titlebar-bg: #1f2124;
  --xl-titlebar-text: #c8ccd4;
  --xl-ribbon-bg: #26282d;
}

/* ---------- 표시 규칙: 위장 OFF면 크롬 숨김, ON이면 전체 창 ---------- */
body:not(.stealth) .xl-titlebar,
body:not(.stealth) .xl-menubar,
body:not(.stealth) .xl-toolbar,
body:not(.stealth) .xl-formulabar,
body:not(.stealth) .xl-grid-area,
body:not(.stealth) .xl-tabs,
body:not(.stealth) .xl-statusbar { display: none; }

body.stealth #screen-game {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--xl-bg);
  font-family: Calibri, "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 14px;
  color: var(--xl-text);
}

body.stealth #screen-game.hidden { display: none; }

/* 테마/위장 토글을 타이틀바에 녹인다 (창 컨트롤 ─ ▢ ✕ 왼쪽) */
body.stealth.in-sheet #btn-theme, body.stealth.in-sheet #btn-stealth {
  top: 3px;
  width: 24px;
  height: 24px;
  font-size: 12px;
  background: transparent;
  border: none;
}

body.stealth.in-sheet #btn-theme { right: 124px; }
body.stealth.in-sheet #btn-stealth { right: 152px; }

body.stealth #btn-theme,
body.stealth #btn-stealth { opacity: 0.4; }

body.stealth #btn-theme:hover,
body.stealth #btn-stealth:hover { opacity: 1; }

/* ---------- 크롬 각부 ---------- */
.xl-titlebar {
  display: flex;
  align-items: center;
  height: 30px;
  flex: none;
  background: var(--xl-titlebar-bg);
  color: var(--xl-titlebar-text);
  font-size: 12px;
}

.xl-qat { width: 130px; padding-left: 12px; letter-spacing: 1px; opacity: 0.9; }
#xl-filename { flex: 1; text-align: center; }
.xl-title-spacer { width: 60px; }

.xl-wincontrols {
  display: flex;
  height: 100%;
  align-items: center;
}

.xl-wincontrols span {
  width: 38px;
  text-align: center;
  font-size: 10px;
  opacity: 0.85;
}

.xl-menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  flex: none;
  background: var(--xl-ribbon-bg);
  padding: 0 6px;
  font-size: 12.5px;
}

.xl-menu { padding: 5px 11px; color: var(--xl-text); }

.xl-menu.xl-menu-file {
  background: var(--xl-green);
  color: #fff;
  font-weight: 600;
}

.xl-menu.active {
  font-weight: 600;
  color: var(--xl-green);
  box-shadow: inset 0 -2px 0 var(--xl-green);
}

.xl-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 36px;
  flex: none;
  background: var(--xl-ribbon-bg);
  border-bottom: 1px solid var(--xl-head-border);
  padding: 0 12px;
  font-size: 12px;
  color: var(--xl-head-text);
}

.xl-tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 14px;
  border-right: 1px solid var(--xl-head-border);
}

.xl-tool-group:last-child { border-right: none; }

.xl-fontbox, .xl-sizebox {
  background: var(--xl-bg);
  border: 1px solid var(--xl-head-border);
  border-radius: 2px;
  padding: 2px 8px;
  white-space: nowrap;
}

.xl-tool { padding: 2px 4px; }

.xl-formulabar {
  display: flex;
  align-items: center;
  height: 26px;
  flex: none;
  background: var(--xl-bg);
  border-bottom: 1px solid var(--xl-head-border);
  font-size: 12px;
}

#xl-namebox {
  width: 70px;
  text-align: center;
  border-right: 1px solid var(--xl-head-border);
  color: var(--xl-text);
}

.xl-fx {
  width: 34px;
  text-align: center;
  font-style: italic;
  color: var(--xl-head-text);
  border-right: 1px solid var(--xl-head-border);
}

.xl-formula-input { flex: 1; padding-left: 8px; color: var(--xl-head-text); }

.xl-grid-area { flex: 1 1 auto; overflow: hidden; }

table#sheet {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13.5px;
  color: var(--xl-text);
}

table#sheet th, table#sheet td {
  border: 1px solid var(--xl-grid);
  height: 25px;
  padding: 0 7px;
  text-align: center;
  font-weight: 400;
  overflow: hidden;
  white-space: nowrap;
}

.xl-letters th {
  background: var(--xl-head-bg);
  color: var(--xl-head-text);
  font-size: 12px;
  font-weight: 400;
  border-color: var(--xl-head-border);
}

.xl-corner, .xl-rownum {
  background: var(--xl-head-bg);
  color: var(--xl-head-text);
  width: 32px;
  font-size: 12px;
  border-color: var(--xl-head-border) !important;
}

.xl-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  background: var(--xl-head-bg);
  border-top: 1px solid var(--xl-head-border);
  padding: 0 8px;
  height: 25px;
}

.xl-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  height: 22px;
  background: var(--xl-head-bg);
  border-top: 1px solid var(--xl-head-border);
  padding: 0 14px;
  font-size: 11.5px;
  color: var(--xl-head-text);
}

.xl-tab {
  background: var(--xl-bg);
  color: var(--xl-green);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 14px;
  border-left: 1px solid var(--xl-head-border);
  border-right: 1px solid var(--xl-head-border);
  border-bottom: 2px solid var(--xl-green);
  height: 100%;
  display: flex;
  align-items: center;
}

.xl-tab-add {
  color: var(--xl-head-text);
  font-size: 14px;
  padding: 0 8px;
}
