/* 裂隙殘章 · 整體 UI 追加層
   只新增外框、升級卡、點數列、地圖唯讀視窗與 toast。
   不改動 app.css 內任何 .map-card / .minimap / .map-cell 既有規則。 */

:root {
  --sans: "PingFang TC", "PingFang SC", "Noto Sans TC", system-ui, sans-serif;
}

/* 讓 700px 左右的桌面／內嵌瀏覽器也能看到右側角色欄；
   原本 app.css 的 1080px 最小寬度保持不變，這裡只在追加層放寬。 */
#app {
  min-width: 680px;
}

/* 窄視窗時讓 15×15 的地圖卡仍能完整放進終端內容區。 */
@media (max-width: 900px) {
  #scroll {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* 右上連線與設定 */
#topbar .top-right {
  display: flex;
  align-items: center;
  gap: 9px;
}
#topbar .settings-gear {
  position: static;
  right: auto;
  bottom: auto;
  flex: 0 0 auto;
}

/* 右上人物升級卡與加點入口 */
.levelup-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.levelup-card {
  position: relative;
  width: 100%;
  height: 54px;
  padding: 7px 10px;
  flex: 0 0 auto;
  border: 1px solid #5b4328;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(26, 20, 13, .95), rgba(12, 11, 9, .95));
  box-shadow: 0 0 0 1px rgba(217, 165, 102, .05) inset, 0 0 18px rgba(217, 165, 102, .06);
}
.levelup-card .lu-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.levelup-card .lu-name {
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: .03em;
  color: #efe5d2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.levelup-card .lu-role {
  flex: 0 0 auto;
  padding: 1px 4px;
  border: 1px solid #5b4328;
  border-radius: 1px;
  color: var(--amber);
  font-size: 8px;
  font-style: normal;
  letter-spacing: .08em;
  white-space: nowrap;
}
.levelup-card .lu-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: .04em;
  color: #8b9aa0;
}
.levelup-card .lu-tier {
  margin: 0;
  color: var(--amber);
  font-size: 11px;
  letter-spacing: .05em;
}
.levelup-card .lu-tier-name {
  margin: 0;
  font-style: normal;
  color: #c8c1b2;
  font-size: 10px;
}
.levelup-card .wiztag {
  margin-left: 3px;
  padding: 0 4px;
  font-size: 8px;
}

/* 卡片下方的兩個加點入口 */
.card-actions {
  display: flex;
  gap: 8px;
}
.card-action {
  flex: 1;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #5b4328;
  border-radius: 3px;
  background: linear-gradient(180deg, #241a0e, #171108);
  color: #e9bb7e;
  font: inherit;
  font-size: 11px;
  letter-spacing: .04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.card-action.attr {
  border-color: #7a5b32;
  box-shadow: 0 0 12px rgba(217, 165, 102, .08);
}
.card-action.job {
  border-color: #36575b;
  background: linear-gradient(180deg, #102224, #0b1416);
  color: #9bd0d0;
}
.card-action:hover {
  border-color: var(--amber);
  color: #ffe0a8;
}
.card-action .ca-main {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-action .ca-count {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 5px;
  border: 1px solid #6b542e;
  border-radius: 2px;
  background: #1c140b;
  color: #f2c98f;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  flex: none;
}
.card-action .ca-count em {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 8px;
  font-style: normal;
}
.card-action .ca-count b {
  color: inherit;
  font-size: 11px;
  font-weight: 400;
}
.card-action .ca-count.zero {
  border-color: #34474b;
  background: #0e181a;
  color: #83969a;
}

.p-label .place-open {
  padding: 0 0 1px;
  border: 0;
  border-bottom: 1px dotted #415057;
  background: transparent;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .04em;
  cursor: pointer;
}
.p-label .place-open:hover {
  color: var(--cyan);
}

/* 地圖唯讀視窗：只讀取當下已經渲染好的 map/minimap DOM，不改地圖程式 */
.map-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 5, 6, .8);
}
.map-modal[hidden] {
  display: none;
}
.map-modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 13px 15px 12px;
  border: 1px solid #31464c;
  background: linear-gradient(180deg, #0d1417, #090d10);
  box-shadow: 0 18px 60px #000a;
}
.map-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.map-modal-kicker {
  margin-bottom: 3px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: .16em;
}
.map-modal-title {
  color: #eee5d4;
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: .08em;
}
.map-modal-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #2a3a40;
  background: transparent;
  color: #9fb0b4;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
}
.map-modal-close:hover {
  border-color: #6f5426;
  color: var(--amber);
}
.map-modal-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.map-modal-frame .map-line {
  display: flex;
  justify-content: center;
}
.map-modal-frame .map-cell {
  flex: 0 0 1em;
  width: 1em;
  height: 1.28em;
  line-height: 1.28em;
  text-align: center;
  color: #9fb0b4;
  font-family: "MingLiU_HKSCS", "PMingLiU", var(--mono);
  font-size: 22px;
}
.map-modal-frame .map-cur {
  color: var(--amber);
  font-weight: 700;
}
.map-modal.landmark-mode .map-modal-card {
  width: min(980px, 100%);
}
.map-modal-frame.landmark-map {
  align-items: stretch;
  padding: 8px 0 4px;
}
.map-modal-frame .landmark-svg {
  display: block;
  width: 100%;
  height: min(68vh, 720px);
  min-height: 360px;
}
.map-modal-legend {
  margin-top: 6px;
  color: #728288;
  font-size: 10px;
  letter-spacing: .02em;
}
.map-modal-note {
  margin-top: 9px;
  color: #546267;
  font-size: 9px;
  letter-spacing: .03em;
}
.map-modal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
}
.map-modal-foot button {
  padding: 4px 11px;
  border: 1px solid #2e4146;
  background: transparent;
  color: #9fb0b4;
  font-size: 10px;
  cursor: pointer;
}
.map-modal-foot button:hover {
  border-color: #6f5426;
  color: var(--amber);
}

/* toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 150;
  padding: 6px 12px;
  border: 1px solid #5b4328;
  background: rgba(22, 17, 11, .94);
  color: #e5c58e;
  font-size: 11px;
  letter-spacing: .04em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: .2s;
}
#toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
