/* ===== シティ(マイシティ)— ネオンサイバー刷新(city担当所有)=====
   グリッド系の上書きは .ce-root / .ce-grid-wrap でスコープし、
   battle画面の .city-grid / .city-cell に影響させない。 */

/* ----- 画面スコープ補助(assetImgラッパー)----- */
.ce-root .asset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ce-root .asset img { object-fit: contain; display: block; }

/* ----- シティステータスバー ----- */
.ce-status { display: flex; align-items: stretch; padding: 13px 6px; }
.ce-stat { flex: 1; min-width: 0; text-align: center; padding: 0 4px; }
.ce-stat-lv {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ce-stat + .ce-stat { border-left: 1px solid var(--border); }
.ce-stat-label {
  font-size: 10px; font-weight: 900; letter-spacing: 0.08em;
  color: var(--text-dim);
}
.ce-stat-value {
  display: flex; align-items: baseline; justify-content: center; gap: 2px;
  margin-top: 3px; font-size: 19px; font-weight: 900;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ce-stat-unit { font-size: 10px; font-weight: 800; color: var(--text-dim); }
.ce-stat-lv .ce-stat-value {
  background: var(--grad-cta);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ce-stat-happiness { flex: 2; }
.ce-happiness-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ce-happiness-help {
  display: grid;
  width: 17px;
  height: 17px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(34, 211, 238, .65);
  border-radius: 50%;
  color: var(--cyan);
  background: rgba(34, 211, 238, .1);
  font-family: inherit;
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 0 8px rgba(34, 211, 238, .2);
}
.ce-stat-happiness .ce-stat-value {
  color: var(--yellow);
  text-shadow: 0 0 14px rgba(255, 193, 77, 0.4);
}
.ce-happiness-bar {
  width: min(150px, 90%);
  height: 4px;
  margin: 4px auto 0;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
}
.ce-happiness-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff4d6d, #ffc14d 48%, #34d399);
  box-shadow: 0 0 8px rgba(255, 193, 77, .45);
}
.ce-happiness-effect {
  margin-top: 3px;
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
}
.ce-happiness-modal {
  width: min(92vw, 420px);
  max-height: min(84dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  text-align: left;
}
.ce-happiness-modal-head,
.ce-happiness-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ce-happiness-current {
  padding: 10px 14px;
  border: 1px solid rgba(255, 193, 77, .35);
  border-radius: 12px;
  background: rgba(255, 193, 77, .08);
}
.ce-happiness-current > div {
  display: grid;
  gap: 2px;
}
.ce-happiness-current small {
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 900;
}
.ce-happiness-current strong {
  color: var(--yellow);
  font-size: 17px;
}
.ce-happiness-modal-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}
.ce-happiness-section-title {
  margin-top: 5px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .08em;
}
.ce-happiness-factor {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(82, 137, 220, .25);
  border-radius: 10px;
  background: rgba(7, 18, 44, .7);
}
.ce-happiness-factor-icon {
  font-size: 20px;
  text-align: center;
}
.ce-happiness-factor b {
  font-size: 10px;
}
.ce-happiness-factor p,
.ce-happiness-suggestion p {
  margin: 2px 0 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.45;
}
.ce-happiness-suggestions {
  display: grid;
  gap: 5px;
}
.ce-happiness-suggestion {
  display: grid;
  grid-template-columns: 21px 1fr;
  align-items: start;
  gap: 7px;
}
.ce-happiness-suggestion > span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  color: #05111e;
  background: var(--cyan);
  font-size: 9px;
  font-weight: 1000;
}
.ce-happiness-warning {
  padding: 8px 10px;
  border-left: 3px solid var(--red);
  color: #ffc1ca;
  background: rgba(255, 77, 109, .08);
  font-size: 9px;
  line-height: 1.45;
}

/* ----- グリッドカード ----- */
.ce-grid-card { overflow: visible; }
.ce-grid-head { margin-bottom: 8px; }
.ce-grid-title { font-size: 14.5px; font-weight: 900; letter-spacing: 0.02em; }
.ce-grid-tools { gap: 8px; }
.ce-count-max { color: var(--yellow); border-color: var(--yellow); }

/* 道路接続ステータスチップ */
.ce-routes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ce-route-chip {
  font-size: 10.5px; font-weight: 800; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--border); white-space: nowrap;
}
.ce-route-ok {
  color: var(--green); border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.1);
}
.ce-route-ng {
  color: var(--red); border-color: rgba(255, 77, 109, 0.6);
  background: rgba(255, 77, 109, 0.12);
  animation: hp-flash 1.4s infinite;
}
.ce-route-dim { color: var(--text-dim); }
.ce-route-warn { margin-top: 10px; font-size: 11.5px; font-weight: 800; color: var(--red); }
.ce-route-note { margin-top: 7px; font-size: 11px; color: var(--text-dim); }

/* ----- 2.5Dグリッド -----
   transformはコンテナ(.city-grid)に適用するためタップ判定はそのまま正確。 */
.ce-grid-wrap { transition: margin 0.45s ease; }
.ce-grid-wrap .city-grid {
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ce-grid-wrap.ce-3d { margin: -4px 0 -20px; }
.ce-grid-wrap.ce-3d .city-grid {
  transform: perspective(1000px) rotateX(26deg) scale(0.96);
  transform-style: preserve-3d;
}
.ce-grid-wrap.ce-3d .city-cell {
  overflow: visible; /* 立ち上がった建物がタイルからはみ出せるように */
  transform-style: preserve-3d;
}

/* セル共通(シティ画面のみ) */
.ce-root .ce-editable { cursor: pointer; transition: transform 0.06s, filter 0.15s, box-shadow 0.2s; }
.ce-root .ce-editable:active { transform: scale(0.92); filter: brightness(1.3); }
.ce-root .ce-fixed { cursor: default; }

/* 建物アート(assetImg) */
.ce-root .cell-art { pointer-events: none; position: relative; z-index: 2; }
.ce-root .cell-art img,
.ce-root .cell-art .asset-fallback { width: 34px; height: 34px; }
.ce-root .cell-art .asset-fallback { font-size: 25px; line-height: 34px; }
.ce-root .cell-townhall .cell-art img,
.ce-root .cell-townhall .cell-art .asset-fallback { width: 38px; height: 38px; }
.ce-root .cell-townhall .cell-art .asset-fallback { font-size: 28px; line-height: 38px; }
.ce-root .cell-label { pointer-events: none; position: relative; z-index: 2; }

/* 3D時: 建物アートを地面から立ち上げる(counter-rotate) */
.ce-grid-wrap.ce-3d .ce-bld .cell-art {
  transform: rotateX(-26deg) translateY(-2px);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, 0.5));
}
/* 3D時: 疑似要素でタイルの厚み(立ち上がり)を表現 */
.ce-grid-wrap.ce-3d .ce-bld::before {
  content: "";
  position: absolute; left: 3%; right: 3%; bottom: -6px; height: 7px;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(180deg, rgba(10, 14, 30, 0.85), rgba(3, 5, 12, 0.95));
}

/* 道路: センターラインで道路らしく */
.ce-root .cell-road::after {
  content: "";
  position: absolute; left: 8%; right: 8%; top: calc(50% - 1px); height: 2px;
  background: repeating-linear-gradient(90deg, rgba(238, 242, 255, 0.42) 0 7px, transparent 7px 14px);
}
.ce-root .cell-entry .cell-label {
  color: var(--cyan); font-weight: 900;
  text-shadow: 0 0 6px rgba(34, 211, 238, 0.7);
}

/* 空地: 配置できることを示す + ヒント */
.ce-root .ce-editable.cell-empty::after {
  content: "+";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: rgba(148, 160, 196, 0.32);
}

/* 隣接ボーナス発動マスの✨強調 */
.ce-root .ce-bonus-cell {
  border-color: var(--yellow);
  box-shadow: 0 0 12px rgba(255, 193, 77, 0.5), inset 0 0 10px rgba(255, 193, 77, 0.16);
}
.ce-root .cell-spark {
  position: absolute; top: 1px; right: 2px; z-index: 3;
  font-size: 10px; pointer-events: none;
  animation: ce-spark 2.4s ease-in-out infinite;
}
@keyframes ce-spark {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* ----- 建設パレット(横スクロールのカード型)----- */
.ce-palette {
  display: flex; gap: 9px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 2px 10px; margin: 0 -2px;
  scrollbar-width: none;
}
.ce-palette::-webkit-scrollbar { display: none; }
.ce-pal-card {
  position: relative; flex: none; width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px 9px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: transform 0.06s, border-color 0.15s, box-shadow 0.2s, background 0.2s;
}

.ce-pal-wrap {
  flex: none;
  width: 92px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ce-pal-select {
  width: 100%;
}

.ce-upgrade-btn {
  width: 100%;
  min-height: 27px;
  padding: 4px 3px;
  border: 1px solid rgba(255, 193, 77, 0.72);
  border-radius: 8px;
  color: var(--yellow);
  background: linear-gradient(145deg, rgba(255, 193, 77, 0.14), rgba(255, 122, 61, 0.08));
  font-family: inherit;
  font-size: 8px;
  font-weight: 900;
  box-shadow: inset 0 0 10px rgba(255, 193, 77, 0.08);
}

.ce-upgrade-btn:not(:disabled):active {
  transform: scale(0.96);
}

.ce-upgrade-btn.is-max {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--green);
  background: rgba(52, 211, 153, 0.09);
}

.ce-upgrade-btn:disabled {
  opacity: 0.58;
}
.ce-pal-card:active { transform: scale(0.95); }
.ce-pal-card.selected {
  border-color: var(--cyan);
  background: linear-gradient(165deg, rgba(34, 211, 238, 0.16), rgba(77, 163, 255, 0.07));
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.45), inset 0 0 12px rgba(34, 211, 238, 0.1);
}
.ce-pal-card.selected::after {
  content: "✓";
  position: absolute; top: -6px; right: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-cta); color: #04101c;
  font-size: 11px; font-weight: 900;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.65);
}
.ce-pal-art img,
.ce-pal-art .asset-fallback { width: 42px; height: 42px; }
.ce-pal-art .asset-fallback { font-size: 30px; line-height: 42px; }
.ce-pal-name { font-size: 11px; font-weight: 800; white-space: nowrap; }
.ce-pal-cost { font-size: 10.5px; font-weight: 800; color: var(--yellow); }
.ce-pal-locked { opacity: 0.6; }
.ce-pal-locked .ce-pal-art { filter: grayscale(0.9) brightness(0.7); }
.ce-pal-lock {
  position: absolute; top: 5px; right: 7px; font-size: 13px;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.9));
}

/* ----- 解放パネル(tv/port)----- */
.ce-unlock {
  margin-top: 4px;
  border: 1px dashed var(--magenta);
  box-shadow: 0 0 16px rgba(255, 61, 154, 0.18);
}
.ce-unlock-head { align-items: flex-start; margin-bottom: 8px; }
.ce-unlock-art img,
.ce-unlock-art .asset-fallback { width: 40px; height: 40px; }
.ce-unlock-art .asset-fallback { font-size: 30px; line-height: 40px; }
.ce-unlock-body { flex: 1; min-width: 0; }
.ce-unlock-title { font-size: 13.5px; font-weight: 900; }
.ce-unlock-req { font-size: 12.5px; font-weight: 800; margin-top: 3px; }
.ce-unlock-ok { color: var(--green); }
.ce-unlock-ng { color: var(--red); }
.ce-unlock-btn { flex: 1; }

/* ----- 施設効果パネル ----- */
.ce-fx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ce-fx-item:last-of-type { border-bottom: none; }
.ce-fx-art { flex: none; }
.ce-fx-art img,
.ce-fx-art .asset-fallback { width: 28px; height: 28px; }
.ce-fx-art .asset-fallback { font-size: 21px; line-height: 28px; }
.ce-fx-body { flex: 1; min-width: 0; }
.ce-fx-name { font-size: 12.5px; font-weight: 800; }
.ce-fx-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.ce-fx-bonus-box {
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid rgba(255, 193, 77, 0.7);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255, 193, 77, 0.12), rgba(251, 146, 60, 0.05));
  box-shadow: 0 0 14px rgba(255, 193, 77, 0.22), inset 0 0 12px rgba(255, 193, 77, 0.08);
}
.ce-fx-bonus-title {
  font-size: 11px; font-weight: 900; color: var(--yellow);
  letter-spacing: 0.05em; margin-bottom: 4px;
}
.ce-fx-bonus { font-size: 12.5px; font-weight: 800; color: var(--yellow); padding: 2px 0; }

/* ----- フッター(差分コスト+操作)----- */
.ce-footer { margin-top: 16px; }
.ce-cost-line {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ce-cost-pay { color: var(--red); font-weight: 900; }
.ce-cost-gain { color: var(--green); font-weight: 900; }
.ce-cost-after { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }
.ce-cost-short { color: var(--red); font-weight: 800; }
.ce-cost-none { padding: 2px 0; }
.ce-actions { margin-top: 10px; }
.ce-action-btn { flex: 1; }

/* ----- 出撃CTA ----- */
.ce-sortie { margin-top: 2px; }

/* ----- 保存確認モーダル(body直下に出るためスコープ外)----- */
.ce-confirm-rows {
  margin: 14px 0 2px;
  display: flex; flex-direction: column; gap: 7px;
  text-align: left;
}
.ce-confirm-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ce-confirm-label { color: var(--text-dim); font-weight: 700; font-size: 12px; }
.ce-confirm-warn { margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--red); }
.ce-confirm-btn { flex: 1; }
.ce-confirm-btn.cta-btn { padding: 11px 16px; font-size: 14px; }

/* Reference city presentation */
.ce-root { position: relative; }
.ce-status {
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(7,25,59,.96), rgba(4,12,31,.96));
}
.ce-grid-card {
  position: relative; overflow: hidden; min-height: 480px;
  background:
    linear-gradient(180deg, rgba(3,10,27,.18), rgba(3,9,24,.88) 72%),
    url('/assets/img/city-diorama.png') center 62px / 108% auto no-repeat,
    linear-gradient(145deg, #071839, #030919);
}
.ce-grid-card::before {
  content: ""; position: absolute; inset: 54px 0 auto; height: 250px; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(69,184,255,.12), transparent 64%);
}
.ce-grid-card > * { position: relative; z-index: 1; }
.ce-grid-wrap { margin-top: 185px; padding: 8px; border-radius: 10px; background: rgba(2,8,24,.66); backdrop-filter: blur(4px); }
.ce-grid-wrap.ce-3d { margin-top: 175px; }
.ce-palette { background: linear-gradient(145deg, rgba(7,22,52,.98), rgba(4,10,27,.98)); }

/* ===== Graphical city editor v2 ===== */
#view:has(.ce-root) {
  padding-left: 10px;
  padding-right: 10px;
}

.ce-root {
  display: grid;
  gap: 10px;
}

.ce-root > .card,
.ce-root > .section-title,
.ce-root > .ce-palette,
.ce-root > div {
  margin-top: 0;
  margin-bottom: 0;
}

.ce-status {
  padding: 8px 4px;
  border: 1px solid rgba(60, 177, 255, 0.48);
  background:
    linear-gradient(90deg, rgba(7, 28, 65, 0.96), rgba(16, 8, 48, 0.96)),
    url('/assets/img/city-diorama.png') center / cover;
}

.ce-stat-label {
  font-size: 8px;
}

.ce-stat-value {
  margin-top: 1px;
  font-size: 16px;
}

.ce-grid-card {
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(35, 173, 255, 0.16), transparent 48%),
    linear-gradient(160deg, rgba(5, 20, 48, 0.98), rgba(3, 8, 24, 0.98));
}

.ce-grid-card::before {
  inset: 0;
  height: auto;
  background:
    linear-gradient(rgba(53, 136, 210, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 136, 210, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent);
}

.ce-grid-head {
  margin-bottom: 6px;
}

.ce-grid-title {
  font-size: 16px;
  font-style: italic;
  letter-spacing: 0.06em;
}

.ce-routes {
  gap: 5px;
  margin-bottom: 5px;
}

.ce-route-chip {
  flex: 1;
  min-width: 0;
  padding: 3px 5px;
  overflow: hidden;
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
}

.ce-grid-wrap,
.ce-grid-wrap.ce-3d {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(58, 175, 255, 0.4);
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 42%, rgba(30, 157, 255, 0.14), transparent 57%),
    linear-gradient(145deg, rgba(4, 15, 38, 0.92), rgba(9, 7, 31, 0.95));
  box-shadow: inset 0 0 30px rgba(24, 113, 205, 0.12);
}

.ce-grid-wrap .city-grid,
.ce-grid-wrap.ce-3d .city-grid {
  gap: 5px;
  transform: none;
}

.ce-loadout,
.ce-training {
  display: grid;
  gap: 12px;
}
.ce-loadout-summary-head,
.ce-loadout-modal-top,
.ce-loadout-modal-heading,
.ce-loadout-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ce-loadout-summary-head small {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 9px;
}
.ce-loadout-edit {
  flex: none;
  color: var(--cyan);
  border-color: rgba(34, 211, 238, .55);
}
.ce-loadout-block,
.ce-train-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.ce-loadout-title {
  flex: 0 0 auto;
  min-width: 74px;
  align-self: center;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 900;
}
.ce-mini-card {
  flex: 0 0 86px;
  min-height: 76px;
  border: 1px solid rgba(99, 125, 200, 0.28);
  border-radius: 14px;
  background: rgba(20, 27, 52, 0.78);
  color: var(--text);
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 7px;
}
.ce-mini-card.selected {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.14);
}
.ce-mini-card.locked {
  opacity: 0.72;
}
.ce-mini-art img,
.ce-mini-art .asset-fallback {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.ce-loadout-modal {
  width: min(94vw, 430px);
  max-height: min(82dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  text-align: left;
}
.ce-loadout-modal-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  padding: 2px;
}
.ce-loadout-modal-section {
  display: grid;
  gap: 8px;
}
.ce-loadout-modal-heading span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}
.ce-loadout-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.ce-loadout-choice {
  min-width: 0;
  min-height: 92px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 7px 4px;
  border: 1px solid rgba(99, 125, 200, .32);
  border-radius: 12px;
  color: var(--text);
  background: rgba(9, 20, 48, .88);
  font-family: inherit;
  font-size: 9px;
  font-weight: 900;
}
.ce-loadout-choice.selected {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, .14);
  box-shadow: 0 0 12px rgba(34, 211, 238, .2);
}
.ce-loadout-choice.locked {
  border-color: rgba(255, 193, 77, .35);
  color: #ffd68a;
}
.ce-loadout-choice small {
  color: var(--text-dim);
  font-size: 8px;
}
.ce-loadout-choice-art img,
.ce-loadout-choice-art .asset-fallback {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.ce-loadout-close {
  width: 30px;
  height: 30px;
  flex: none;
  border: 1px solid rgba(99, 125, 200, .35);
  border-radius: 9px;
  color: var(--text);
  background: rgba(10, 20, 45, .9);
  font-size: 20px;
}
.ce-loadout-modal-actions {
  flex: none;
}

.ce-root .city-cell {
  aspect-ratio: 1;
  overflow: visible;
  border: 1px solid rgba(70, 126, 202, 0.38);
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(18, 38, 78, 0.85), rgba(8, 17, 42, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ce-root .city-cell.cell-empty {
  background: rgba(8, 19, 45, 0.58);
  border-style: dashed;
}

.ce-root .city-cell.cell-road {
  overflow: hidden;
  background:
    url('/assets/img/generated/road-cross-v1.png') center / 120% 120% no-repeat,
    linear-gradient(145deg, rgba(15, 28, 55, 0.96), rgba(5, 11, 28, 0.96));
}

.ce-root .cell-road::after {
  display: none;
}

.ce-root .ce-bld {
  border-color: rgba(105, 77, 255, 0.65);
  background:
    radial-gradient(circle at 50% 72%, rgba(111, 55, 255, 0.27), transparent 52%),
    linear-gradient(145deg, rgba(16, 31, 69, 0.94), rgba(9, 8, 34, 0.96));
}

.ce-grid-wrap.ce-3d .ce-bld::before {
  display: none;
}

.ce-root .cell-art,
.ce-grid-wrap.ce-3d .ce-bld .cell-art {
  position: absolute;
  left: 50%;
  bottom: 4px;
  z-index: 4;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform: translateX(-50%);
  filter: drop-shadow(0 8px 7px rgba(0, 0, 0, 0.62)) drop-shadow(0 0 8px rgba(63, 186, 255, 0.26));
  transform-origin: 50% 100%;
}

.ce-root .cell-art img,
.ce-root .cell-townhall .cell-art img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.ce-root .cell-label {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 2px;
  z-index: 6;
  overflow: hidden;
  color: #dff8ff;
  font-size: 7px;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
}

.ce-root .cell-spark {
  z-index: 7;
}

.ce-route-note {
  margin-top: 5px;
  font-size: 8px;
}

.ce-route-warn {
  margin-top: 5px;
  font-size: 9px;
}

.ce-root > .section-title {
  margin-top: 2px;
  font-size: 12px;
}

.ce-palette {
  gap: 7px;
  margin: 0 -10px !important;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(54, 201, 255, 0.2);
  border-bottom: 1px solid rgba(54, 201, 255, 0.2);
}

.ce-pal-card {
  width: 92px;
  min-height: 98px;
  gap: 1px;
  padding: 5px 4px 6px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 40%, rgba(55, 128, 255, 0.17), transparent 54%),
    linear-gradient(145deg, rgba(13, 31, 68, 0.98), rgba(8, 12, 34, 0.98));
}

.ce-pal-card.selected {
  transform: translateY(-2px);
}

.ce-pal-art {
  height: 64px;
}

.ce-pal-art img,
.ce-pal-art .asset-fallback {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.55));
}

.ce-pal-name {
  font-size: 10px;
}

.ce-pal-cost {
  font-size: 9px;
}

.ce-root > .card:not(.ce-status):not(.ce-grid-card):not(.ce-footer) {
  padding: 8px 10px;
}

.ce-fx-item {
  min-height: 42px;
  gap: 7px;
  padding: 5px 0;
}

.ce-fx-art img,
.ce-fx-art .asset-fallback {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.ce-fx-name {
  font-size: 10px;
}

.ce-fx-desc {
  font-size: 9px;
  line-height: 1.35;
}

.ce-footer {
  margin-top: 0;
  padding: 8px 10px;
}

.ce-cost-line,
.ce-cost-after {
  font-size: 9px;
}

.ce-free-save {
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
}

/* ----- 施設・部隊ガイド ----- */
.ce-guide {
  padding: 9px 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 0%, rgba(139, 92, 246, 0.14), transparent 42%),
    linear-gradient(145deg, rgba(7, 22, 52, 0.98), rgba(4, 10, 27, 0.98));
}

.ce-guide-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.ce-guide-tab {
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  background: rgba(5, 13, 34, 0.78);
  font-family: inherit;
  font-size: 10px;
  font-weight: 900;
}

.ce-guide-tab.on {
  border-color: var(--cyan);
  color: #04101c;
  background: var(--grad-cta);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.ce-guide-note {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 8px;
}

.ce-guide-body {
  display: flex;
  gap: 7px;
  margin: 8px -10px -1px;
  padding: 0 10px 5px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.ce-guide-body::-webkit-scrollbar {
  display: none;
}

.ce-guide-item {
  flex: 0 0 210px;
  min-height: 105px;
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 7px;
  padding: 8px;
  scroll-snap-align: start;
  border: 1px solid rgba(73, 145, 245, 0.42);
  border-radius: 11px;
  background:
    radial-gradient(circle at 12% 50%, rgba(42, 166, 255, 0.14), transparent 40%),
    rgba(5, 15, 38, 0.92);
}

.ce-guide-art,
.ce-guide-emoji {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
}

.ce-guide-art img,
.ce-guide-art .asset-fallback {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.55));
}

.ce-guide-unit img,
.ce-guide-unit .asset-fallback {
  width: 62px;
  height: 62px;
}

.ce-guide-emoji {
  font-size: 32px;
}

.ce-guide-copy {
  min-width: 0;
}

.ce-guide-name {
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.ce-guide-name span {
  display: block;
  margin-top: 1px;
  color: var(--cyan);
  font-size: 8px;
}

.ce-guide-effect,
.ce-guide-upgrade {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 8.5px;
  line-height: 1.4;
}

.ce-guide-upgrade {
  color: var(--yellow);
}

.ce-actions {
  margin-top: 6px;
}

.ce-action-btn {
  padding: 8px;
  font-size: 11px;
}

.ce-sortie {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(128, 222, 255, 0.8);
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 0 24px rgba(63, 150, 255, 0.48);
}

/* 施設種別は縮小時も背景色で識別し、段階画像のシンボルを前面に残す */
.ce-root .cell-police.ce-bld {
  border-color: rgba(45, 154, 255, .9);
  background: radial-gradient(circle at 50% 68%, rgba(22, 132, 255, .42), transparent 62%), #071b3e;
}
.ce-root .cell-hospital.ce-bld {
  border-color: rgba(255, 75, 75, .92);
  background: radial-gradient(circle at 50% 68%, rgba(255, 65, 65, .38), transparent 62%), #32101c;
}
.ce-root .cell-power.ce-bld {
  border-color: rgba(255, 202, 54, .95);
  background: radial-gradient(circle at 50% 68%, rgba(255, 190, 28, .4), transparent 62%), #302409;
}
.ce-root .cell-shopping.ce-bld {
  border-color: rgba(45, 220, 134, .92);
  background: radial-gradient(circle at 50% 68%, rgba(31, 207, 119, .38), transparent 62%), #0a2d23;
}
.ce-root .cell-station.ce-bld {
  border-color: rgba(75, 190, 255, .92);
  background: radial-gradient(circle at 50% 68%, rgba(45, 173, 255, .38), transparent 62%), #0a273d;
}
.ce-root .cell-tv.ce-bld {
  border-color: rgba(190, 91, 255, .92);
  background: radial-gradient(circle at 50% 68%, rgba(165, 61, 255, .4), transparent 62%), #27103d;
}
.ce-root .cell-port.ce-bld {
  border-color: rgba(48, 224, 213, .92);
  background: radial-gradient(circle at 50% 68%, rgba(32, 199, 194, .4), transparent 62%), #082e35;
}
.ce-root .ce-pal-art img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .58));
}
.ce-root .ce-pal-name {
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== バトル編成(部隊変種)===== */
.ce-loadout-choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ce-loadout-choice-art { width: 38px; height: 38px; flex: none; }
.ce-loadout-choice-art .asset, .ce-loadout-choice-art img, .ce-loadout-choice-art .asset-fallback {
  width: 38px; height: 38px; object-fit: contain; font-size: 26px;
}
.ce-loadout-choice-name { font-size: 11.5px; font-weight: 800; }
.ce-loadout-choice-base { font-size: 9.5px; color: var(--text-dim); }
.ce-grade-tag { font-size: 9.5px; font-weight: 900; letter-spacing: .04em; }
.ce-mini-card { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ce-mini-art { width: 40px; height: 40px; }
.ce-mini-art .asset, .ce-mini-art img, .ce-mini-art .asset-fallback { width: 40px; height: 40px; object-fit: contain; font-size: 26px; }
.ce-mini-name { font-size: 10px; font-weight: 800; text-align: center; line-height: 1.15; }
.ce-mini-base { font-size: 9px; color: var(--text-dim); }
.ce-loadout-empty { font-size: 12px; color: var(--text-dim); padding: 14px; text-align: center; }
.ce-guide-grade-note { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; line-height: 1.5; }
