:root {
  --bg: #f3e7d3;
  --paper: #fffaf0;
  --paper-alt: #fbf1de;
  --ink: #3b2c22;
  --muted: #8c7a63;
  --border: #e6d5b8;
  --primary: #d9803f;
  --primary-dark: #b8632a;
  --secondary: #6f9a7c;
  --secondary-dark: #52795e;
  --danger: #cf4f4f;
  --danger-dark: #a83a3a;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 3px 0 rgba(59, 44, 34, 0.08), 0 6px 16px rgba(59, 44, 34, 0.08);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(59, 44, 34, 0.035) 1px, transparent 1px);
  background-size: 14px 14px;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(59, 44, 34, 0.12);
  overflow: hidden;
}

button, input {
  font-family: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.screen-center {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 40px;
  overflow-y: auto;
}

/* ---------- 헤더 ---------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--paper);
  border-bottom: 3px solid var(--border);
  flex-shrink: 0;
  z-index: 5;
}

.app-title {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.01em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--paper-alt);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn-spacer {
  width: 44px;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lang-toggle {
  display: flex;
  border: 2px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: var(--paper-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 8px 9px;
  line-height: 1;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff8ef;
}

.start-lang-row {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
}

/* ---------- 본문 / 푸터 ---------- */

.app-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.app-footer {
  flex-shrink: 0;
  padding: 12px 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(243, 231, 211, 0), var(--bg) 30%);
}

.footer-row {
  display: flex;
  gap: 10px;
}

.btn-flex {
  flex: 1;
}

/* ---------- 버튼 ---------- */

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 18px;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
  transition: transform 0.08s ease;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff8ef;
}

.btn-secondary {
  background: var(--secondary);
  color: #f4fbf6;
}

.btn-danger {
  background: var(--danger);
  color: #fff5f5;
}

.btn-ghost {
  background: var(--paper-alt);
  color: var(--ink);
  box-shadow: none;
  border: 2px solid var(--border);
}

.btn-huge {
  padding: 20px;
  font-size: 1.15rem;
  border-radius: var(--radius-lg);
}

.btn-large {
  padding: 16px;
  font-size: 1rem;
}

.btn-small {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  box-shadow: none;
}

.btn-quick {
  background: var(--paper-alt);
  border: 2px solid var(--border);
  color: var(--primary-dark);
  box-shadow: none;
  padding: 12px 6px;
  font-size: 0.95rem;
  font-weight: 800;
}

.btn-quick:active {
  background: var(--primary);
  color: #fff;
}

.btn-action {
  background: var(--paper);
  border: 2px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 22px 10px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.danger-text {
  color: var(--danger-dark);
}

/* ---------- 시작 화면 ---------- */

.brand-emoji {
  font-size: 4rem;
}

.brand-title {
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  margin: 10px 0 4px;
  font-weight: 900;
  color: var(--primary-dark);
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* ---------- 카드 / 리스트 ---------- */

.card {
  background: var(--paper);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-dark);
}

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

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--paper-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.player-edit-row {
  justify-content: space-between;
}

.participant-row {
  justify-content: flex-start;
}

.participant-emoji {
  font-size: 1.4rem;
}

.participant-name {
  flex: 1;
  font-weight: 700;
}

.chevron {
  color: var(--muted);
  font-size: 1.2rem;
}

.bank-row {
  background: #f7ecd8;
  border-color: #e3c98f;
}

.hint-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 4px 0;
}

/* ---------- 입력 요소 ---------- */

.text-input {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--paper-alt);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.field-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}

.color-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid transparent;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
}

.color-swatch.selected {
  border-color: var(--ink);
  opacity: 1;
  transform: scale(1.08);
}

.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-chip {
  border-radius: var(--radius-md);
  padding: 14px 8px;
  font-weight: 800;
  font-size: 0.92rem;
  border: 2px solid var(--border);
  box-shadow: none;
}

.toggle-chip.on {
  background: var(--secondary);
  color: #f4fbf6;
  border-color: var(--secondary-dark);
}

.toggle-chip.off {
  background: var(--paper-alt);
  color: var(--muted);
}

/* ---------- 메인 화면 ---------- */

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fund-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f2e6cf;
  border: 2px solid #e3c98f;
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.fund-banner-icon {
  font-size: 1.3rem;
}

.fund-banner-label {
  flex: 1;
  font-weight: 800;
  color: var(--primary-dark);
}

.fund-banner-amount {
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.player-card {
  background: var(--paper);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
}

.player-card:active {
  transform: translateY(2px);
  box-shadow: none;
}

.player-card-emoji {
  font-size: 1.6rem;
}

.player-card-name {
  font-weight: 800;
  font-size: 1rem;
}

.player-card-balance {
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--primary-dark);
}

.player-card--bankrupt {
  position: relative;
  filter: grayscale(1);
  opacity: 0.6;
}

.bankrupt-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  background: var(--danger);
  color: #fff5f5;
  padding: 3px 8px;
  border-radius: 20px;
}

.bankrupt-banner {
  background: var(--danger);
  color: #fff5f5;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-md);
}

/* ---------- 거래 내역 ---------- */

.tx-row {
  background: var(--paper-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tx-row.is-cancelled {
  opacity: 0.55;
}

.tx-row.is-cancel-entry {
  border-style: dashed;
}

.tx-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.tx-parties {
  font-weight: 700;
  font-size: 0.95rem;
}

.tx-amount {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--primary-dark);
  white-space: nowrap;
}

.tx-amount.neutral {
  color: var(--muted);
}

.tx-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.tx-type-tag {
  background: #eadfc7;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.tx-cancelled-tag {
  color: var(--danger-dark);
  font-weight: 800;
}

.tx-time {
  font-variant-numeric: tabular-nums;
}

/* ---------- 플레이어 상세 ---------- */

.player-hero {
  background: var(--paper);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
}

.player-hero-emoji {
  font-size: 2.2rem;
}

.player-hero-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.player-hero-balance {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- 금액 입력 ---------- */

.amount-entry {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.amount-display-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 28px 0 8px;
}

.amount-display {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.amount-unit {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--muted);
}

.amount-input-row {
  display: flex;
  gap: 10px;
}

.amount-input {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
}

.quick-amount-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ---------- 확인 화면 ---------- */

.confirm-card {
  background: var(--paper);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.confirm-parties {
  font-size: 1.1rem;
  font-weight: 800;
}

.confirm-ownership {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary-dark);
}

.confirm-amount {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary-dark);
  margin: 6px 0 10px;
}

.balance-change-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--paper-alt);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.bc-name {
  font-weight: 700;
  color: var(--muted);
}

.bc-values {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.shortfall-row {
  background: #fbe2e2;
}

.shortfall-row .bc-values {
  color: var(--danger-dark);
}

/* ---------- 부동산 ---------- */

.property-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.property-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 100px;
}

.property-name {
  font-weight: 800;
  font-size: 1.02rem;
}

.resort-badge {
  font-size: 0.75rem;
  background: #dcefe0;
  color: var(--secondary-dark);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
}

.resort-badge-large {
  font-size: 0.9rem;
  background: #dcefe0;
  color: var(--secondary-dark);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.property-building-icons {
  font-size: 1rem;
  letter-spacing: 2px;
}

.owner-badge {
  font-size: 0.8rem;
  color: var(--primary-dark);
  font-weight: 800;
  background: #f7e9d8;
  padding: 4px 10px;
  border-radius: 20px;
}

.property-hero {
  align-items: center;
  text-align: center;
}

.property-hero-name {
  font-size: 1.3rem;
  font-weight: 900;
}

.property-hero-owner {
  color: var(--muted);
  font-weight: 700;
}

.property-hero-prices {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.sell-row {
  flex-wrap: nowrap;
}

.building-detail-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}

.building-detail-row:last-child {
  border-bottom: none;
}

.building-detail-icon {
  font-size: 1.6rem;
}

.building-detail-info {
  flex: 1;
}

.building-detail-label {
  font-weight: 800;
}

.building-detail-state {
  font-size: 0.85rem;
  font-weight: 700;
}

.building-detail-state.has {
  color: var(--secondary-dark);
}

.building-detail-state.not {
  color: var(--muted);
}

/* ---------- 모달 / 토스트 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 44, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 800;
}

.modal-message {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

#toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff8ef;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: 88vw;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#toast-host.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 데스크톱 ---------- */

@media (min-width: 640px) {
  body {
    display: flex;
    justify-content: center;
    padding: 24px 0;
  }

  #app {
    height: calc(100vh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }

  .app-header {
    border-radius: 28px 28px 0 0;
  }
}

/* ---------- 메인 화면 부동산 관리 진입 행 ---------- */

.property-entry {
  background: #f7ecd8;
  border-color: #e3c98f;
  font-weight: 800;
}

.property-entry-icon {
  font-size: 1.3rem;
}

.property-entry-label {
  flex: 1;
  color: var(--primary-dark);
}

.property-entry-count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  text-align: center;
}

/* 기금 배너는 버튼으로도 쓰이므로 폭/정렬을 맞춘다. */
.fund-banner {
  width: 100%;
  text-align: left;
  font-size: 1rem;
}

.fund-hero {
  background: #f7ecd8;
  border: 2px solid #e3c98f;
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.fund-hero-emoji {
  font-size: 2.4rem;
}

.fund-hero-name {
  font-weight: 800;
  color: var(--primary-dark);
}

.fund-hero-balance {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary-dark);
}

/* ---------- 부동산 등록 폼 (소유자 / 건물 선택) ---------- */

.owner-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.owner-chip {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  background: var(--paper-alt);
  color: var(--muted);
}

.owner-chip.selected {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}

.building-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.building-picker.is-hidden {
  display: none;
}

.building-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.building-pick-row .toggle-chip {
  flex: 0 0 40%;
  padding: 12px 8px;
}

.building-pick-row .text-input {
  flex: 1;
  margin: 0;
}

/* ---------- 로컬 룰 선택 ---------- */

.rule-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.rule-options {
  display: flex;
  gap: 8px;
}

.rule-chip {
  flex: 1;
  border-radius: var(--radius-md);
  padding: 12px 8px;
  font-weight: 800;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  background: var(--paper-alt);
  color: var(--muted);
}

.rule-chip.selected {
  background: var(--secondary);
  border-color: var(--secondary-dark);
  color: #f4fbf6;
}

.rule-row .hint-text {
  margin: 0;
}

.player-edit-row-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- 사용법 ---------- */

.howto-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.howto-list li {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

/* ---------- 헤더 안정화 (게임 종료 버튼 깨짐 방지) ---------- */

.app-header {
  flex-wrap: nowrap;
  min-height: 68px;
}

.app-title {
  /* 제목이 길어도 좌우 버튼을 밀어내지 않고 말줄임 처리한다. */
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.icon-btn {
  flex: 0 0 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  line-height: 1;
  box-sizing: border-box;
  overflow: hidden;
}

.header-right {
  min-width: 0;
  flex-wrap: nowrap;
}

.lang-toggle {
  flex-shrink: 0;
}

/* 좁은 화면에서도 버튼이 겹치거나 잘리지 않도록 한 단계 줄인다. */
@media (max-width: 380px) {
  .app-header {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .app-title {
    font-size: 1rem;
  }
  .icon-btn,
  .icon-btn-spacer {
    flex-basis: 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    font-size: 1.05rem;
  }
}

/* ---------- 룰 선택 화면 ---------- */

.ruleset-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 4px;
}

.ruleset-bluemarble { border-color: #d9803f; }
.ruleset-modumarble { border-color: #4caf6f; }
.ruleset-custom { border-color: #5b8def; }

.ruleset-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
}

.ruleset-desc {
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

.ruleset-bullets {
  margin: 10px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ruleset-bullets li {
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.5;
}

.rule-options.wrap {
  flex-wrap: wrap;
}

.rule-options.wrap .rule-chip {
  flex: 0 0 auto;
  min-width: 68px;
}

/* ---------- 부동산 목록 / 상세 ---------- */

.property-flag {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.property-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.property-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.property-row-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toll-chip {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--border);
}

.toll-chip.monopoly {
  background: #f7e0d0;
  border-color: #d9803f;
  color: var(--primary-dark);
}

.property-hero-flag {
  font-size: 2.6rem;
}

.property-hero-country {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.property-hero-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 6px 0;
}

.color-tag,
.line-tag {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
}

.line-tag {
  background: var(--muted);
}

/* ---------- 통행료 카드 ---------- */

.toll-card {
  text-align: center;
}

.toll-amount {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary-dark);
}

.toll-formula {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.monopoly-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f7e0d0;
  border: 2px solid #d9803f;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.building-detail-preset {
  font-size: 0.75rem;
  color: var(--muted);
}

.btn.is-disabled {
  opacity: 0.45;
}

.edit-building-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-top: 2px dashed var(--border);
}

.edit-building-label {
  font-weight: 800;
}

/* ---------- 독점 현황 ---------- */

.mono-chip-row {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}

.mono-chip {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--paper-alt);
  border: 1px solid var(--border);
}

.mono-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 2px dashed var(--border);
}

.mono-row:first-of-type {
  border-top: none;
}

.mono-row-main {
  flex: 1;
  min-width: 0;
}

.mono-row-name {
  font-weight: 800;
}

.mono-row-detail {
  font-size: 0.8rem;
  color: var(--muted);
}

.mono-row.is-win {
  background: #f7ecd8;
  border-radius: var(--radius-md);
  padding: 8px;
}

.mono-win-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 0.8rem;
}

/* ---------- 국기 이모지 ---------- */

/* 윈도우 기본 폰트는 국기를 못 그려 "KR" 처럼 보인다. 국기 자리에만 컬러 이모지 폰트를 쓴다. */
.flag-emoji {
  font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-weight: 400;
  line-height: 1;
}

/* ---------- 금액 입력칸 ---------- */

.money-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.money-input {
  width: 100%;
  padding-right: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.money-input-suffix {
  position: absolute;
  right: 14px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
  pointer-events: none;
}

.amount-input-row .money-input-wrap {
  flex: 1;
}

/* ---------- 결제 ---------- */

.purchase-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 8px;
}

.purchase-bar-label {
  font-weight: 800;
  color: var(--muted);
}

.purchase-bar-amount {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.pay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 2px dashed var(--border);
}

.pay-row:first-of-type {
  border-top: none;
}

.pay-row-label {
  flex: 1;
  font-weight: 700;
  min-width: 0;
}

.pay-row-amount {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pay-row .money-input-wrap {
  flex: 0 0 58%;
}

.pay-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 3px solid var(--border);
  font-weight: 800;
}

.pay-total-amount {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.pay-change:empty::after {
  content: "";
}

/* ---------- 부동산 목록 행 정렬 다듬기 ---------- */

.property-row {
  align-items: center;
  gap: 12px;
}

.property-flag {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
  flex: 0 0 30px;
}

.property-row-top {
  gap: 6px;
  min-width: 0;
}

.property-row-top .property-name {
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-row-sub {
  gap: 6px;
  white-space: nowrap;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.toll-chip {
  padding: 0 6px;
  line-height: 1.5;
  font-size: 0.72rem;
}

.owner-badge {
  flex: 0 0 auto;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* 입력칸 placeholder 도 오른쪽 정렬이라 접미사와 겹치지 않게 여백을 준다. */
.money-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

/* 목록 행 안쪽 텍스트는 항상 왼쪽 기준으로 붙인다 (가운데로 밀려 보이던 문제). */
.property-row-main {
  align-items: flex-start;
  min-width: 0;
  overflow: hidden;
}

.property-row-top,
.property-row-sub {
  max-width: 100%;
  overflow: hidden;
}

/* ---------- 상세 화면 다듬기 ---------- */

/* 건설비·통행료 안내가 "원"만 다음 줄로 떨어지지 않게 한 덩어리로 붙인다. */
.building-detail-preset {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
}

.building-detail-row {
  gap: 10px;
}

.building-detail-info {
  min-width: 0;
}

.building-detail-row .btn-small {
  flex: 0 0 auto;
  min-width: 62px;
}

/* 결제 바가 마지막 카드 위를 덮지 않도록 본문 아래에 여유를 준다. */
.purchase-bar {
  padding: 0 2px 6px;
}

.app-footer .purchase-bar + .btn {
  margin: 0;
}

/* 금액 입력 화면은 내용이 적어 위쪽에 몰려 보인다. 화면 가운데로 모아준다. */
.amount-entry {
  margin: auto 0;
  gap: 14px;
}

.amount-display-row {
  justify-content: center;
}

.amount-input-row {
  gap: 10px;
}

/* 금액 표시가 길어지면 화면을 넘지 않게 줄인다. */
.amount-display {
  font-size: clamp(2rem, 11vw, 3rem);
  line-height: 1.15;
  text-align: center;
  word-break: keep-all;
}

.amount-input {
  text-align: right;
}

/* 목록 윗줄: 도시명은 늘어나고, 소유자 배지는 오른쪽 끝에 붙는다. */
.property-row-top {
  width: 100%;
  gap: 6px;
}

.property-row-top .property-name {
  flex: 0 1 auto;
}

.property-row-top .owner-badge {
  margin-left: auto;
}

.property-row-sub {
  width: 100%;
  overflow: visible;
}

/* ---------- 건물 채수 표시 ---------- */

.building-detail-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.count-badge {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-alt);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}

.count-badge.cart {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}

.building-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  align-items: stretch;
}

.building-detail-actions .btn-small {
  min-width: 70px;
}

/* 건물 액션은 가로로 눕혀 텍스트 영역을 넓게 쓴다. */
.building-detail-actions {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.building-detail-actions .btn-small {
  min-width: 0;
  padding: 8px 12px;
}

.building-detail-actions .btn-step {
  min-width: 36px;
  padding: 8px 0;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

/* 건설비·통행료 안내는 두 줄까지 자연스럽게 흐르게 둔다. */
.building-detail-preset {
  white-space: normal;
  overflow: visible;
}

/* 건물 행: 이름·정보는 한 줄 폭을 다 쓰고, 버튼은 그 아래 오른쪽에 모은다.
   (버튼이 옆에 붙으면 "별장" 같은 짧은 이름까지 세로로 쪼개졌다) */
.building-detail-row {
  flex-wrap: wrap;
  align-items: flex-start;
}

.building-detail-info {
  flex: 1 1 auto;
}

.building-detail-label {
  flex-wrap: wrap;
  white-space: nowrap;
}

.building-detail-actions {
  flex: 1 0 100%;
  justify-content: flex-end;
  margin-top: 2px;
}
