/* 공통 버튼 & 아이콘 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-main);
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.085);
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(135deg, #d8a43a, #f3c969);
  color: #15120a;
  border-color: transparent;
}

.btn-gold:hover:not(:disabled) {
  filter: brightness(1.06);
  background: linear-gradient(135deg, #d8a43a, #f3c969);
}

.btn-primary {
  background: var(--accent-indigo);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-indigo-light);
  border-color: transparent;
}

.btn-danger {
  background: rgba(251, 113, 133, 0.13);
  border-color: rgba(251, 113, 133, 0.35);
  color: var(--accent-crimson);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-main);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.icon-btn.active {
  background: rgba(99, 102, 241, 0.16);
  color: var(--accent-indigo-light);
  border-color: rgba(99, 102, 241, 0.32);
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-chip:hover:not(:disabled) {
  border-color: var(--accent-indigo-light);
  background: rgba(99, 102, 241, 0.14);
}

.btn-chip.chip-gold {
  border-color: var(--border-gold);
  color: var(--accent-gold);
  background: rgba(243, 201, 105, 0.12);
}

.btn-text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.btn-text-link:hover {
  color: var(--accent-indigo-light);
}

/* 입력 폼 요소 */
input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-indigo-light);
  background: rgba(255, 255, 255, 0.065);
}

select option {
  background: #141722;
  color: var(--text-main);
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* 아바타 배지 */
.entity-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.entity-avatar.avatar-xs {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 11px;
  margin-top: 2px;
}

.entity-avatar.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
}

.entity-avatar.avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 18px;
}

.avatar-npc {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(16, 185, 129, 0.08));
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.avatar-nation {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(129, 140, 248, 0.08));
  color: var(--accent-indigo-light);
  border: 1px solid rgba(129, 140, 248, 0.3);
}

.avatar-faction {
  background: linear-gradient(135deg, rgba(243, 201, 105, 0.2), rgba(245, 158, 11, 0.08));
  color: var(--accent-gold);
  border: 1px solid rgba(243, 201, 105, 0.28);
}

/* 공통 태그 & 필 */
.pill-subtle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.045);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.meta-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.055);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

/* 카드 & 좌측 성좌 패널 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.hero-profile-card {
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.1), rgba(243, 201, 105, 0.05) 75%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 13px;
}

.hero-modifier {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.01em;
}

.hero-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1px;
}

.hero-persona-line {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.hero-persona-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.faith-modern-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.faith-metric {
  background: rgba(9, 10, 15, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.faith-metric-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.faith-metric-top strong {
  font-size: 14px;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.faith-metric-top em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.faith-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.faith-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-indigo-light));
  border-radius: 99px;
}

.faith-caption {
  font-size: 10px;
  color: var(--text-dim);
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-heading {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 2px;
}

.clean-list {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 11px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

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

.stat-label-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.stat-title-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.stat-label-col strong {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-main);
  white-space: nowrap;
}

.stat-sub-formula {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.38;
}

.stat-action-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.stat-lv {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.inventory-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inv-chip {
  font-size: 11.5px;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}

.inv-chip strong {
  color: var(--accent-gold);
  margin-left: 3px;
}

.empty-inline {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 2px;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.rank-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-name em {
  font-style: normal;
  display: inline-block;
  width: 16px;
  color: var(--text-dim);
  font-weight: 600;
}

.rank-val {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 우측 존재 목록 모던 카드 */
.entity-modern-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.entity-modern-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.entity-modern-card.card-selected {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.07);
}

.entity-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-head-text {
  min-width: 0;
  flex: 1;
}

.entity-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.entity-name-row strong {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-role-line {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-state-clamp {
  font-size: 12px;
  color: rgba(241, 243, 249, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.entity-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.entity-loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-loc.moving {
  color: var(--accent-indigo-light);
}

.entity-aff-inline {
  display: flex;
  gap: 7px;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.entity-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}

.entity-card-actions .btn-entity-chat {
  flex: 1;
}

/* 연대기 피드 */
.chronicle-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-feed-box {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 16px;
}

.empty-feed-box p {
  font-size: 13px;
  color: var(--text-muted);
}

.empty-feed-box span {
  font-size: 11.5px;
}

.oracle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.oracle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.oracle-actor {
  font-size: 11px;
  color: var(--text-dim);
}

.oracle-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-main);
}

.oracle-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.oracle-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.oracle-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 다이스 판정 배지 */
.dice-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 650;
}

.outcome-대성공 { background: rgba(243, 201, 105, 0.16); color: var(--accent-gold); border: 1px solid rgba(243, 201, 105, 0.35); }
.outcome-성공 { background: rgba(52, 211, 153, 0.14); color: var(--accent-emerald); }
.outcome-부분성공 { background: rgba(99, 102, 241, 0.16); color: var(--accent-indigo-light); }
.outcome-실패 { background: rgba(251, 191, 36, 0.15); color: var(--accent-amber); }
.outcome-대실패 { background: rgba(251, 113, 133, 0.16); color: var(--accent-crimson); border: 1px solid rgba(251, 113, 133, 0.35); }

/* 인증 화면 */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-popover);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

.tabs .btn {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 8px 10px;
  gap: 5px;
  white-space: nowrap;
}

.tab-sub {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 650;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.24);
  opacity: 0.92;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 모달 & 토스트 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-content {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  background: #12151f;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-popover);
}

.modal-header-sticky {
  position: sticky;
  top: -22px;
  margin: -22px -22px 2px;
  padding: 16px 22px 12px;
  background: rgba(18, 21, 31, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  z-index: 6;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: rgba(24, 27, 38, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  padding: 10px 15px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
