/* 天际微城 (Skyline City) - 城市天际线全机制深色玻璃态 UI */
:root {
  --bg-glass: rgba(15, 23, 42, 0.86);
  --bg-glass-strong: rgba(15, 23, 42, 0.96);
  --bg-hover: rgba(51, 65, 85, 0.74);
  --border-subtle: rgba(148, 163, 184, 0.22);
  --border-active: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --green: #4ade80;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --teal: #2dd4bf;
  --red: #f87171;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0f172a;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

#game-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#city-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#city-canvas.tool-build { cursor: crosshair; }
#city-canvas.dragging { cursor: grabbing; }

.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow);
}

/* ================= 顶部状态栏 ================= */
#top-bar {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  gap: 6px;
  z-index: 20;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#top-bar::-webkit-scrollbar { display: none; }

.top-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 7px;
  border-right: 1px solid var(--border-subtle);
}

.brand-logo { font-size: 17px; }

#city-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-weight: 700;
  font-size: 13px;
  width: 76px;
  padding: 2px 4px;
  border-radius: 6px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

#city-name-input:hover,
#city-name-input:focus {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--border-active);
}

.rank-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  white-space: nowrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  white-space: nowrap;
  font-size: 12px;
}

.stat-chip.clickable {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.stat-chip.clickable:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.stat-chip.alert {
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(127, 29, 29, 0.48);
  animation: pulseAlert 1.5s infinite;
}

@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(248, 113, 113, 0); }
}

.stat-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pos { color: var(--green); }
.neg { color: var(--red); }

.speed-group {
  display: flex;
  background: rgba(30, 41, 59, 0.65);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border-subtle);
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 3px 5px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s;
  white-space: nowrap;
}

.icon-btn:hover { background: var(--bg-hover); }
.icon-btn.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--border-active);
  color: #e0f2fe;
}

.action-btn {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 4px 7px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
  white-space: nowrap;
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.action-btn.primary {
  background: rgba(14, 165, 233, 0.28);
  border-color: rgba(56, 189, 248, 0.6);
  color: #e0f2fe;
}

/* ================= 市民微动态 Chirp 条 ================= */
#chirp-bar {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 580px;
  z-index: 18;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

#chirp-bar:hover {
  border-color: var(--border-active);
  background: var(--bg-glass-strong);
}

.chirp-bird { font-size: 15px; flex-shrink: 0; }
.chirp-user { font-weight: 700; color: #7dd3fc; font-size: 12px; flex-shrink: 0; }
.chirp-text {
  font-size: 12px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#chirp-drawer {
  position: absolute;
  top: 98px;
  left: 50%;
  transform: translateX(-50%);
  width: 440px;
  max-width: 92vw;
  max-height: 290px;
  overflow-y: auto;
  border-radius: 14px;
  padding: 12px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chirp-drawer.hidden { display: none; }

.chirp-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.65);
  border-left: 3px solid #38bdf8;
  font-size: 12px;
  line-height: 1.45;
}

.chirp-item.danger { border-left-color: #ef4444; }
.chirp-item.warn { border-left-color: #f59e0b; }
.chirp-item.good { border-left-color: #22c55e; }

.chirp-item-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ================= 左侧 RCIO & 信息图层面板 ================= */
#mobile-panel-toggle {
  display: none;
  position: absolute;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: calc(8px + env(safe-area-inset-left, 0px));
  z-index: 21;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
}

#left-panel {
  position: absolute;
  top: calc(66px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  max-height: calc(100% - 155px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
}

#left-panel::-webkit-scrollbar { display: none; }

.side-card {
  border-radius: 13px;
  padding: 10px 11px;
  width: 146px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rci-bars {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 70px;
  padding: 4px 2px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.rci-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 26px;
}

.rci-track {
  width: 12px;
  height: 46px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.rci-fill {
  width: 100%;
  border-radius: 5px;
  transition: height 0.35s ease;
}

.rci-fill.r { background: linear-gradient(180deg, #4ade80, #16a34a); }
.rci-fill.c { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.rci-fill.i { background: linear-gradient(180deg, #fbbf24, #d97706); }
.rci-fill.o { background: linear-gradient(180deg, #2dd4bf, #0d9488); }

.rci-label { font-size: 10px; font-weight: 700; }

.overlay-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.overlay-btn {
  width: 100%;
  text-align: left;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid transparent;
  color: #cbd5e1;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s;
}

.overlay-btn:hover { background: var(--bg-hover); color: #fff; }
.overlay-btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--border-active);
  color: #fff;
  font-weight: 700;
}

/* ================= 右侧地块检视卡片 ================= */
#inspector-card {
  position: absolute;
  top: 66px;
  right: 12px;
  width: 256px;
  border-radius: 14px;
  padding: 12px 13px;
  z-index: 16;
  transition: opacity 0.18s, transform 0.18s;
}

#inspector-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(14px);
}

.insp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.insp-title { font-size: 14px; font-weight: 700; }

.insp-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
}

.insp-close:hover { background: var(--bg-hover); color: #fff; }

.status-pills {
  display: flex;
  gap: 5px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.status-pill {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.status-pill.ok {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.status-pill.bad {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.insp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 9px;
}

.insp-cell {
  background: rgba(30, 41, 59, 0.55);
  border-radius: 7px;
  padding: 5px 7px;
}

.insp-cell-label { font-size: 10px; color: var(--text-muted); }
.insp-cell-val { font-size: 12.5px; font-weight: 700; margin-top: 1px; }

.progress-wrap { margin-bottom: 9px; }
.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.progress-bar {
  height: 6px;
  background: rgba(51, 65, 85, 0.7);
  border-radius: 999px;
  overflow: hidden;
}
.progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  transition: width 0.3s;
}

.insp-hint {
  font-size: 11px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  padding: 7px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* ================= 底部天际线分类建造坞 ================= */
#bottom-wrap {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 20;
  max-width: calc(100vw - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
}

#tool-tip-bar {
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 子工具栏（选中某个分类标签时平滑展开） */
#sub-toolbar {
  border-radius: 14px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s, transform 0.15s;
}

#sub-toolbar.hidden { display: none; }

/* 主分类栏 */
#main-dock {
  border-radius: 15px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-sep {
  width: 1px;
  height: 36px;
  background: var(--border-subtle);
  margin: 0 2px;
  flex-shrink: 0;
}

.cat-btn,
.tool-btn {
  position: relative;
  min-width: 62px;
  height: 52px;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: transform 0.12s, background 0.14s, border-color 0.14s;
  flex-shrink: 0;
}

.cat-btn:hover,
.tool-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.cat-btn.active,
.tool-btn.active {
  background: rgba(14, 165, 233, 0.32);
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.24);
  transform: translateY(-2px);
}

.tool-btn.zone-r.active { border-color: var(--green); background: rgba(34, 197, 94, 0.25); }
.tool-btn.zone-c.active { border-color: var(--blue); background: rgba(59, 130, 246, 0.25); }
.tool-btn.zone-i.active { border-color: var(--amber); background: rgba(245, 158, 11, 0.25); }
.tool-btn.zone-o.active { border-color: var(--teal); background: rgba(20, 184, 166, 0.28); }
.tool-btn.bulldoze.active { border-color: var(--red); background: rgba(239, 68, 68, 0.28); }

.tool-icon { font-size: 18px; line-height: 1.1; }
.tool-name { font-size: 11px; font-weight: 600; white-space: nowrap; }
.tool-cost { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.tool-key {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  color: rgba(203, 213, 225, 0.65);
  font-weight: 700;
}

/* ================= 综合市政管理弹窗（财政 / 贷款 / 政策） ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.hidden { display: none; }

.modal-box {
  width: 640px;
  max-width: 94vw;
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 18px 20px;
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.62);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h2 { font-size: 16px; font-weight: 700; }

.modal-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.modal-tab {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.modal-tab.active {
  background: rgba(14, 165, 233, 0.28);
  border-color: var(--border-active);
  color: #fff;
}

.tab-pane.hidden { display: none; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel-section {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  padding: 11px 12px;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 12.5px;
}

.budget-row.total {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  border-bottom: none;
  margin-top: 5px;
  padding-top: 7px;
  font-weight: 700;
  font-size: 13.5px;
}

.slider-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.slider-item input[type="range"] {
  flex: 1;
  accent-color: #38bdf8;
}

.loan-card,
.policy-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  margin-bottom: 8px;
}

.policy-card.active {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.14);
}

.card-meta-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.card-meta-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

.toggle-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 11.5px;
  flex-shrink: 0;
}

.toggle-pill.on {
  background: rgba(34, 197, 94, 0.25);
  border-color: #4ade80;
  color: #bbf7d0;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #cbd5e1;
}

.kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(51, 65, 85, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  margin: 0 2px;
}

/* ================= Toast ================= */
#toast-container {
  position: absolute;
  top: 102px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 40;
  pointer-events: none;
}

.toast {
  padding: 8px 15px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  font-weight: 600;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: toastIn 0.22s ease;
}

.toast.milestone {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(69, 26, 3, 0.94));
  padding: 11px 18px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.district-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 12px;
}

.district-bar.hidden { display: none; }

.dist-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  cursor: pointer;
}

.dist-chip.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--border-active);
  color: #fff;
}

.chart-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.demo-bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.disaster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.disaster-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

@media (max-width: 1180px) {
  .hide-md { display: none !important; }
  .two-col { grid-template-columns: 1fr; }
}

/* 移动端 / 手机浏览器防遮挡自适应（竖屏 & 横屏通用） */
@media (max-width: 920px), (max-height: 560px) {
  #top-bar {
    top: calc(6px + env(safe-area-inset-top, 0px));
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    height: 40px;
    padding: 0 7px;
    border-radius: 11px;
  }
  .brand-box { padding-right: 5px; }
  .rank-pill { display: none; }
  #city-name-input { width: 64px; font-size: 12px; }
  .stat-chip { padding: 3px 6px; font-size: 11px; }
  .action-btn { padding: 4px 6px; font-size: 11px; }

  #chirp-bar { display: none; }

  #mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    top: calc(52px + env(safe-area-inset-top, 0px));
  }

  #left-panel {
    top: calc(84px + env(safe-area-inset-top, 0px));
    left: calc(8px + env(safe-area-inset-left, 0px));
    max-height: calc(100% - 168px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    transition: opacity 0.16s, transform 0.16s;
  }

  #left-panel.mobile-collapsed {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-14px);
  }

  .side-card {
    width: 126px;
    padding: 7px 8px;
  }

  #inspector-card {
    top: calc(52px + env(safe-area-inset-top, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    width: 220px;
    max-height: calc(100% - 135px);
    overflow-y: auto;
  }

  #bottom-wrap {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
  }

  #tool-tip-bar {
    display: none;
  }

  #main-dock,
  #sub-toolbar {
    max-width: calc(100vw - 14px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 6px;
    gap: 4px;
    border-radius: 12px;
  }

  #main-dock::-webkit-scrollbar,
  #sub-toolbar::-webkit-scrollbar {
    display: none;
  }

  .cat-btn,
  .tool-btn {
    min-width: 50px;
    height: 44px;
    padding: 3px 5px;
    border-radius: 9px;
  }

  .tool-icon { font-size: 16px; }
  .tool-name { font-size: 10px; }
  .tool-cost { font-size: 9px; }
  .tool-key { display: none; }

  .disaster-grid {
    grid-template-columns: 1fr;
  }
}
