/* =========================================================================
 * style.css  —  실장석 공장 UI
 * ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: #0c0d10; overflow: hidden;
  font-family: "맑은 고딕", "Malgun Gothic", sans-serif;
  color: #e8eaee; user-select: none;
}

/* 1440x960 고정 무대 (창 크기에 맞춰 scale) */
#game {
  position: absolute; left: 50%; top: 50%;
  width: 1440px; height: 960px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  background: #1a1c22;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
  overflow: hidden;
}

/* ---- 상단바 ------------------------------------------------------------ */
#topbar {
  position: absolute; left: 0; top: 0; width: 1440px; height: 44px;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: linear-gradient(#2c3040, #21242f);
  border-bottom: 1px solid #3a3f50; z-index: 20;
}
.tb-res { font-size: 14px; color: #cdd6e0; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.tb-res b, .tb-res span { color: #e8eef6; }
.tb-money { font-size: 18px; font-weight: bold; color: #ffd964; }
.tb-money span { color: #ffd964; }
.coin-fx {
  position: absolute; left: 0; top: 0; z-index: 1400;
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3a8 0 18%, #ffd964 35%, #c98b1d 100%);
  border: 1px solid #fff0a0;
  box-shadow: 0 0 8px rgba(255,217,100,0.75);
  pointer-events: none;
  will-change: transform, opacity;
}
.money-ui-fx {
  transform: translate(var(--sx), var(--sy)) scale(0.82);
  animation: money-ui-absorb .68s cubic-bezier(.2,.85,.25,1) forwards;
}
.money-ui-fx.out {
  filter: saturate(0.85) brightness(0.86);
}
@keyframes money-ui-absorb {
  0% { transform: translate(var(--sx), var(--sy)) scale(0.75); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.24); opacity: 0; }
}
.tb-tabs { display: flex; gap: 5px; margin-left: auto; }
.tab-btn {
  background: #353a4a; color: #c8cdda; border: 1px solid #454b5e;
  padding: 6px 13px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.tab-btn:hover { background: #404659; }
.tab-btn.active { background: #5a7fd0; color: #fff; border-color: #6f93e0; }
.tb-options {
  background: #2a2d38; color: #777; border: 1px solid #3a3f50;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-family: monospace;
  min-width: 34px;
}
.tb-options:hover { color: #ffd964; }
.tb-power { cursor: pointer; }
.tb-tutorial {
  background: #2a2d38; color: #8fb4e6; border: 1px solid #3a4a60;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-family: monospace;
  font-weight: bold; min-width: 28px;
}
.tb-tutorial:hover { color: #ffd964; border-color: #6f93e0; }

#tutorial-reset-dialog {
  position: absolute; inset: 0; z-index: 1650;
  align-items: center; justify-content: center;
  background: rgba(6, 8, 12, 0.62);
}
.trd-card {
  display: flex; gap: 14px; align-items: center;
  width: 460px; padding: 16px 18px;
  background: #1b1f2a; border: 1px solid #536078; border-radius: 10px;
  box-shadow: 0 18px 52px rgba(0,0,0,0.62);
}
.trd-portrait {
  width: 76px; height: 76px; flex: 0 0 76px;
  background-size: cover; background-position: center top;
  border-radius: 8px; border: 1px solid #3a4456; background-color: #11141c;
}
.trd-body { flex: 1; }
.trd-name { color: #ffd964; font-weight: bold; font-size: 13px; margin-bottom: 4px; }
.trd-text { color: #eaf2ff; font-size: 15px; margin-bottom: 12px; line-height: 1.35; }
.trd-actions { display: flex; gap: 8px; }
.trd-actions button {
  flex: 1; padding: 9px 10px; border-radius: 7px;
  border: 1px solid #48546a; background: #2b3140; color: #e7edf8;
  cursor: pointer; font-size: 13px;
}
.trd-actions button[data-trd="yes"] { background: #34507c; border-color: #5a7fd0; }
.trd-actions button:hover { background: #40516f; color: #fff; }
.options-menu {
  position: absolute; right: 12px; top: 40px; z-index: 1200; display: none;
  width: 420px; max-height: 860px; overflow-y: auto; padding: 10px; background: #1b1e26;
  border: 1px solid #444b5e; border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55);
}
.options-menu.open { display: block; }
.raid-timer {
  position: absolute; right: 12px; top: 48px; z-index: 35;
  min-width: 180px; padding: 6px 10px;
  background: rgba(20, 24, 32, 0.86);
  border: 1px solid #454b5e; border-radius: 7px;
  color: #bfc8d8; font-size: 12px; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  cursor: pointer;
  pointer-events: auto;
}
.options-menu.open + .raid-timer { top: 218px; }
.raid-timer.armed {
  color: #ffd0c0;
  border-color: #8a4a42;
  background: rgba(54, 27, 27, 0.9);
}
.opt-title {
  color: #e8eef6; font-weight: bold; font-size: 14px;
  padding: 2px 4px 8px; border-bottom: 1px solid #343a49; margin-bottom: 8px;
}
.options-menu button {
  width: 100%; background: #303545; color: #d9e0ec; border: 1px solid #454b5e;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 6px;
  text-align: left; font-size: 13px;
}
.options-menu button:hover { background: #40516f; color: #fff; }
.options-menu button[data-opt="reset"]:hover { background: #6a3535; }
.opt-message {
  display: none;
  margin: 6px 0 4px;
  padding: 7px 8px;
  border: 1px solid rgba(126, 166, 220, 0.6);
  border-radius: 6px;
  background: rgba(64, 81, 111, 0.72);
  color: #eaf2ff;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.25;
}
.opt-message.show { display: block; }
.opt-message.error {
  border-color: rgba(255, 135, 135, 0.65);
  background: rgba(106, 53, 53, 0.72);
  color: #ffe4e4;
}
.opt-file-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.opt-file-row button { margin-bottom: 0; text-align: center; font-size: 12px; padding: 8px 6px; }
.opt-save-time { color: #95a0b2; font-size: 12px; padding: 4px; }
.opt-slots { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.opt-slot-row { display: grid; grid-template-columns: 52px 1fr auto auto; align-items: center; gap: 6px; }
.opt-slot-name { color: #cfe; font-size: 12px; font-weight: bold; }
.opt-slot-time { color: #95a0b2; font-size: 11px; }
.opt-slot-row button { font-size: 11px; padding: 3px 7px; }
.opt-slot-row button[disabled] { opacity: 0.4; cursor: default; }
.opt-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 6px; }
.options-menu .opt-tab { text-align: center; margin-bottom: 0; padding: 6px; }
.options-menu .opt-tab.active { background: #40516f; border-color: #7fa6dc; color: #fff; }
.opt-pane { display: none; }
.opt-pane.active { display: block; }
.opt-key-section { padding: 8px 0; border-bottom: 1px solid #343a49; }
.opt-key-section:last-child { border-bottom: 0; }
.opt-key-section > b { display: block; margin-bottom: 7px; color: #dfe8f5; font-size: 12px; }
#opt-build-hotkeys { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; }
.opt-key-bind { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 6px; }
.opt-key-bind select {
  min-width: 0; width: 100%; padding: 5px 6px;
  border: 1px solid #454b5e; border-radius: 4px; background: #282e3b; color: #e5ebf5;
  font-size: 11px;
}
.opt-fixed-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.opt-fixed-keys span { display: grid; grid-template-columns: minmax(82px, auto) 1fr; align-items: center; gap: 7px; min-height: 24px; }
.opt-fixed-keys em { color: #abb6c8; font-size: 11px; font-style: normal; }
.options-menu kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 20px; padding: 1px 5px; border: 1px solid #566176; border-bottom-color: #78859e;
  border-radius: 4px; background: #272d39; color: #ffd964; font: bold 10px sans-serif; white-space: nowrap;
}

#new-game-dialog {
  position: absolute; inset: 0; z-index: 1600;
  align-items: center; justify-content: center;
  background: rgba(6, 8, 12, 0.68);
}
.ng-card {
  width: 520px; padding: 18px;
  background: #1b1f2a; border: 1px solid #536078; border-radius: 8px;
  box-shadow: 0 18px 52px rgba(0,0,0,0.62);
}
.ng-title { font-size: 22px; font-weight: 800; color: #f0f5ff; margin-bottom: 4px; }
.ng-sub { color: #aeb9cb; font-size: 13px; margin-bottom: 14px; }
.ng-choices { display: grid; gap: 10px; }
.ng-choices button {
  width: 100%; text-align: left; padding: 13px 14px;
  border-radius: 7px; border: 1px solid #48546a; background: #2b3140;
  color: #e7edf8; cursor: pointer;
}
.ng-choices button:hover { background: #36445f; border-color: #7fa6dc; }
.ng-choices button[disabled] { opacity: 0.42; cursor: default; filter: grayscale(0.5); }
.ng-choices button[disabled]:hover { background: #2b3140; border-color: #48546a; }
.ng-choices b { display: block; font-size: 17px; color: #fff2a6; margin-bottom: 4px; }
.ng-choices span { display: block; color: #b9c3d3; font-size: 12px; line-height: 1.45; }
.ng-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.ng-actions button {
  padding: 8px 14px; border-radius: 6px; border: 1px solid #454b5e;
  background: #303545; color: #d9e0ec; cursor: pointer;
}

#tutorial-panel {
  position: absolute; left: 18px; bottom: 224px; z-index: 1250;
  width: 430px; padding: 13px;
  background: rgba(24, 28, 38, 0.95);
  border: 1px solid #536078; border-radius: 8px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.48);
}
.tut-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.tut-head b { color: #fff2a6; font-size: 15px; }
.tut-head span { color: #94a4ba; font-size: 11px; white-space: nowrap; }
.tut-body { color: #e7edf8; font-size: 13px; line-height: 1.5; }
.tut-tip {
  margin-top: 8px; padding: 7px 8px; border-left: 3px solid #7fa6dc;
  background: rgba(80, 112, 155, 0.18); color: #c8d6ea;
  font-size: 12px; line-height: 1.4;
}
.tut-actions { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.tut-actions button, .tut-restore {
  padding: 7px 8px; border-radius: 6px; border: 1px solid #454b5e;
  background: #303545; color: #d9e0ec; cursor: pointer; font-size: 12px;
}
.tut-actions button:hover, .tut-restore:hover { background: #40516f; color: #fff; }
.tut-actions button[disabled] { opacity: 0.45; cursor: default; background: #292d38; color: #8b94a5; }
.tut-actions button[disabled]:hover { background: #292d38; color: #8b94a5; }
.tutorial-focus {
  position: relative;
  z-index: 3;
  outline: 3px solid #ffd84d !important;
  box-shadow: 0 0 0 3px rgba(255,216,77,0.28), 0 0 18px rgba(255,216,77,0.85) !important;
  animation: tutorialFocusPulse 0.85s ease-in-out infinite alternate;
}
@keyframes tutorialFocusPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}
#tutorial-panel.collapsed {
  width: auto; padding: 0; border: 0; background: transparent; box-shadow: none;
}
.opt-slider { display: grid; grid-template-columns: 48px 1fr 40px; align-items: center; gap: 7px; margin: 8px 0; color: #dfe8f5; font-size: 12px; }
.opt-slider input { width: 100%; }
.opt-slider b { text-align: right; color: #ffd964; }

/* ---- 화면 공통 -------------------------------------------------------- */
#screens { position: absolute; left: 0; top: 44px; width: 1440px; height: 916px; }
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }

/* ---- ① 공원 ----------------------------------------------------------- */
#screen-park { background: radial-gradient(circle at 50% 30%, #2e4a32, #1c2a1f); }
.park-field { position: absolute; left: 0; top: 0; right: 0; bottom: 130px; overflow: hidden; }
.park-creature {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  background-size: cover; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #3a2020; box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3); transition: transform .1s;
}
.park-creature:hover { transform: scale(1.15); z-index: 5; }
.capture-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 130px;
  background: rgba(15,20,16,0.85); border-top: 1px solid #3a4a3e;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.capture-info { font-size: 15px; color: #cde; }
.capture-btn {
  background: linear-gradient(#4a8f5a, #357045); color: #fff; border: none;
  padding: 10px 40px; font-size: 18px; border-radius: 8px; cursor: pointer; font-weight: bold;
}
.capture-btn:active { transform: scale(0.97); }
.gauge { width: 360px; height: 16px; background: #222; border-radius: 8px; overflow: hidden; border: 1px solid #444; }
.gauge-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #6cf, #4a8f5a); transition: width .05s linear; }
.park-creature.dragging { z-index: 20; opacity: .85; cursor: grabbing; }
.park-item {
  position: absolute; width: 30px; height: 30px; border-radius: 6px; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4); border: 2px solid rgba(255,255,255,0.4); pointer-events: none; z-index: 2;
}
.capture-boxes { position: absolute; left: 50%; transform: translateX(-50%); top: 72px; width: 138px; pointer-events: none; z-index: 6; }
.capture-box {
  position: absolute; left: 0; width: 138px; height: 72px;
  border: 3px dashed #ffd964; border-radius: 10px; background: rgba(255,217,100,0.10);
  color: #ffe9b0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; text-align: center; pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.capture-box .cb-title { margin-bottom: 5px; }
.capture-box .cb-pen {
  pointer-events: auto; max-width: 124px; font-size: 11px; padding: 2px 3px;
  background: #1a201a; color: #dfe9d8; border: 1px solid #4a6a3e; border-radius: 5px; cursor: pointer;
}
.capture-box.hot { background: rgba(120,220,160,0.34); border-color: #7fe; color: #fff; }
.park-build-btn.cap-buy { background: #3a3320; border-color: #6a5a2e; color: #ffe9b0; }
.park-build-btn.cap-buy.disabled { opacity: 0.45; cursor: default; }
.park-build { display: flex; gap: 8px; }
.park-build-btn {
  background: #2a3a2e; color: #cfe; border: 1px solid #3a5a3e; border-radius: 6px;
  padding: 5px 12px; cursor: pointer; font-size: 13px; display: flex; flex-direction: column; align-items: center;
}
.park-build-btn small { color: #9b9; font-size: 10px; }
.park-build-btn.active { background: #4a8f5a; color: #fff; border-color: #6cf; }
.upgrade-btn {
  background: #3a3f50; color: #cde; border: 1px solid #555; padding: 5px 16px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.upgrade-btn.owned { background: #2a5a3a; color: #9fe; cursor: default; }

/* ---- 우리 (도크 + 탭 공통) ------------------------------------------- */
.pen-title { font-size: 15px; font-weight: bold; padding: 8px 10px 2px; color: #cfe; }
.pen-count { color: #ffd964; }
.pen-hint { font-size: 11px; color: #889; padding: 0 10px 6px; }
.pen-grid {
  position: relative; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; overflow-y: auto; align-content: flex-start;
}
.pen-icon {
  width: 56px; height: 56px; border-radius: 8px; background-size: cover;
  background-color: #555; position: relative; cursor: grab;
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: flex-end; justify-content: center;
}
.pen-icon:hover { border-color: #7fd; }
.pen-icon.selected { border-color: #ffd964; box-shadow: 0 0 8px #ffd964; }
.pen-icon-label { font-size: 9px; background: rgba(0,0,0,0.55); padding: 0 3px; border-radius: 3px; color: #fff; }
.rubber-band { position: absolute; border: 1px dashed #ffd964; background: rgba(255,217,100,0.1); pointer-events: none; }

/* 우리 도크 (공장 화면 좌측) */
#pen-dock {
  position: absolute; left: 0; top: 0; width: 288px; height: 720px;
  background: #15171d; border-right: 1px solid #333; display: flex; flex-direction: column;
}
#pen-dock .pen-grid { flex: 1; }

/* 우리 탭 (② 화면) */
#screen-pen { background: #161820; }
.pen-tab-wrap { padding: 16px; height: 100%; display: flex; flex-direction: column; }
.pen-grid.big { flex: 1; background: #11131a; border-radius: 8px; }

/* ---- ③ 공장 ----------------------------------------------------------- */
#screen-factory { background: #15171d; }
#factory-canvas-wrap { position: absolute; left: 0; top: 0; width: 1440px; height: 720px; }
#factory-canvas { display: block; width: 1440px; height: 720px; cursor: crosshair; }

#factory-menu {
  position: absolute; left: 0; top: 720px; width: 1440px; height: 196px;
  background: linear-gradient(#23262f, #1b1d25); border-top: 1px solid #3a3f50;
  display: flex; flex-direction: column; padding: 8px;
}
.menu-cats { display: flex; gap: 8px; }
.cat-btn {
  background: #353a4a; color: #cdd; border: 1px solid #4a5165;
  padding: 8px 24px; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 15px; font-weight: bold;
}
.cat-btn:hover { background: #404659; }
.cat-btn.active { background: #5a7fd0; color: #fff; }
.menu-items { flex: 1; display: flex; gap: 8px; padding: 8px 0; overflow-x: auto; }
.menu-empty { color: #778; font-size: 14px; padding: 16px; align-self: center; }
.item-btn {
  position: relative;
  background: #2a2e3a; border: 1px solid #444b5e; border-radius: 8px;
  padding: 8px 9px; cursor: pointer; width: 176px; text-align: left; color: #dde;
  display: flex; align-items: center; gap: 9px;
}
.item-hk:not(:empty) {
  position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px;
  background: #ffd964; color: #222; font-weight: bold; font-size: 11px; line-height: 16px;
  text-align: center; border-radius: 4px; padding: 0 3px;
}
.item-power-required {
  position: absolute; right: 6px; bottom: 5px;
  color: #ffd964; font-size: 16px; line-height: 1;
  filter: drop-shadow(0 1px 2px #000);
}
.menu-hotkeys { display: flex; gap: 6px; align-items: center; min-height: 22px; margin-bottom: 2px; flex-wrap: wrap; }
.hk-hint { color: #778; font-size: 11px; }
.hk-chip { background: #2a3142; color: #cde; border: 1px solid #4a5165; border-radius: 5px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.hk-chip b { color: #ffd964; margin-right: 3px; }
.hk-chip:hover { background: #3a4456; }
.item-btn:hover { background: #343a48; border-color: #5a7fd0; }
.item-btn.active { border-color: #ffd964; box-shadow: 0 0 6px rgba(255,217,100,0.4); }
.item-thumb { display: inline-block; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 5px; background-size: cover; background-position: center; }
.item-name { min-width: 0; flex: 1; font-size: 13px; font-weight: bold; display: flex; flex-direction: column; gap: 3px; }
.item-name small { color: #9aa8ba; font-size: 11px; font-weight: normal; }
.item-cost { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 7px; min-height: 18px; font-size: 14px; line-height: 1.1; }
.item-cost:empty { display: none; }
.item-cost em { color: #9aa8ba; font-size: 11px; font-style: normal; }
.cost-money { color: #ffd964; font-weight: 800; }
.cost-res { display: inline-flex; align-items: center; gap: 3px; color: #dfe8f6; font-weight: 800; }
.cost-icon { width: 16px; height: 16px; border-radius: 3px; background-size: contain; background-position: center; background-repeat: no-repeat; }
.cost-scrap { background: #8c9aa6; }
.item-desc { font-size: 10px; color: #99a; line-height: 1.25; }
.menu-status { font-size: 13px; color: #aab; padding: 2px 4px; }
.menu-status b { color: #ffd964; }

/* ---- ④ 연구 / ⑤ 통계 공통 패널 -------------------------------------- */
.panel { padding: 24px 32px; height: 100%; overflow-y: auto; }
.panel h2 { font-size: 22px; margin-bottom: 12px; color: #cfe; }
.panel h3 { font-size: 16px; margin: 18px 0 8px; color: #bcd; }
.muted { color: #889; font-size: 14px; margin-bottom: 16px; }
#screen-research { background: #161820; }
.research-tier-board { display: flex; flex-direction: column; gap: 14px; }
.research-tier-section {
  border: 1px solid #343a49; border-radius: 8px;
  background: rgba(0,0,0,0.12); padding: 10px 12px 12px;
}
.research-tier-section > h3 {
  margin: 0 0 8px; color: #d7eef8; font-size: 15px;
  border-bottom: 1px solid #343a49; padding-bottom: 6px;
}
.research-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.research-card {
  width: 200px; background: #20242e; border: 1px solid #3a4050; border-radius: 10px; padding: 14px;
}
.research-card.locked { opacity: 0.6; }
.research-card h3 { margin: 0 0 6px; color: #cde; }
.research-card p { font-size: 12px; color: #99a; margin-bottom: 10px; }
.research-card span { color: #ffd964; font-weight: bold; }
.rc-tier { display: inline-block; color: #7fd5ff; font-size: 11px; margin-bottom: 4px; }
.research-status {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px; background: rgba(0,0,0,0.2);
  border: 1px solid #343a49; border-radius: 6px;
}
.research-current { display: flex; gap: 10px; align-items: center; color: #dfe8f6; }
.research-current span { color: #ffd964; font-size: 12px; }
.research-current button, .research-chip {
  border: 1px solid #596276; background: #252b37; color: #dfe8f6;
  border-radius: 5px; padding: 4px 7px; cursor: pointer;
}
.research-queued { display: flex; gap: 6px; flex-wrap: wrap; }
.research-queue-strip {
  position: absolute; left: 14px; top: 48px; z-index: 35;
  width: 330px; min-height: 34px; padding: 6px 8px;
  border: 1px solid #454b5e; border-radius: 7px;
  background: rgba(20,24,32,0.88);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  color: #cbd5e6; font-size: 11px;
}
.rq-empty { color: #7f8998; }
.rq-main { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.rq-name { color: #e8eef6; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-pct { color: #ffd964; font-weight: bold; text-align: right; }
.rq-pct button {
  margin-left: 5px; padding: 1px 5px;
  border: 1px solid #596276; border-radius: 4px;
  background: #252b37; color: #dfe8f6;
  font-size: 10px; cursor: pointer;
}
.rq-pct button:hover { border-color: #ffd964; color: #ffd964; }
.rq-bar { grid-column: 1 / 3; height: 5px; border-radius: 999px; background: #303747; overflow: hidden; }
.rq-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5aa8ff, #8fe8ff); }
.rq-num { color: #9aa8ba; font-size: 10px; }
.rq-queued-top { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.rq-next {
  border: 1px solid #4d566a; border-radius: 4px; padding: 2px 5px;
  background: #252b37; color: #b8c4d4; font-size: 10px; cursor: pointer;
}
.rq-next:hover { border-color: #ffd964; color: #ffd964; }
.rq-main.idle { grid-template-columns: 1fr auto; }
.rc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 13px; color: #cde; }
.rc-foot b { color: #ffd964; }
.rc-buy { background: #3a3f50; color: #ccd; border: 1px solid #555; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.rc-buy.afford { background: linear-gradient(#caa23a, #a8842a); color: #1a1407; font-weight: bold; }
.rc-buy.owned { background: #2a5a3a; color: #9fe; border-color: #4a8f5a; cursor: default; }
.rc-buy:hover { filter: brightness(1.1); }

#screen-stats { background: #161820; }
.stat-big { font-size: 20px; margin: 8px 0; }
.stat-big b { color: #6cf; font-size: 26px; }
.stat-sub { color: #99a; font-size: 13px; margin-bottom: 8px; }
.warehouse-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: start; }
.wh-item { display: flex; flex-direction: column; gap: 6px; background: #20242e; padding: 8px 11px; border-radius: 8px; min-width: 0; }
.wh-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wh-bot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.wh-count { color: #aab; font-size: 12px; flex-shrink: 0; }
.wh-total { color: #ffd964; font-weight: bold; flex-shrink: 0; margin-left: auto; }
.wh-dot { width: 14px; height: 14px; border-radius: 50%; }
.res-icon, .wh-icon, .shop-icon, .mini-icon {
  display: inline-block; flex: 0 0 auto; background-repeat: no-repeat;
  image-rendering: auto; vertical-align: middle;
}
.res-icon { width: 18px; height: 18px; }
.wh-icon { width: 24px; height: 24px; border-radius: 5px; }
.shop-icon { width: 28px; height: 28px; }
.mini-icon { width: 16px; height: 16px; margin-right: 5px; }
.creature-ui-icon { background-repeat: no-repeat; }
.wh-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wh-item b { color: #ffd964; }

/* ---- 떠다니는 요소 --------------------------------------------------- */
.drag-ghost {
  position: fixed; z-index: 999; pointer-events: none;
  background: rgba(255,217,100,0.9); color: #222; padding: 4px 10px;
  border-radius: 6px; font-size: 13px; font-weight: bold; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.creature-info {
  position: absolute; z-index: 900; display: none;
  background: #20242e; border: 1px solid #4a5165; border-radius: 8px;
  padding: 8px 10px; min-width: 120px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
.ci-head { font-weight: bold; font-size: 14px; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 2px solid #888; }
.ci-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.ci-row span { color: #99a; }
.ci-row b { color: #fff; }
.cheat-flash {
  position: absolute; left: 50%; top: 60px; transform: translateX(-50%);
  background: rgba(255,217,100,0.95); color: #222; padding: 10px 24px;
  border-radius: 8px; font-weight: bold; font-size: 16px; z-index: 1600;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.cheat-flash.show { opacity: 1; }

/* ---- 오버레이 (우리/연구/통계) -------------------------------------- */
#overlay-root {
  position: absolute; inset: 0; z-index: 500; display: none;
  align-items: center; justify-content: center;
}
.ovl-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.ovl-panel {
  position: relative; display: none; flex-direction: column;
  width: 1080px; max-width: 96%; height: 800px; max-height: 92%;
  background: #1b1e26; border: 1px solid #3a4050; border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6); overflow: hidden;
}
.ovl-panel.active { display: flex; }
.ovl-head {
  font-size: 20px; font-weight: bold; color: #cfe; padding: 14px 18px;
  background: #232733; border-bottom: 1px solid #3a4050; display: flex; align-items: center;
}
.ovl-close {
  margin-left: auto; background: #3a3f50; color: #ccd; border: 1px solid #555;
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.ovl-close:hover { background: #5a3f3f; color: #fbb; }
.ovl-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.ovl-body h3 { font-size: 16px; margin: 16px 0 8px; color: #bcd; }

/* 우리 오버레이 */
.pen-res { font-size: 15px; color: #cde; margin-bottom: 10px; }
.pen-res b { color: #ffd964; }
.pen-cols { display: flex; gap: 18px; }
.pen-col { flex: 1; display: flex; flex-direction: column; min-height: 560px; }
.pen-col h3 { display: flex; justify-content: space-between; }
.pen-col h3 span { color: #ffd964; }
.pen-col .pen-grid.big { flex: 1; background: #11131a; border-radius: 8px; margin-top: 6px; min-height: 480px; }
.wander-field { position: relative; flex: 1; background: #11131a; border-radius: 8px; margin-top: 6px; min-height: 480px; overflow: hidden; }
.pen-icon.wander { position: absolute; width: 40px; height: 40px; }
.pen-grade { position: absolute; top: -2px; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: bold; text-shadow: 0 1px 2px #000; }
.pen-stats { position: absolute; bottom: -1px; left: 0; right: 0; text-align: center; font-size: 8px; color: #fff; background: rgba(0,0,0,0.5); border-radius: 0 0 6px 6px; }

/* 판매 버튼 */
.sell-btn { margin-left: 12px; background: linear-gradient(#caa23a, #a8842a); color: #1a1407; border: none; padding: 8px 22px; border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; }
.sell-btn:hover { filter: brightness(1.1); }
.sell-btn:active { transform: scale(0.97); }

/* 가격 편집 */
.price-editor { display: flex; flex-direction: column; gap: 8px; }
.price-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #20242e; padding: 8px 12px; border-radius: 8px; }
.price-row > b { min-width: 70px; }
.price-row label { font-size: 12px; color: #aab; display: flex; align-items: center; gap: 4px; }
.price-row input {
  width: 64px; background: #11131a; border: 1px solid #444b5e; color: #fff;
  border-radius: 5px; padding: 3px 6px; font-size: 13px;
}
.item-name small { color: #889; font-weight: normal; font-size: 10px; }
.price-vals { color: #aab; font-size: 12px; }

/* ---- 필터 패널 (분류기/집게) --------------------------------------- */
#filter-panel {
  position: absolute; z-index: 400; width: 330px;
  background: #20242e; border: 1px solid #5a7fd0; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
.fp-title { font-size: 13px; font-weight: bold; color: #cfe; margin-bottom: 2px; }
.fp-hint { font-size: 10px; color: #889; margin-bottom: 6px; }
.fp-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.fp-btn {
  display: flex; align-items: center; gap: 5px; cursor: pointer; text-align: left;
  background: #2a2e3a; border: 1px solid #444b5e; color: #cdd;
  border-radius: 5px; padding: 4px 6px; font-size: 11px; white-space: nowrap; overflow: hidden;
}
.fp-btn:hover { background: #343a48; }
.fp-btn.active { background: #5a7fd0; color: #fff; border-color: #7f9fe0; }
.fp-btn .di-item-icon { width: 16px; height: 16px; flex-shrink: 0; }
.fp-btn-name { overflow: hidden; text-overflow: ellipsis; }
.fp-cat { grid-column: 1 / -1; font-size: 10px; font-weight: bold; color: #8fa6c8; margin: 5px 0 1px; padding-bottom: 2px; border-bottom: 1px solid #3a4050; }
.fp-cat:first-child { margin-top: 0; }
.fp-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.fp-lane { display: none; align-items: center; gap: 4px; margin-top: 7px; padding-top: 7px; border-top: 1px solid #3a4050; font-size: 11px; color: #aab; flex-wrap: wrap; }
.fp-lane span { width: 100%; margin-bottom: 2px; }
.fp-lane-btn { flex: 1; background: #2a2e3a; border: 1px solid #444b5e; color: #cdd; border-radius: 5px; padding: 4px; cursor: pointer; font-size: 12px; }
.fp-lane-btn:hover { background: #343a48; }
.fp-lane-btn.active { background: #5a7fd0; color: #fff; border-color: #7f9fe0; }
.fp-stat { margin-top: 7px; padding-top: 7px; border-top: 1px solid #3a4050; font-size: 11px; color: #aab; }
.fp-stat > span { display: block; margin-bottom: 3px; }
.fp-stat-row { display: flex; gap: 3px; margin-bottom: 3px; flex-wrap: wrap; }
.fp-st, .fp-op { flex: 1; background: #2a2e3a; border: 1px solid #444b5e; color: #cdd; border-radius: 5px; padding: 3px; cursor: pointer; font-size: 11px; }
.fp-st:hover, .fp-op:hover { background: #343a48; }
.fp-st.active, .fp-op.active { background: #5a7fd0; color: #fff; border-color: #7f9fe0; }
#fp-statval { width: 52px; background: #11131a; border: 1px solid #444b5e; color: #fff; border-radius: 5px; padding: 3px; font-size: 12px; }
#fp-statval:disabled { opacity: 0.45; }
.fp-prio { display: none; margin-top: 7px; padding-top: 7px; border-top: 1px solid #3a4050; font-size: 11px; color: #aab; }
.fp-prio > span { display: block; margin-bottom: 3px; }
.fp-prio-row { display: flex; gap: 3px; }
.fp-prio-btn { flex: 1; background: #2a2e3a; border: 1px solid #444b5e; color: #cdd; border-radius: 5px; padding: 4px; cursor: pointer; font-size: 12px; }
.fp-prio-btn:hover { background: #343a48; }
.fp-prio-btn.active { background: #5a7fd0; color: #fff; border-color: #7f9fe0; }

#land-prompt, #device-info {
  position: absolute; z-index: 460; width: 276px;
  background: #20242e; border: 1px solid #5a7fd0; border-radius: 8px;
  padding: 9px; box-shadow: 0 4px 14px rgba(0,0,0,0.62); color: #dce6f5;
}
#land-prompt { width: 340px; }
.lp-title, .di-head { font-size: 13px; font-weight: bold; color: #e9f4ff; margin-bottom: 5px; }
.lp-body, .di-desc { font-size: 12px; line-height: 1.45; color: #c7d2df; }
.lp-env { margin-top: 8px; padding: 8px; background: #151922; border: 1px solid #3d485c; border-radius: 6px; font-size: 11px; line-height: 1.45; }
.lp-env-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.lp-env-head b { color: #fff2a6; font-size: 14px; }
.lp-env-head span { color: #9fb4cf; }
.lp-env-scope { color: #a9bfdc; margin-bottom: 5px; }
.lp-env-buff { color: #aee0bd; }
.lp-env-debuff { color: #ffb3aa; margin-top: 2px; }
.lp-env-future { color: #8e99aa; margin-top: 5px; padding-top: 5px; border-top: 1px solid #303747; }
.lp-price { margin: 7px 0; color: #ffd964; font-weight: bold; }
.lp-actions { display: flex; gap: 6px; }
.lp-actions button, .di-close {
  background: #2a3142; border: 1px solid #4a5165; color: #dfe8f5;
  border-radius: 5px; padding: 5px 10px; cursor: pointer;
}
.lp-actions button:hover, .di-close:hover { background: #3a4456; }
.di-head { display: flex; justify-content: space-between; align-items: center; }
.di-close { padding: 1px 7px; font-size: 13px; }
.di-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 7px; }
.di-meta span {
  background: #11131a; border: 1px solid #394153; border-radius: 4px;
  color: #9fb4cf; padding: 2px 5px; font-size: 10px;
}
.di-state { margin-top: 7px; padding-top: 7px; border-top: 1px solid #394153; font-size: 11px; color: #aee0bd; }
.di-extra { margin-top: 7px; padding-top: 7px; border-top: 1px solid #394153; display: flex; flex-direction: column; gap: 3px; }
.di-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; line-height: 1.35; }
.di-row span { color: #94a4b8; flex: 0 0 auto; }
.di-row b { color: #eaf2ff; font-weight: normal; text-align: right; overflow-wrap: anywhere; }
.di-inv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #394153;
}
.di-inv-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px 5px;
  border-radius: 5px;
  background: rgba(255,255,255,0.045);
  font-size: 11px;
}
.di-inv-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.di-inv-item b { color: #eaf2ff; font-weight: bold; }
.di-item-icon {
  width: 18px; height: 18px; border-radius: 4px;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.di-inv-empty {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid #394153;
  color: #94a4b8; font-size: 11px;
}
.di-actions { margin-top: 8px; padding-top: 7px; border-top: 1px solid #394153; display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.di-actions button {
  background: #2a3142; border: 1px solid #4a5165; color: #dfe8f5;
  border-radius: 5px; padding: 5px 10px; cursor: pointer; font-size: 11px;
}
.di-actions button:hover { background: #3a4456; }
.di-actions button.active { background: #2d6f56; border-color: #6ee0b6; color: #f4fff9; }
.di-desc-sub { font-size: 11px; color: #aebbd0; margin: 3px 0 0; }
/* 콜로니 퀘스트 보드 */
.di-quest-head { margin: 9px 0 4px; font-size: 12px; font-weight: bold; color: #ffd964; border-top: 1px solid #394153; padding-top: 7px; }
.di-quest { background: #232a38; border-left: 3px solid #888; border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; }
.di-quest-org { font-size: 12px; font-weight: bold; margin-bottom: 2px; }
.di-quest-req { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #e6edf6; }
.di-quest-req small { color: #9fb0c4; }
.di-quest-reward { font-size: 11px; color: #cfe0b0; margin: 3px 0; }
.di-quest .di-actions { margin-top: 4px; padding-top: 4px; border: 0; justify-content: flex-start; }
.q-ok { color: #7ee08a; }
.q-no { color: #ffb35a; }
/* 미연시식 무전 패널 — 하단 대사창 + 우상단 초상 */
#midori-panel {
  position: absolute; left: 312px; bottom: 208px; z-index: 900; width: 816px;
  min-height: 118px; display: none; align-items: stretch; gap: 14px;
  background: linear-gradient(180deg, rgba(20,24,34,0.97), rgba(10,13,19,0.97));
  border: 2px solid #607a94; border-radius: 8px;
  padding: 24px 136px 20px 24px; box-shadow: 0 8px 24px rgba(0,0,0,0.65);
}
#midori-panel.show { display: flex; animation: midori-in 0.25s ease; }
@keyframes midori-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.midori-portrait {
  position: absolute; left: 1126px; bottom: 208px; z-index: 905; width: 176px; height: 220px;
  display: none; border-radius: 6px; background: #f4f4f0 center/contain no-repeat;
  border: 2px solid #607a94; box-shadow: 0 8px 18px rgba(0,0,0,0.55);
}
.midori-portrait.midori-raw {
  left: 984px; bottom: 208px; width: 344px; height: 489px;
  border: 0; border-radius: 0; box-shadow: none;
  background-color: transparent; background-size: auto; background-position: center bottom;
}
.midori-portrait.show { display: block; }
.radio-request-icon {
  position: absolute; right: 24px; top: 32px; width: 88px; height: 88px; display: none;
  background: center/contain no-repeat; opacity: 0.96;
  filter: drop-shadow(0 3px 7px rgba(0,0,0,0.65));
}
.radio-request-icon.show { display: block; }
.midori-bubble { flex: 1; }
.midori-name { font-size: 20px; font-weight: bold; color: #8fd0ff; margin-bottom: 12px; }
.midori-text { font-size: 24px; line-height: 1.42; color: #e6edf6; word-break: keep-all; }
.radio-request-text { margin-top: 10px; color: #ffd964; font-weight: 800; }
.midori-close { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: #889; font-size: 16px; cursor: pointer; }
/* 무전 직전 치지직(static) 효과 */
#radio-static {
  display: none;
  position: absolute; inset: 0; z-index: 899; pointer-events: none; opacity: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.06) 1px, rgba(0,0,0,0.10) 2px, rgba(0,0,0,0.10) 3px);
  mix-blend-mode: screen;
}
#radio-static.on, #radio-static.dialog { opacity: 1; animation: static-flicker 0.08s steps(2) infinite; }

#ending-modal {
  position: absolute; inset: 0; z-index: 260;
  align-items: center; justify-content: center;
  background: rgba(4, 7, 12, 0.78);
}
.ending-modal-box {
  width: min(560px, calc(100% - 48px));
  padding: 22px;
  border: 1px solid #8aa0bd;
  background: #171d28;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  color: #e8edf5;
}
.ending-modal-box h3 { margin: 0 0 12px; color: #ffd964; font-size: 20px; }
.ending-modal-box p { margin: 0 0 18px; line-height: 1.7; }
.ending-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ending-modal-actions button, .ending-choice-list button {
  border: 1px solid #61718a; background: #293348; color: #fff;
  padding: 10px 18px; cursor: pointer;
}
.ending-choice-list { display: grid; gap: 10px; }
.ending-choice-list button { text-align: left; font-size: 15px; }
.ending-modal-actions button:hover, .ending-choice-list button:hover { border-color: #ffd964; background: #39465f; }
.ending-records { display: flex; gap: 8px; flex-wrap: wrap; }
.ending-records button { border: 1px solid #64758f; background: #252e3e; color: #e8edf5; padding: 8px 12px; cursor: pointer; }
.ending-records button[disabled] { opacity: 0.35; cursor: default; }
#ending-cinematic {
  position: absolute; inset: 0; z-index: 400; overflow: hidden;
  align-items: center; justify-content: center; background: transparent;
}
#ending-cinematic::after {
  content: ''; position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
}
#ending-cinematic.launching { animation: ending-shake 0.08s linear infinite; }
#ending-cinematic.launching::after { animation: ending-flash 3.2s ease-in forwards; }
#ending-cinematic.blackout { background: #000 !important; animation: none; }
#ending-cinematic.blackout::after { opacity: 0 !important; animation: none !important; }
.ending-count { position: relative; z-index: 5; color: #fff; font-size: 180px; font-weight: 900; text-shadow: 0 6px 20px #000; }
.ending-earth, .ending-art {
  position: absolute; z-index: 6; max-width: 100%; max-height: 100%; object-fit: contain;
  opacity: 0; transform: scale(1.12); transition: opacity 1.5s ease, transform 10s linear;
}
.ending-earth.show { opacity: 1; transform: scale(0.45); }
.ending-art { transition: opacity 2.5s ease, transform 2.5s ease; transform: scale(1.03); }
.ending-art.show { opacity: 1; transform: scale(1); }
.ending-caption { position: absolute; z-index: 8; bottom: 58px; color: #fff; font-size: 24px; font-weight: 700; text-shadow: 0 3px 10px #000; }
.ending-finish { position: absolute; z-index: 9; right: 34px; bottom: 30px; border: 1px solid #fff; background: rgba(0,0,0,.65); color: #fff; padding: 10px 18px; cursor: pointer; }
@keyframes ending-shake { 0% { transform: translate(0,0); } 25% { transform: translate(4px,-3px); } 50% { transform: translate(-3px,4px); } 75% { transform: translate(3px,2px); } }
@keyframes ending-flash { 0% { opacity: 0; } 55% { opacity: .15; } 100% { opacity: 1; } }
@keyframes static-flicker { 0% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-2px); opacity: 0.9; } 100% { transform: translateY(1px); opacity: 0.6; } }
#midori-tooltip {
  position: absolute; z-index: 1200; display: none; align-items: center; gap: 8px;
  max-width: 280px; min-height: 58px; padding: 7px 10px;
  background: rgba(12,16,24,0.96); border: 1px solid #607a94; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.55); pointer-events: none;
}
.mt-portrait { width: 42px; height: 52px; flex: 0 0 42px; background: center bottom/contain no-repeat; }
.mt-text { color: #e6edf6; font-size: 12px; line-height: 1.35; word-break: keep-all; }
#game-notify {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%) translateY(-16px);
  z-index: 1500; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 26px; border-radius: 10px; pointer-events: none;
  background: linear-gradient(180deg, rgba(60,80,120,0.97), rgba(34,46,72,0.97));
  border: 1px solid #7fa6dc; box-shadow: 0 8px 30px rgba(0,0,0,0.55);
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
}
#game-notify.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#game-notify b { color: #ffe9a8; font-size: 17px; font-weight: 800; }
#game-notify span { color: #d6e2f4; font-size: 12px; }
#opening-vignette {
  position: absolute; inset: 0; z-index: 1400; pointer-events: auto;
  background: #000; opacity: 1;
}
/* 진행 의뢰 추적(좌상단, 연구중 창 아래) */
#quest-tracker {
  position: absolute; top: 92px; left: 12px; z-index: 350; width: 196px;
  background: rgba(18,22,30,0.9); border: 1px solid #4a6a8a; border-radius: 8px; padding: 6px 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.qt-title { font-size: 11px; font-weight: bold; color: #ffd964; margin-bottom: 4px; }
.qt-row { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: #dfe8f5; padding: 1px 0; }
.qt-org { font-weight: bold; }
.di-actions.cook-menu { justify-content: flex-start; }
.cook-menu-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 6px !important; }
.cook-menu-btn .di-item-icon { width: 22px; height: 22px; }
.cook-menu-btn small { font-size: 9px; }

/* 우리 이름 패널 */
#pen-panel {
  position: absolute; z-index: 400; width: 168px;
  background: #20242e; border: 1px solid #4a6a3a; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
#pen-name-input { width: 100%; margin-top: 5px; background: #11131a; border: 1px solid #444b5e; color: #fff; border-radius: 5px; padding: 5px 7px; font-size: 13px; }
.wh-bot .unit { color: #99a; font-size: 11px; font-weight: normal; white-space: nowrap; }
.pen-nosell { width: 100%; margin-top: 6px; background: #2a2e3a; color: #cdd; border: 1px solid #555; border-radius: 5px; padding: 6px; cursor: pointer; font-size: 12px; }
.pen-nosell.on { background: #a23a3a; color: #fff; border-color: #f77; }
.pen-nosell.on::before { content: '🚫 '; }
#blueprint-tab {
  position: absolute; right: 12px; bottom: 206px; z-index: 350; width: 150px;
  background: rgba(20,24,32,0.92); border: 1px solid #4a6a8a; border-radius: 8px 8px 0 0;
  padding: 6px 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
#linggal-btn {
  position: absolute; right: 12px; bottom: 292px; z-index: 360;
  width: 48px; height: 72px; padding: 0; cursor: pointer;
  background-color: #2a3142; background-repeat: no-repeat; background-position: center; background-size: cover;
  border: 1px solid #4a6a8a; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
#linggal-btn.off { filter: grayscale(1) brightness(0.55); border-color: #804040; }
#linggal-btn:hover { border-color: #7fc6ff; }
.bt-title { font-size: 12px; font-weight: bold; color: #bcd; margin-bottom: 4px; }
.bt-list { display: flex; flex-wrap: wrap; gap: 4px; }
.bt-hint { font-size: 10px; color: #778; }
.bt-chip { background: #2a3142; color: #cde; border: 1px solid #4a5165; border-radius: 5px; padding: 3px 7px; font-size: 11px; cursor: pointer; }
.bt-chip b { color: #6cf; margin-right: 2px; }
.bt-chip:hover { background: #3a4456; }
#birthing-panel {
  position: absolute; z-index: 400; width: 188px;
  background: #20242e; border: 1px solid #7a3a5a; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
.bp-body { margin: 4px 0 6px; }
.bp-row { display: flex; justify-content: space-between; font-size: 12px; color: #cdd; padding: 2px 0; }
.bp-row b { color: #fff; }
.bp-remove { width: 100%; background: linear-gradient(#a23a3a, #7c2c2c); color: #fff; border: none; border-radius: 6px; padding: 7px; cursor: pointer; font-size: 12px; }
.bp-remove:hover { filter: brightness(1.12); }

/* 자동 포탑 업그레이드 패널 */
#turret-panel {
  position: absolute; z-index: 400; width: 208px;
  background: #20242e; border: 1px solid #b5524a; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
.tp-info { font-size: 11px; color: #cdd; margin: 4px 0 7px; line-height: 1.5; }
.tp-info b { color: #ffd964; }
.tp-rows { display: flex; flex-direction: column; gap: 4px; }
.tp-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #cdd; }
.tp-row span { flex: 1; }
.tp-row .tp-lv { color: #9fe0c0; font-size: 11px; min-width: 32px; text-align: right; }
.tp-buy {
  min-width: 72px; background: linear-gradient(#3a6a4a, #2c5238); color: #eafff0;
  border: 1px solid #4f7; border-radius: 5px; padding: 4px 6px; cursor: pointer; font-size: 11px;
}
.tp-buy:hover:not(:disabled) { filter: brightness(1.15); }
.tp-buy:disabled { background: #2a2e3a; color: #667; border-color: #444b5e; cursor: default; }
.tp-mode { margin-top: 7px; padding-top: 7px; border-top: 1px solid #3a4050; font-size: 11px; color: #aab; display: flex; gap: 3px; flex-wrap: wrap; }
.tp-mode span { width: 100%; margin-bottom: 2px; }
.tp-mode-btn { flex: 1; background: #2a2e3a; border: 1px solid #444b5e; color: #cdd; border-radius: 5px; padding: 4px 2px; cursor: pointer; font-size: 11px; white-space: nowrap; }
.tp-mode-btn:hover { background: #343a48; }
.tp-mode-btn.active { background: #b5524a; color: #fff; border-color: #e08070; }

/* 노동석 명령 패널 */
#labor-panel {
  position: absolute; z-index: 420; width: 232px;
  background: #20242e; border: 1px solid #5ad2e1; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}

/* 창고 / 콜로니센터 인벤토리 */
.inventory-panel {
  position: absolute; z-index: 470; top: 92px; width: 328px; max-height: calc(100% - 190px);
  display: flex; flex-direction: column; background: #1c2029; border: 1px solid #52647d;
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.65); color: #dfe8f3; padding: 9px;
}
.inventory-left { left: 12px; }
.inventory-right { right: 12px; }
.inventory-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.inventory-head b { font-size: 14px; color: #f0f5fb; }
.inventory-head button { width: 25px; height: 25px; background: #292f3b; border: 1px solid #465064; color: #dce5ef; border-radius: 5px; cursor: pointer; }
.inventory-summary { color: #96a5b8; font-size: 11px; margin-bottom: 7px; }
.inventory-items { display: grid; grid-template-columns: repeat(4, 68px); grid-auto-rows: 68px; gap: 6px; overflow-y: auto; min-height: 74px; padding: 4px; background: #11151c; border: 1px solid #343c49; }
.inventory-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 68px; height: 68px; min-width: 0; padding: 4px; box-sizing: border-box; background: #272c37; border: 1px solid #4a5567; border-radius: 4px; cursor: grab; font-size: 10px; }
.inventory-item:hover { background: #323947; border-color: #68758a; }
.inventory-item:active { cursor: grabbing; }
.inventory-item .di-item-icon { width: 30px; height: 30px; flex-shrink: 0; }
.inventory-item span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: #cdd7e3; }
.inventory-item b { position: absolute; right: 4px; bottom: 3px; color: #ffe27a; font-size: 11px; text-shadow: 0 1px 2px #000; }
.inventory-empty-slot { width: 68px; height: 68px; box-sizing: border-box; background: rgba(30,35,44,0.55); border: 1px solid #2d3542; border-radius: 4px; }
.inventory-empty { grid-column: 1 / -1; color: #778397; text-align: center; padding: 18px 4px; font-size: 12px; }
.inventory-upgrade { margin-top: 8px; background: #343b49; border: 1px solid #65738a; color: #e7edf5; border-radius: 6px; padding: 7px; cursor: pointer; }
.inventory-upgrade:hover { background: #424b5c; }
@media (max-width: 760px) {
  .inventory-panel { width: min(270px, calc(100% - 24px)); max-height: 40%; }
  .inventory-items { grid-template-columns: repeat(3, 68px); }
  .inventory-left { top: 64px; }
  .inventory-right { top: auto; bottom: 112px; }
}
.lb-carry { font-size: 11px; color: #9fe8f2; margin: 3px 0 6px; }
.lb-modes { display: flex; gap: 3px; margin-bottom: 7px; }
.lb-mode { flex: 1; background: #2a2e3a; border: 1px solid #444b5e; color: #cdd; border-radius: 5px; padding: 5px 2px; cursor: pointer; font-size: 12px; }
.lb-mode:hover { background: #343a48; }
.lb-mode.active { background: #2a7a8a; color: #fff; border-color: #5ad2e1; }
.lb-sec { margin-top: 7px; padding-top: 7px; border-top: 1px solid #3a4050; font-size: 11px; color: #aab; }
.lb-sec > span { display: block; margin-bottom: 4px; }
.lb-sec .fp-btns { max-height: 130px; overflow-y: auto; }
#lb-pen { width: 100%; background: #11131a; border: 1px solid #444b5e; color: #fff; border-radius: 5px; padding: 4px; font-size: 12px; }
.lb-all { width: 100%; margin-top: 8px; background: #2a3142; border: 1px solid #4a5165; color: #dfe8f5; border-radius: 5px; padding: 6px; cursor: pointer; font-size: 11px; }
.lb-all:hover { background: #3a4456; }

/* 상점 */
.shop-buy-board { background: #20242e; border: 1px solid #353b48; border-radius: 8px; overflow: hidden; }
.shop-buy-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 10px 14px; padding: 10px 12px; border-bottom: 1px solid #343946; }
.shop-buy-row:last-child { border-bottom: 0; }
.shop-buy-meta { display: flex; align-items: center; gap: 9px; min-width: 0; color: #dce4ed; }
.shop-buy-meta > span:not(.shop-symbol) { display: flex; flex-direction: column; min-width: 0; }
.shop-buy-meta b { font-size: 14px; }
.shop-buy-meta small { color: #8f9bad; font-size: 11px; white-space: nowrap; }
.shop-symbol { width: 28px; color: #b7c5d8; text-align: center; font-size: 20px; }
.shop-buy { display: flex; gap: 6px; flex-wrap: wrap; }
.shop-buy-option { grid-column: 2; }
.shop-buy-cre-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-autobuy { display: flex; align-items: center; gap: 6px; margin: 2px 0; color: #cdd6e0; font-size: 12px; cursor: pointer; }
.shop-autobuy .ab-num { width: 64px; background: #1b1e26; color: #eafff0; border: 1px solid #4f7a5a; border-radius: 5px; padding: 3px 6px; font-size: 13px; }
.shop-autobuy select { background: #1b1e26; color: #eafff0; border: 1px solid #4f7a5a; border-radius: 5px; padding: 3px 6px; font-size: 13px; }
.mkt.up { color: #6ad06a; }
.mkt.down { color: #e2705a; }
.shop-btn { background: #292e39; color: #e5ebf2; border: 1px solid #424a59; border-radius: 6px; min-height: 38px; padding: 5px 9px; cursor: pointer; font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 6px; }
.shop-btn .shop-icon { width: 24px; height: 24px; }
.shop-btn small { color: #ffd964; font-weight: normal; font-size: 11px; }
.shop-btn:hover { background: #343b48; border-color: #687386; }
.shop-btn:active { transform: scale(0.97); }
@media (max-width: 760px) {
  .shop-buy-row { grid-template-columns: 1fr; }
  .shop-buy-option { grid-column: 1; }
}
.autosell-list { display: flex; gap: 6px; flex-wrap: wrap; }
.autosell-btn { background: #2a2e3a; color: #aab; border: 1px solid #444b5e; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.autosell-btn.on { background: #3a6a4a; color: #eafff0; border-color: #4f7; }
.autosell-btn.on::before { content: '✔ '; }
.autosell-btn:hover { filter: brightness(1.12); }

/* 종류별 판매 미니 버튼 */
.sell-mini { display: inline-flex; gap: 3px; margin-left: 8px; }
.sell-mini button { background: #3a3f50; color: #cdd; border: 1px solid #555; border-radius: 4px; padding: 2px 7px; font-size: 11px; cursor: pointer; }
.sell-mini button:hover { background: #caa23a; color: #1a1407; }

/* ---- 상단바: 전력 / 생물 수 아이콘 ---- */
.tb-power { color: #ffe06a; font-weight: 700; }
.tb-power span { color: #fff3b0; }
#midori-tooltip .mt-text { white-space: pre-line; }
.tb-counts { display: inline-flex; align-items: center; gap: 9px; margin-left: 4px; }
.tb-feeds { display: inline-flex; align-items: center; gap: 9px; margin-left: 8px; padding-left: 8px; border-left: 1px solid #3a4150; }
.tb-feeds:empty { display: none; }
.tb-ct { display: inline-flex; align-items: center; gap: 2px; }
.tb-ct b { color: #e8eef6; font-size: 13px; min-width: 12px; }

/* 거래창 자원 요약줄 */
.res-bar { font-size: 13px; color: #b9c2cc; margin: 2px 0 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.res-bar b { color: #e8eef6; }

/* 우리 청결도 */
.pen-clean { font-size: 12px; color: #cdd6e0; margin: 4px 0; }
.pen-clean .pen-clean-pct { color: #8893a0; font-size: 11px; }

/* 일시정지 표시 */
#pause-indicator {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 500; background: rgba(20,24,32,0.82); color: #ffd964;
  border: 1px solid #ffd964; border-radius: 8px; padding: 6px 16px;
  font-size: 16px; font-weight: 700; letter-spacing: 1px; pointer-events: none;
}

/* 벽 업그레이드 패널 (자동 포탑 패널과 동일 룩) */
#wall-panel {
  position: absolute; z-index: 400; width: 208px;
  background: #20242e; border: 1px solid #d6a85a; border-radius: 8px;
  padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.6);
}
#wall-panel .fp-title { color: #e8c98a; }
.tp-all {
  width: 100%; margin-top: 7px; background: linear-gradient(#3a5a7a, #2c4258);
  color: #eaf3ff; border: 1px solid #5aa0d0; border-radius: 5px; padding: 5px 6px;
  cursor: pointer; font-size: 11px;
}
.tp-all:hover:not(:disabled) { filter: brightness(1.15); }
.tp-all:disabled { background: #2a2e3a; color: #667; border-color: #444b5e; cursor: default; }
.wp-hint { font-size: 10px; color: #8893a0; margin-top: 5px; text-align: center; }

/* 치트 메뉴 */
#cheat-menu {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 600; min-width: 240px; background: #20242e;
  border: 2px solid #caa23a; border-radius: 10px; padding: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.7); display: flex; flex-direction: column; gap: 7px;
}
.cheat-title { color: #ffd964; font-weight: 700; text-align: center; margin-bottom: 4px; letter-spacing: 2px; }
.cheat-btn {
  background: linear-gradient(#3a4458, #2a3240); color: #eaf0f8; border: 1px solid #4f5b72;
  border-radius: 6px; padding: 9px 12px; cursor: pointer; font-size: 14px; text-align: left;
}
.cheat-btn:hover { filter: brightness(1.2); border-color: #caa23a; }
.cheat-close { background: #2a2e3a; color: #aab; border: 1px solid #444b5e; border-radius: 6px; padding: 6px; cursor: pointer; font-size: 12px; margin-top: 3px; }
.cheat-close:hover { background: #343a48; color: #ccd; }
