/* ────────────────────────────────────────
   🎨 Theme Variables
──────────────────────────────────────── */

:root {
  /* 기존 색상 변수 유지 */
  --shpColor1: #df9a36;
  --shpColor1Font: #000;
  --shpColor2: #664c97;

  --techniqueColor: #ffd93b;
  --techniqueFont: #000;
  --techniqueSize: 30;

  --sequenceColor1: #003f5c;
  --sequenceColor1-font: #fff;
  --sequenceColor1--size: 40;

  --sequenceColor2: #bc5090;
  --sequenceColor2-font: #fff;
  --sequenceColor2-size: 40;

  --sequenceColor3: #ffa600;
  --sequenceColor3-font: #000;
  --sequenceColor3-size: 40;

  --sequenceColor4: #2a9d8f;
  --sequenceColor4-font: #fff;
  --sequenceColor4-size: 40;

  --pathColor1: #2735f8;
  --pathColor2: #f85025;

  --charactersColor1: #5a1fff;
  --charactersColor1-bg: #fff;
  --charactersColor1-size: 30;

  --charactersColor2: #000;
  --charactersColor2-bg: #fff;
  --charactersColor2-size: 40;

  /* 공통 */
  --theme-transition: 0.25s ease;

  /* ===== 다크 테마 기본값 ===== */
  --bg-body: #181a1f;
  --text-primary: #e5e5e5;
  --text-muted: #9ba1b0;
  --text-secondary: #c0c4d0;

  --bg-topbar: #1c1f24;
  --border-topbar: #2a2f37;

  --bg-ribbon-tabs: #20242b;
  --bg-ribbon-panels: #242932;
  --border-ribbon-top: #16181d;
  --border-ribbon-bottom: #2a2f37;

  --bg-toolbox: #20242b;
  --border-toolbox: #292e38;

  --bg-workspace: #181a1f;
  --bg-canvas: #181a1f;

  --bg-canvas-header: #1b1e26;
  --border-canvas-header: #232732;

  --bg-statusbar: #1a1d23;
  --border-statusbar: #262a33;

  --bg-input: #181b22;
  --bg-input-hover: #1f232b;
  --border-input: #3b414f;

  --scroll-track: #1f2228;
  --scroll-thumb: #3b3f47;
  --scroll-thumb-hover: #4a4f59;

  --panel-bg: #252a33;
  --panel-header-bg: #2c3240;
  --panel-border: #303543;

  /* Toggle Switch */
  --toggle-track-bg: #333;
  --toggle-knob-bg: #f5f5f5;
  --toggle-icon-color: #f5f5f5;

  /* Ribbon Buttons */
  --btn-bg: linear-gradient(180deg, #323845 0%, #292e3a 100%);
  --btn-bg-hover: linear-gradient(180deg, #3a4050 0%, #2f3542 100%);
  --btn-bg-active: linear-gradient(180deg, #262b36 0%, #1f232b 100%);

  --toolbtn-bg: #262b35;
  --toolbtn-bg-hover: #303643;
  --toolbtn-bg-active: #3a4250;

  /* Checkbox */
  --checkbox-bg-checked: #0b8e4f;
  --checkbox-tick-color: #ffffff;

  /* Tabs */
  --ribbon-tab-active-bg: #2e3540;
  --ribbon-tab-active-color: #ffffff;
  --ribbon-tab-hover-bg: #262b33;

  /* ===== 모달 / 슬롯 공통 ===== */
  --modal-overlay-bg: rgba(0, 0, 0, 0.6);

  --modal-bg: #222;
  --modal-text: #f3f3f3;
  --modal-radius: 14px;
  --modal-padding-x: 28px;
  --modal-padding-y: 24px;
  --modal-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);

  --modal-close-color: #ddd;

  --slot-bg: #2b2b2b;
  --slot-border: rgba(255, 255, 255, 0.12);
  --slot-text: #f5f5f5;
  --slot-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);

  --slot-empty-bg: #303030;
  --slot-empty-text: #aaaaaa;

  --slot-date-text: #aaaaaa;
  --slot-desc-text: #cccccc;

  --tool-divider-color: rgba(255, 255, 255, 0.25);

  --lock-color: #fff;
  --lock-color-active: #bfc5d2;
  --lock-blink: #fff;
  --lock-blink-active: #bfc5d2;
}

/* 라이트 테마 ---------------- */
:root[data-theme="light"] {
  --bg-body: #f5f5f5;
  --text-primary: #111827;
  --text-muted: #6b7280;
  --text-secondary: #6b7280;

  --bg-topbar: #f1f3f7;
  --border-topbar: #d0d4e0;

  --bg-ribbon-tabs: #e4e7ee;
  --bg-ribbon-panels: #edf0f7;
  --border-ribbon-top: #d5d9e5;
  --border-ribbon-bottom: #c9cedd;

  --bg-toolbox: #f3f4f8;
  --border-toolbox: #d0d4e0;

  --bg-workspace: #edf1f7;

  --bg-canvas: #f1f3f7;
  --bg-canvas-header: #e6e9f2;
  --border-canvas-header: #c7ccdc;

  --bg-statusbar: #eceff4;
  --border-statusbar: #cbd2e1;

  --bg-input: #ffffff;
  --bg-input-hover: #eef1f7;
  --border-input: #cbd2e1;

  --scroll-track: #e4e7ee;
  --scroll-thumb: #cbd2e1;
  --scroll-thumb-hover: #b6bfd4;

  --panel-bg: #ffffff;
  --panel-header-bg: #e4e7f0;
  --panel-border: #cbd2e1;

  --toggle-track-bg: #e5e5e5;
  --toggle-knob-bg: #333;
  --toggle-icon-color: #333;

  --btn-bg: linear-gradient(180deg, #fafafa 0%, #e5e7ec 100%);
  --btn-bg-hover: linear-gradient(180deg, #ffffff 0%, #dfe2e7 100%);
  --btn-bg-active: linear-gradient(180deg, #d5d7dc 0%, #c6c9cf 100%);

  --toolbtn-bg: #e3e7ef;
  --toolbtn-bg-hover: #d7dce5;
  --toolbtn-bg-active: #c7cdd8;

  --checkbox-bg-checked: #0b8e4f;
  --checkbox-tick-color: #ffffff;

  --ribbon-tab-active-bg: #d6dae4;
  --ribbon-tab-active-color: #111827;
  --ribbon-tab-hover-bg: #d7dce5;

  /* ===== 모달 / 슬롯 공통(라이트) ===== */
  --modal-overlay-bg: rgba(0, 0, 0, 0.45);

  --modal-bg: #ffffff;
  --modal-text: #222;
  --modal-radius: 14px;
  --modal-padding-x: 28px;
  --modal-padding-y: 24px;
  --modal-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);

  --modal-close-color: #444;

  --slot-bg: #ffffff;
  --slot-border: rgba(0, 0, 0, 0.18);
  --slot-text: #333;
  --slot-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

  --slot-empty-bg: #f5f5f5;
  --slot-empty-text: #999;

  --slot-date-text: #666;
  --slot-desc-text: #555;
  --tool-divider-color: rgba(0, 0, 0, 0.22);

  --lock-color: #222;
  --lock-color-active: #60646f;
  --lock-blink: #222;
  --lock-blink-active: #60646f;
}

/* ────────────────────────────────────────
   Global Reset
──────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  transition: background var(--theme-transition), color var(--theme-transition);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

/* ────────────────────────────────────────
   Topbar
──────────────────────────────────────── */

.topbar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-topbar);
  display: flex;
  flex-direction: column;
}

.topbar-main {
  display: flex;
  align-items: center;
  padding: 6px 25px 6px 12px;
  gap: 12px;
}

.logo {
  width: 100px;
  height: 35px;
  object-fit: contain;
}

/* 라이트 테마에서 invert */
:root[data-theme="light"] .logo {
  filter: invert(1);
}

/* Ribbon Tabs ----------- */

.ribbon-tabs {
  display: flex;
  align-items: stretch;
  /* border-top: 1px solid var(--border-ribbon-top); */
  /* border-bottom: 1px solid var(--border-ribbon-bottom); */
  background: var(--bg-ribbon-tabs);
  flex-wrap: wrap;
}

.ribbon-tab {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
}
.ribbon-tab:hover {
  background: var(--ribbon-tab-hover-bg);
}
.ribbon-tab.active {
  background: var(--ribbon-tab-active-bg);
  color: var(--ribbon-tab-active-color);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Ribbon Toggle */
.ribbon-toggle {
  margin-left: auto;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
}
.ribbon-toggle:hover {
  background: var(--ribbon-tab-hover-bg);
}
/* ────────────────────────────────────────
   Ribbon Panels & Groups
──────────────────────────────────────── */

.ribbon-panels {
  display: flex;
  flex-direction: column;
  background: var(--bg-ribbon-panels);
  padding: 4px 8px 6px;
  gap: 4px;
  max-height: 140px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
  overflow: auto;
}

.ribbon-panels.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.ribbon-panel {
  display: none;
  gap: 12px;
  /* flex-wrap: wrap; */
  height: 120px;
}
.ribbon-panel.active {
  display: flex;
}

.ribbon-group {
  display: inline-flex;
  flex-direction: column;
  padding: 4px 8px;
  border-right: 1px solid var(--border-ribbon-bottom);
  gap: 4px;
  justify-content: center;
  align-items: center;
}

.ribbon-group.disabled * {
  pointer-events: none;
  opacity: 0.8;
}

.ribbon-group:last-child {
  border-right: none;
}

.ribbon-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;

  /* border-bottom: 1px solid var(--border-ribbon-bottom); */
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 4px;
}

/* 기본: 가로(row) 배치 */
.ribbon-body {
  white-space: nowrap;
  display: flex;
  flex-direction: row;
  /* flex-wrap: wrap; */
  gap: 4px 10px;
  height: 70px;
  justify-content: center;
}

.ribbon-body.row {
  flex-direction: row;
  flex-wrap: wrap;
}

.ribbon-body.col1 {
  display: grid;
  grid-template-columns: repeat(1, auto);
}
.ribbon-body.col2 {
  display: grid;
  grid-template-columns: repeat(2, auto);
}

.ribbon-body.col .ribbon-body .ribbon-btn,
.ribbon-body.col2 .ribbon-body .ribbon-btn {
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.ribbon-body.row .ribbon-body .ribbon-btn {
  margin-bottom: 0;
}

/* Ribbon 내부 버튼 */
.ribbon-group .ribbon-body .ribbon-btn {
  padding: 3px 8px;
  margin-bottom: 2px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border-input);
  background: var(--btn-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
  width: max-content;
  min-width: 80px;
}
.ribbon-group .ribbon-body .ribbon-btn:hover {
  background: var(--btn-bg-hover);
}

.ribbon-group .ribbon-body .ribbon-btn:disabled {
  pointer-events: none;
}
.ribbon-group .ribbon-body .ribbon-btn:active,
.ribbon-group .ribbon-body .ribbon-btn.active {
  background: var(--btn-bg-active);
  border-color: var(--border-input);
  color: var(--text-primary);
}

.ribbon-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  align-items: center;
  justify-content: space-between;
}

label.disabled * {
  pointer-events: none !important;
  opacity: 0.4 !important;
}
.ribbon-group label.col1 {
  display: grid;
  grid-template-columns: repeat(1, auto);
}
.ribbon-group label.col2 {
  display: grid;
  grid-template-columns: repeat(2, auto);
}

.ribbon-group label.col1 label,
.ribbon-group label.col2 label {
  justify-content: space-between;
}

.ribbon-group label {
  pointer-events: none;
}
.ribbon-group label input,
.ribbon-group label select,
.ribbon-group label button {
  pointer-events: all;
}

.ribbon-group label .label-txt {
  min-width: 70px;
  flex-shrink: 0;
}
.ribbon-group label .label-input {
  pointer-events: all;
  cursor: pointer;
}

/* readout */
.meta#readout {
  display: inline-block;

  font-size: 11px;
  color: var(--text-muted);
}

/* ────────────────────────────────────────
   Topbar Left / Brand / Icons
──────────────────────────────────────── */

.topbar-left {
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.app-name {
  font-size: 15px;
  font-weight: 600;
}

.app-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* 중앙 파일명 */
.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* 우측 아이콘 */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-input-hover);
}

/* ────────────────────────────────────────
   Workspace / Toolbox / Canvas
──────────────────────────────────────── */

.app-root.cs-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--bg-workspace);
  overflow: hidden;
}

/* 좌측 툴박스 */
.toolbox {
  flex: 0 0 60px;
  max-width: 60px;
  background: var(--bg-toolbox);
  border-right: 1px solid var(--border-toolbox);
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  gap: 6px;
}

.tool-btn {
  border: none;
  background: var(--toolbtn-bg);
  color: var(--text-primary);
  fill: var(--text-primary);
  width: 100%;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.tool-btn svg {
  width: 30px;
  height: 30px;
  transform: scaleX(-1);
}

.tool-btn:hover {
  background: var(--toolbtn-bg-hover);
}
.tool-btn.active {
  background: var(--checkbox-bg-checked);
  color: var(--text-primary);
  font-weight: 600;
}

.tool-btn2 {
  border: none;
  background: var(--toolbtn-bg);
  color: var(--text-primary);
  fill: var(--text-primary);
  width: 100%;
  height: 32px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  position: relative;
}
.tool-btn2 svg {
  width: 30px;
  height: 30px;
  scale: 0.8;
  /* transform: scaleX(-1); */
}

.tool-btn2.disabled {
  /* pointer-events: none; */
  cursor: not-allowed !important;
  opacity: 0.5;
}

.tool-btn2 .btn-lock {
  right: -5px !important;
  top: -5px !important;
}
.tool-btn2:hover {
  background: var(--toolbtn-bg-hover);
}
.tool-btn2.active {
  background-color: #0b8e4f;
}

/* 중앙 Canvas 영역 */
.canvas-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.canvas-header {
  height: 26px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border-canvas-header);
  background: var(--bg-canvas-header);
  display: flex;
  align-items: center;
}

.canvas-title {
  font-size: 11px;
  color: var(--text-muted);
}

/* 캔버스 wrapper */
.canvas-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  /* overflow: hidden; */
  background: var(--bg-canvas);
  overflow: auto;
  width: 100%;
  height: 100%;
  display: block; /* flex 제거 */
  position: relative;
}

.canvas-inner {
  min-width: 100%;
  min-height: 100%;
  display: flex;
}

/* .canvas-inner {
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;

  

  box-sizing: border-box;
} */

#gridCanvas {
  display: block;
  background: transparent;

  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* ────────────────────────────────────────
   Status Bar
──────────────────────────────────────── */

.statusbar {
  /* height: 22px; */
  min-height: 0;
  padding: 5px 10px;
  background: var(--bg-statusbar);
  border-top: 1px solid var(--border-statusbar);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px 10px;
  display: flex;
  flex-wrap: wrap;
}

.shapes {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: space-around;
  align-items: center;
}

.shapes .shapes-svg {
  height: 35px;
  width: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.shapes .shapes-svg svg {
  width: 100%;
  height: auto;
  display: block; /* 밑에 여백 방지용 */
}

/* ────────────────────────────────────────
   Theme Toggle Switch
──────────────────────────────────────── */

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 55px;
  height: 24px;
  padding: 3px 6px;
  border-radius: 24px;
  background: var(--toggle-track-bg);
  box-sizing: border-box;
  cursor: pointer;
  color: var(--toggle-icon-color);
  transition: background var(--theme-transition), color var(--theme-transition);
}

.theme-toggle input {
  display: none;
}

.theme-toggle label {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  cursor: pointer;
}

/* inline SVG */
.theme-toggle .theme-icon {
  width: 14px;
  height: 14px;
}
.theme-toggle .theme-icon path {
  fill: var(--toggle-icon-color);
}

/* 손잡이 */
.theme-toggle .toggle-bg {
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--toggle-knob-bg);
  transition: transform 0.25s ease, background var(--theme-transition);
  z-index: 1;
}

/* 위치 (왼쪽/오른쪽) */
#theme-dark:checked ~ .toggle-bg {
  transform: translateX(0);
}
#theme-light:checked ~ .toggle-bg {
  transform: translateX(28px);
}

/* ────────────────────────────────────────
   normalize.css (필요 최소만 유지)
──────────────────────────────────────── */

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
}
main {
  display: block;
}
h1 {
  font-size: 2em;
  margin: 0.67em 0;
}
hr {
  box-sizing: content-box;
  height: 0;
  overflow: visible;
}
pre {
  font-family: monospace, monospace;
  font-size: 1em;
}
a {
  background-color: transparent;
}
abbr[title] {
  border-bottom: none;
  text-decoration: underline;
  text-decoration: underline dotted;
}
b,
strong {
  font-weight: bolder;
}
code,
kbd,
samp {
  font-family: monospace, monospace;
  font-size: 1em;
}
small {
  font-size: 80%;
}
sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub {
  bottom: -0.25em;
}
sup {
  top: -0.5em;
}
img {
  border-style: none;
}
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}
button,
input {
  overflow: visible;
}
button,
select {
  text-transform: none;
}
[type="button"],
[type="reset"],
[type="submit"],
button {
  -webkit-appearance: button;
}
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner,
button::-moz-focus-inner {
  border-style: none;
  padding: 0;
}
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring,
button:-moz-focusring {
  outline: 1px dotted ButtonText;
}
fieldset {
  padding: 0.35em 0.75em 0.625em;
}
legend {
  box-sizing: border-box;
  color: inherit;
  display: table;
  max-width: 100%;
  padding: 0;
  white-space: normal;
}
progress {
  vertical-align: baseline;
}
textarea {
  overflow: auto;
}
[type="checkbox"],
[type="radio"] {
  box-sizing: border-box;
  padding: 0;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}
[type="search"] {
  -webkit-appearance: textfield;
  outline-offset: -2px;
}
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}
::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}
details {
  display: block;
}
summary {
  display: list-item;
}
template {
  display: none;
}
[hidden] {
  display: none;
}

/* ────────────────────────────────────────
   Form / Controls
──────────────────────────────────────── */

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
}

button {
  cursor: pointer;
}

/* 기본 input / select / textarea */
input,
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 3px;
  padding: 2px 6px;
  height: 24px;
  line-height: 1.4;
  box-sizing: border-box;
}
input[type="range"] {
  padding: 2px 0;
}

input[type="color"] {
  padding: 0;
  min-width: 50px;
  width: 100%;
  cursor: pointer;
}

/* 포커스 */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  outline-offset: 0;
  z-index: 1;
}

/* hover */
input:hover,
select:hover,
textarea:hover {
  border-color: var(--bg-input-hover);
}

/* 비활성화 */
input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
}

/* 숫자 input – 스핀버튼 제거 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  width: 80px;
  padding-right: 20px;
}

/* 날짜/시간 계열 input */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  display: none;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
}

/* iOS Safari */
@supports (-webkit-touch-callout: none) {
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="month"] {
    min-height: 24px;
  }
}

/* 날짜 선택 아이콘 색 반전 (어두운 배경용) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(0.9);
  cursor: pointer;
}

/* textarea */
textarea {
  height: auto;
  min-height: 40px;
  resize: vertical;
}

/* select 공통 스타일 + 화살표 */
select {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;

  padding-right: 20px;
  background-color: var(--bg-input);

  background-image: linear-gradient(
      45deg,
      transparent 50%,
      var(--text-primary) 50%
    ),
    linear-gradient(135deg, var(--text-primary) 50%, transparent 50%);
  background-position: calc(100% - 11px) 9px, calc(100% - 6px) 9px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ────────────────────────────────────────
   Radio
──────────────────────────────────────── */
/* 기본 상태 */
input[type="radio"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-input);
  background: var(--bg-input); /* 내부 배경 */
  box-shadow: 0 0 0 1px #000 inset;

  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

/* hover */
input[type="radio"]:hover {
  border-color: #7f8598;
}

/* 체크됨 */
input[type="radio"]:checked {
  background: var(--checkbox-bg-checked); /* 기존 Show Axis 와 동일한 골드 */
  border-color: var(--checkbox-bg-checked);
}

/* 포커스(키보드 포커스) */
input[type="radio"]:focus-visible {
  outline: none;
  /* box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(223, 154, 54, 0.7); */
}
/* ────────────────────────────────────────
   Checkbox
──────────────────────────────────────── */

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;

  width: 14px;
  height: 14px;
  padding: 0;
  margin: 0;

  border-radius: 3px;
  border: 1px solid var(--border-input);
  background: var(--bg-input);

  display: inline-block;
  position: relative;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.2s ease, border-color 0.2s ease;
}

input[type="checkbox"]:checked {
  background: var(--checkbox-bg-checked);
  border-color: var(--checkbox-bg-checked);
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 6px;
  height: 9px;
  border-right: 1.5px solid var(--checkbox-tick-color);
  border-bottom: 1.5px solid var(--checkbox-tick-color);
  transform: rotate(45deg);
}

/* label 옆 정렬용 */
label > input[type="checkbox"] {
  /* margin-left: 4px; */
  margin-right: 4px;
}

/* ────────────────────────────────────────
   Number Input + Custom Spinner
──────────────────────────────────────── */

.number-input {
  width: 100%;
  height: max-content;
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 3px;
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.number-input-field {
  flex: 1;
  padding: 4px 8px;
  border: 0;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  background: transparent;
}

/* 오른쪽 스피너 영역 */
.number-input-spinner {
  display: flex;
  flex-direction: column;
  width: 18px;
  border-left: 1px solid var(--border-input);
  background: var(--bg-input);
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  z-index: 1;
}

/* 공통 버튼 스타일 */
.number-input-spinner button {
  flex: 1;
  border: 0;
  margin: 0;
  padding: 0;
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}

.number-input-spinner button:hover {
  background: var(--bg-input-hover);
}

/* 위/아래 삼각형 */
.number-input-spinner .btn-up::before,
.number-input-spinner .btn-down::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.number-input-spinner .btn-up {
  border-bottom: 1px solid var(--border-input);
}

/* ▲ */
.number-input-spinner .btn-up::before {
  border-bottom: 6px solid var(--text-primary);
}

/* ▼ */
.number-input-spinner .btn-down::before {
  border-top: 6px solid var(--text-primary);
}
/* ─────────────────────────────────────────────
   3) 공통 스타일
────────────────────────────────────────────── */
.btn-lock {
  position: absolute;
  top: -10px;
  right: -10px;
}

.btn-lock svg {
  fill: none;
  transform: translate3d(0, 0, 0);
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

/* 반짝이 */
.btn-lock svg .bling {
  stroke: var(--lock-blink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 3;
  stroke-dashoffset: 15;
  transition: all 0.3s ease;
}

/* 외곽 락 */
.btn-lock svg .lock {
  stroke: var(--lock-color);
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 32;
  transition: all 0.4s ease;
}

/* 몸통 */
.btn-lock svg .lockb {
  fill: var(--lock-color);
  fill-rule: evenodd;
  clip-rule: evenodd;
  transform: rotate(8deg);
  transform-origin: 14px 20px;
  transition: all 0.2s ease;
}

/* ─────────────────────────────────────────────
   4) Active 상태 (tool-btn2 / ribbon-btn)
────────────────────────────────────────────── */
.tool-btn2.active .btn-lock svg,
.ribbon-btn.active .btn-lock svg {
  opacity: 1;
}

.tool-btn2.active .btn-lock svg .bling,
.ribbon-btn.active .btn-lock svg .bling {
  animation: bling6132 0.3s linear forwards;
  animation-delay: 0.2s;
  stroke: var(--lock-blink-active);
}

.tool-btn2.active .btn-lock svg .lock,
.ribbon-btn.active .btn-lock svg .lock {
  stroke: var(--lock-color-active);
  stroke-dasharray: 48;
  animation: locked 0.3s linear forwards;
}

.tool-btn2.active .btn-lock svg .lockb,
.ribbon-btn.active .btn-lock svg .lockb {
  fill: var(--lock-color-active);
  transform: rotate(0);
  transform-origin: 14px 22px;
}

/* ─────────────────────────────────────────────
   5) 애니메이션
────────────────────────────────────────────── */
@keyframes bling6132 {
  50% {
    stroke-dasharray: 3;
    stroke-dashoffset: 12;
  }
  100% {
    stroke-dasharray: 3;
    stroke-dashoffset: 9;
  }
}

@keyframes locked {
  0% {
    stroke-dasharray: 32;
  }
  100% {
    stroke-dasharray: 48;
  }
}
/* ────────────────────────────────────────
   Modal / Overlay (공통)
──────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal {
  background: var(--modal-bg);
  color: var(--modal-text);
  border-radius: var(--modal-radius);
  padding: var(--modal-padding-y) var(--modal-padding-x);
  width: 480px;
  max-width: 90%;
  box-shadow: var(--modal-shadow);
  animation: fadeIn 0.25s ease;
  position: relative;
}

.modal.save-slots-modal {
  width: 640px;
  max-width: 90%;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--modal-close-color);
}
.modal-close:hover {
  color: #ff1f53;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ────────────────────────────────────────
   Help Modal (Keyboard Manual)
──────────────────────────────────────── */

.modal.help-modal {
  width: 560px;
  max-width: 92%;
  max-height: 80vh;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 내부 .help-body에서 스크롤 */
}

.help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-right: 34px; /* close 버튼 공간 */
  margin-bottom: 10px;
}

.help-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--modal-text);
}

.help-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.help-body {
  overflow: auto;
  padding-right: 4px;
  border-top: 1px solid var(--slot-border);
  margin-top: 10px;
  padding-top: 12px;
}

/* help-body 전용 스크롤바 (전역 스크롤바가 이미 있으면 생략해도 됨) */
.help-body::-webkit-scrollbar {
  width: 8px;
}
.help-body::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
.help-body::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 6px;
}
.help-body::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

.help-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--slot-border);
}
.help-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.help-h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.help-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.help-keys {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 190px;
}

.help-desc {
  flex: 1;
  font-size: 12px;
  color: var(--modal-text);
  opacity: 0.9;
}

.help-plus {
  font-size: 11px;
  opacity: 0.7;
  margin: 0 2px;
}

.help-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  min-width: 24px;
  border-radius: 7px;
  border: 1px solid var(--border-input);
  background: var(--btn-bg);
  color: var(--modal-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  font-size: 11px;
  line-height: 1;
  user-select: none;
}

:root[data-theme="light"] .help-kbd {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.help-kbd.wide {
  min-width: 52px;
  padding: 4px 10px;
}
.help-kbd.xwide {
  min-width: 72px;
  padding: 4px 12px;
}

.help-arrows {
  display: inline-flex;
  gap: 4px;
}

/* ────────────────────────────────────────
   Save Slots Popup (중복 제거 정리본)
──────────────────────────────────────── */

.save-slots-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--slot-desc-text);
}

.save-slots-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.save-slot-item {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--slot-border);
  background: var(--slot-bg);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--slot-text);
  box-shadow: var(--slot-shadow);
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.save-slot-item:hover {
  box-shadow: 0 0 0 2px rgba(0, 120, 255, 0.6);
  transform: translateY(-2px);
}

.save-slot-item.empty {
  background: var(--slot-empty-bg);
  color: var(--slot-empty-text);
  font-style: italic;
}

.save-slot-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-slot-index {
  font-weight: 600;
  font-size: 12px;
  opacity: 0.9;
}

.save-slot-label {
  font-weight: 600;
  font-size: 13px;
}

.save-slot-date {
  font-size: 11px;
  color: var(--slot-date-text);
}

/* ✅ 중복 제거: save-warning는 1번만 */
.save-warning {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
}

/* ✅ 테마별 색은 여기서만 */
:root[data-theme="light"] .save-warning {
  color: #d9534f;
}
:root:not([data-theme="light"]) .save-warning {
  color: #ff8080;
}

.save-warning-small {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 10px;
}

.save-warning-note {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.9;
}

.toolbox .tool-divider {
  width: calc(100% - 12px);
  height: 1.2px;
  margin: 5px auto;
  border-radius: 2px;
  background: var(--tool-divider-color);
}

/* 기본: 선택 아이콘만 */
#tool-box-select .icon-pan {
  display: none;
}

#tool-box-select .icon-select {
  display: inline-flex;
}

/* pan-mode 일 때: 팬 아이콘만 보이게 */
#tool-box-select.pan-mode .icon-select {
  display: none;
}

#tool-box-select.pan-mode .icon-pan {
  display: inline-flex;
}

/* 필요하면 정렬용 */
#tool-box-select .tool-icon svg {
  width: 100%;
  height: 100%;
}

/* Hover Tooltip */
.ui-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;

  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;

  padding: 8px 10px;
  border-radius: 10px;

  background: rgba(0, 0, 0, 0.85);
  color: #fff;

  font-size: 12px;
  line-height: 1.25;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-width: 260px;
  white-space: nowrap;
}

.ui-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.ui-tooltip .tt-title {
  font-weight: 700;
}

.ui-tooltip .tt-sub {
  opacity: 0.85;
  margin-top: 4px;
  white-space: normal;
}

/* Alt 단축키 오버레이 배지 */
.hotkey-badge {
  position: fixed;
  z-index: 99998;
  pointer-events: none;
  padding: 3px 7px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transform: translate(6px, -8px);
}
.hotkey-badge .hk {
  font-weight: 900;
}
.hotkey-badge .desc {
  font-weight: 600;
  opacity: 0.85;
  margin-left: 6px;
  white-space: nowrap;
}

/* =========================================================
   SEO Content (Final – Ultra Compact & Non-Intrusive)
   ========================================================= */

.seo-content {
  /* max-width: 1100px; */
  margin: 10px auto;
  padding: 6px 8px;

  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.01)
  );

  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;

  opacity: 0.88;
}

/* ─────────────────────────────────────────────
   Toggle Button (Ultra Compact)
───────────────────────────────────────────── */

.seo-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 2px 6px; /* ultra-compact */
  margin: 0;

  background: transparent;
  border: 0;
  border-radius: 6px;

  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1px;

  cursor: pointer;
  opacity: 0.78;
  gap: 5px;
}

.seo-toggle:hover {
  background: rgba(255, 255, 255, 0.035);
  opacity: 0.95;
}

.seo-toggle:focus-visible {
  outline: 1.5px solid rgba(120, 160, 255, 0.5);
  outline-offset: 2px;
}

.seo-toggle .chev {
  font-size: 10px;
  opacity: 0.55;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

/* ─────────────────────────────────────────────
   Body
───────────────────────────────────────────── */

.seo-body {
  margin-top: 6px;
  padding: 0 2px;
}

/* Headings */
.seo-body h2 {
  font-size: 12.5px;
  margin: 6px 0 4px;
  font-weight: 700;
}

.seo-body h3 {
  font-size: 11.8px;
  margin: 8px 0 4px;
  font-weight: 600;
  opacity: 0.9;
}

/* Text */
.seo-body p {
  margin: 3px 0 6px;
  opacity: 0.85;
}

/* Lists */
.seo-body ul {
  margin: 4px 0 8px 14px;
  padding: 0;
}

.seo-body li {
  margin: 2px 0;
  padding-left: 2px;
  opacity: 0.85;
}

/* Links */
.seo-body a {
  color: #8ab4ff;
  text-decoration: none;
}

.seo-body a:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────────
   Collapsed / Expanded State
───────────────────────────────────────────── */

.seo-content.seo-collapsed .seo-body {
  display: none;
}

.seo-content.seo-collapsed .seo-toggle .chev {
  transform: rotate(0deg);
}

.seo-content:not(.seo-collapsed) .seo-toggle .chev {
  transform: rotate(180deg);
  opacity: 0.85;
}

/* ─────────────────────────────────────────────
   Responsive Safety
───────────────────────────────────────────── */

@media (max-width: 900px) {
  /* .seo-content {
    margin: 8px 8px 0;
    font-size: 11.5px;
  } */

  .seo-toggle {
    font-size: 10px;
  }
}

/* wrapper (absolute 기준) */
.imgbox-shape {
  position: relative; /* ✅ absolute 기준 */
  display: flex;
  align-items: center;
  gap: 6px;
}

.imgbox-main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* help button (base) */
.imgbox-help-btn {
  position: absolute;
  right: -10px;
  top: -10px;

  width: 24px;
  height: 24px;
  padding: 0;

  display: grid;
  place-items: center;

  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;

  cursor: pointer;
  user-select: none;

  /* ✅ 공통: 버튼 형태가 확실히 보이게 */
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 120ms ease, background 120ms ease,
    border-color 120ms ease, box-shadow 120ms ease;
}

.imgbox-help-btn:active {
  transform: scale(0.92);
}

/* =========================
   DARK THEME
========================= */
:root:not([data-theme="light"]) .imgbox-help-btn {
  background: var(--toolbtn-bg-hover); /* ✅ 다크 버튼 톤 */
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

:root:not([data-theme="light"]) .imgbox-help-btn:hover {
  background: var(--toolbtn-bg-active);
  border-color: rgba(255, 255, 255, 0.36);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

/* =========================
   LIGHT THEME
========================= */
:root[data-theme="light"] .imgbox-help-btn {
  background: #ffffff; /* ✅ 흰 배경으로 형태 살림 */
  color: #111827; /* ✅ 선명한 텍스트 */
  border: 1px solid rgba(0, 0, 0, 0.22);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

:root[data-theme="light"] .imgbox-help-btn:hover {
  background: rgba(0, 0, 0, 0.06); /* ✅ 살짝 음영 */
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   Image Box Lock / Help Modal (content-only)
   - No duplicate of .modal-overlay / .modal / .btn
========================================================= */

.modal.imgbox-lock-modal {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  padding: 18px 18px 16px; /* override if you want slightly tighter */
  display: flex;
  flex-direction: column;
}

/* header */
.imgbox-lock-header {
  padding-right: 34px; /* space for close button */
}

.imgbox-lock-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
}

.imgbox-lock-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.imgbox-lock-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* body */
.imgbox-lock-body {
  margin-top: 12px;
  overflow: auto;
  padding-right: 4px;
  border-top: 1px solid var(--slot-border);
  padding-top: 12px;
}

.imgbox-lock-help {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .imgbox-lock-help {
  background: rgba(0, 0, 0, 0.04);
}

.imgbox-lock-help-title {
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.imgbox-lock-help-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--modal-text);
  opacity: 0.9;
}

.imgbox-lock-check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* actions */
.imgbox-lock-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ────────────────────────────────────────
   Inspector – Base Container
──────────────────────────────────────── */

.inspector-floating {
  position: absolute;
  top: 40px;
  right: 12px;
  width: 300px;
  max-height: calc(100% - 60px);
  /* overflow-y: auto; */
  z-index: 10;

  transform: translateX(0);
  opacity: 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.inspector-floating.collapsed {
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
}

/* ────────────────────────────────────────
   Panel
──────────────────────────────────────── */

.inspector .panel-block {
  border-radius: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  overflow: hidden;
}

.inspector .panel-header {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  background: var(--panel-header-bg);
  border-bottom: 1px solid var(--panel-border);
}

.inspector .panel-content {
  padding: 10px;
  font-size: 12px;
}

/* ────────────────────────────────────────
   Field Layout (Label + Control)
──────────────────────────────────────── */

.inspector-floating .field {
  display: grid;
  grid-template-columns: 85px 1fr; /* 라벨 고정폭 */
  align-items: center;
  column-gap: 10px;
  row-gap: 6px;
  margin-bottom: 8px;
}

.inspector-floating .field:last-child {
  margin-bottom: 0;
}

.inspector-floating .field > label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* 컨트롤 래퍼 */
.inspector-floating .ins-ctrl {
  min-width: 0;
}

/* ────────────────────────────────────────
   Text / Number Inputs
──────────────────────────────────────── */

.inspector-floating input[type="number"],
.inspector-floating input[type="text"],
.inspector-floating input[type="color"] {
  width: 100%;
}

/* Size (W/H) */
.inspector-floating .ins-size-grid {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 6px 8px;
  align-items: center;
}

/* ────────────────────────────────────────
   Pivot (Radio Group) – 핵심 수정 포인트
──────────────────────────────────────── */

.inspector-floating .ins-pivot-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* 라디오 버튼 컨테이너 */
.inspector-floating .ins-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: var(--bg-input);

  color: var(--text-secondary);
  cursor: pointer;

  min-width: 0;
  overflow: visible; /* ✅ radio 잘림 방지 */
}

/* 실제 radio 원형 – 절대 줄어들지 않게 */
.inspector-floating .ins-radio input[type="radio"] {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin: 0;
}

/* 라벨 텍스트만 ellipsis */
.inspector-floating .ins-radio span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 체크 상태 */
.inspector-floating .ins-radio input[type="radio"]:checked + span {
  color: var(--text-primary);
  font-weight: 600;
}

/* ────────────────────────────────────────
   Buttons (Rotate / Z-Order)
──────────────────────────────────────── */

.inspector-floating .ins-btngrid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.inspector-floating .ins-btngrid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

/* 공통 버튼 스타일 */
.inspector-floating .ins-btn {
  height: 20px;
  padding: 0 8px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 600;

  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: var(--btn-bg);
  color: var(--text-primary);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  cursor: pointer;
  transition: background 0.2s ease;
}

.inspector-floating .ins-btn:hover {
  background: var(--btn-bg-hover);
}

.inspector-floating .ins-btn:active {
  background: var(--btn-bg-active);
}

/* ────────────────────────────────────────
   Misc
──────────────────────────────────────── */

.inspector-floating .ins-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.ins-radio input:disabled + span {
  opacity: 0.35;
}

.ins-divider {
  height: 1px;
  margin: 10px 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 1px;
  position: relative;
}

.ins-divider-text {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 8px;
  font-size: 11px;
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.35); /* 다크 배경일 때 */
  border-radius: 10px;
}

/* ────────────────────────────────────────
   UI Modal / Toast (popup.js)
   - 테마 변수(--modal-*, --btn-*, --text-*) 기반
   - 중앙 모달 + 상단 토스트(기본)
──────────────────────────────────────── */

/* Modal root */
.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 100001; /* tooltip(99999) 위 */
  display: flex;
  align-items: center;
  justify-content: center;
}
.ui-modal.hidden {
  display: none;
}

/* Backdrop */
.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(3px);
}

/* Dialog */
.ui-modal-box {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;

  background: var(--modal-bg);
  color: var(--modal-text);
  border-radius: var(--modal-radius);
  padding: 18px 18px 16px;

  box-shadow: var(--modal-shadow);
  border: 1px solid var(--slot-border);

  transform: translate3d(0, 8px, 0) scale(0.98);
  opacity: 0;
  animation: uiModalIn 140ms ease-out forwards;
}

@keyframes uiModalIn {
  to {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
  }
}

.ui-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-right: 34px; /* close 버튼 공간 */
}

.ui-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.ui-modal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.ui-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 32px;
  height: 32px;

  border: 1px solid var(--border-input);
  background: var(--btn-bg);
  color: var(--text-primary);

  border-radius: 10px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.12s ease;
}
.ui-modal-close:hover {
  background: var(--btn-bg-hover);
}
.ui-modal-close:active {
  background: var(--btn-bg-active);
  transform: scale(0.96);
}

/* Body */
.ui-modal-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--slot-border);

  overflow: auto;
  max-height: calc(100vh - 180px);
  padding-right: 4px;
}

.ui-modal-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--modal-text);
  opacity: 0.95;
}

/* Actions */
.ui-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.ui-btn {
  height: 30px;
  padding: 0 12px;

  border-radius: 10px;
  border: 1px solid var(--border-input);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;

  cursor: pointer;
  user-select: none;

  transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

.ui-btn:active {
  transform: scale(0.98);
}

.ui-btn:focus-visible {
  outline: 2px solid rgba(120, 160, 255, 0.55);
  outline-offset: 2px;
}

/* Variants */
.ui-btn-primary {
  border-color: rgba(0, 0, 0, 0);
  background: linear-gradient(180deg, #12a061 0%, #0b8e4f 100%);
  color: #ffffff;
}

.ui-btn-primary:hover {
  background: linear-gradient(180deg, #1ab070 0%, #12a061 100%);
}
.ui-btn-primary:active {
  background: linear-gradient(180deg, #0b8e4f 0%, #087a43 100%);
}

.ui-btn-secondary {
  background: var(--btn-bg);
  color: var(--text-primary);
}
.ui-btn-secondary:hover {
  background: var(--btn-bg-hover);
}

.ui-btn-danger {
  border-color: rgba(0, 0, 0, 0);
  background: linear-gradient(180deg, #ff5252 0%, #ff1f53 100%);
  color: #fff;
}
.ui-btn-danger:hover {
  background: linear-gradient(180deg, #ff6a6a 0%, #ff2f5e 100%);
}

/* Toast (default: top-center) */
.ui-toast {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%) translateY(-6px);

  z-index: 100002;
  pointer-events: none;

  max-width: min(520px, calc(100vw - 24px));
  padding: 10px 14px;

  border-radius: 999px;
  border: 1px solid var(--panel-border);

  background: rgba(30, 31, 36, 0.92);
  color: #fff;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;

  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  opacity: 0;

  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

/* light: 너무 어둡지 않게 */
:root[data-theme="light"] .ui-toast {
  background: rgba(17, 24, 39, 0.92);
}

.ui-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ui-toast.bottom {
  top: auto;
  bottom: 18px;
  transform: translateX(-50%) translateY(6px);
}
.ui-toast.bottom.show {
  transform: translateX(-50%) translateY(0);
}

.ui-toast.error {
  background: #b91c1c;
}
.ui-toast.success {
  background: #15803d;
}

/* 자동저장 */
.status-autosave {
  margin-left: 12px;
  opacity: 0.85;
  font-size: 12px;
  user-select: none;
  white-space: nowrap;
}
.status-autosave.is-saving {
  opacity: 1;
}
.status-autosave.is-saved {
  opacity: 0.95;
}
.status-autosave.is-error {
  opacity: 1;
}

/* 최소 스타일(없으면 생략 가능) */
.btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────
   Help Tabs – Soft Pill Toggle (Theme-aware)
   ───────────────────────────────────────── */

/* panel */
.help-tabpanel {
  display: none;
}
.help-tabpanel.active {
  display: block;
}

/* tabs container */
.help-tabs {
  display: inline-flex;
  gap: 4px;

  margin-top: 10px;
  padding: 4px;

  background: var(--panel-header-bg);
  border-radius: 999px;

  transition: background var(--theme-transition);
}

/* tab button */
.help-tab {
  border: 1px solid transparent;
  background: transparent;

  padding: 6px 16px;
  border-radius: 999px;

  font-size: 13px;
  font-weight: 700;

  color: var(--text-muted);
  cursor: pointer;
  user-select: none;

  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}

/* hover */
.help-tab:hover {
  color: var(--text-primary);
  background: var(--bg-input-hover);
}

/* active */
.help-tab.active {
  background: var(--panel-bg);
  color: var(--text-primary);
  border-color: var(--panel-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ───── light theme fine tuning ───── */
:root[data-theme="light"] .help-tabs {
  background: var(--panel-header-bg);
}

:root[data-theme="light"] .help-tab.active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
