/* V1.13.4 full-interface density audit. Loaded last to resolve legacy spacing conflicts. */
:root {
  --ui-density-line: 1.38;
  --ui-density-tight: 1.26;
  --ui-density-gap: 6px;
  --ui-density-section: 13px;
}

body { line-height: var(--ui-density-line); }
.content { padding: 10px 12px calc(78px + var(--safe-bottom)); }
.page-heading { gap: 8px; margin: 0 0 10px; }
.page-heading h2 { font-size: 20px; line-height: 1.16; letter-spacing: .045em; }
.page-heading p { margin-top: 2px; font-size: 10px; line-height: 1.28; }
.eyebrow { font-size: 9px; letter-spacing: .13em; }

.section-title { gap: 7px; margin: var(--ui-density-section) 0 6px; }
.section-title h3 { font-size: 13px; line-height: 1.2; font-weight: 550; }
.section-title .heading-actions { gap: 4px; }
.pill { padding: 1px 5px; font-size: 8px; line-height: 1.45; }

.card { padding: 9px 10px; border-radius: 7px; }
.card h3,
.card h4 { margin-bottom: 3px; font-size: 13px; line-height: 1.28; }
.card p { font-size: 10px; line-height: 1.42; }
.card-grid { gap: 6px; }
.action-card { min-height: 88px; }

.hero-card { min-height: 146px; padding: 15px; }
.hero-card::before { inset: 9px; }
.hero-card h2 { margin: 3px 0 5px; font-size: 25px; line-height: 1.18; }
.hero-card p { margin-block: 4px; font-size: 11px; line-height: 1.48; }
.hero-mark { right: 13px; bottom: -22px; font-size: 112px; }
.progress-track { margin: 8px 0 4px; }
.meta-row { font-size: 9px; line-height: 1.2; }

.list { gap: 4px; }
.list-item { min-height: 48px; padding: 7px 9px; gap: 7px; border-radius: 6px; }
.list-item .title { font-size: 12px; line-height: 1.25; font-weight: 550; }
.list-item .sub { margin-top: 2px; font-size: 9px; line-height: 1.34; }
.item-stats { gap: 4px; margin-top: 2px; font-size: 8px; line-height: 1.3; }
.row-actions,
.heading-actions { gap: 4px; }
.row-actions > b { font-size: 10px; }

.stat-grid { gap: 4px; }
.stat { min-height: 42px; padding: 5px 7px; border-radius: 5px; }
.stat span { font-size: 8px; line-height: 1.18; }
.stat b { margin-top: 1px; font-size: 14px; line-height: 1.18; font-weight: 500; }

.tabs { gap: 3px; padding: 3px; }
.tab,
.chat-panel nav button { min-height: 31px !important; padding-inline: 8px !important; font-size: 9px !important; }
.two-actions,
.three-actions,
.modal-actions { gap: 5px; }

.movement-rule { gap: 3px; margin-bottom: 8px; padding: 9px 10px; }
.movement-rule b { font-size: 13px; line-height: 1.25; }
.movement-rule span,
.map-hint { font-size: 9px; line-height: 1.42; }
.team-assist { padding: 5px 7px; font-size: 9px; line-height: 1.38; }
.sweep-rule { gap: 4px; margin-top: 7px; }
.sweep-rule span { padding: 3px 6px; font-size: 8px; }

.dungeon-selector { gap: 5px; margin-bottom: 8px; padding-bottom: 5px; }
.dungeon-chip { flex-basis: 110px; min-height: 48px; padding: 6px 8px; }
.dungeon-chip b { font-size: 8px; }
.dungeon-chip span { margin-top: 2px; font-size: 11px; line-height: 1.25; }
.forge-summary { gap: 4px; margin-bottom: 8px; }
.forge-summary span { padding: 4px 7px; font-size: 8px; }

.profile-hero { grid-template-columns: 60px minmax(0,1fr); gap: 11px; padding: 12px; }
.profile-avatar { width: 58px; height: 58px; }
.profile-hero h2 { margin: 2px 0 3px; font-size: 18px; line-height: 1.2; }
.profile-hero p { margin-top: 3px; font-size: 9px; line-height: 1.38; }
.profile-stats,
.title-bonus-card { margin-top: 6px; }

.achievement-grid,
.honor-grid { gap: 5px; }
.achievement-card,
.honor-card { padding: 9px; }
.achievement-card h3 { margin: 3px 0; font-size: 12px; }
.achievement-card p { min-height: 0; font-size: 9px; line-height: 1.36; }
.honor-card h3 { margin: 5px 0; }
.honor-card h3 .name-title { font-size: 12px; }
.honor-card p { min-height: 0; font-size: 9px; line-height: 1.38; }
.honor-meta { margin-top: 5px; font-size: 8px; }
.honor-card > small { min-height: 0; margin-top: 4px; font-size: 8px; line-height: 1.35; }
.honor-card footer { margin-top: 6px; }
.unlock-state { padding: 5px; font-size: 9px; }

.role-grid { gap: 6px; margin-top: 9px; }
.role-card { padding: 9px; }
.role-card h3 { margin: 4px 0 3px; font-size: 14px; }
.role-card p { min-height: 0; margin-bottom: 6px; font-size: 9px; line-height: 1.38; }
.role-badge { padding: 2px 5px; font-size: 8px; }
.refined-role-grid { align-items: stretch; grid-auto-rows: 1fr; }
.refined-role-grid .role-card { display: flex; height: 100%; flex-direction: column; }
.refined-role-grid .role-badge { align-self: flex-start; }
.refined-role-grid .role-card p { flex: 1 1 auto; }
.refined-role-grid .role-card > button {
  flex: 0 0 auto;
  min-height: 34px;
  margin-top: auto;
  padding-inline: 4px;
  overflow: hidden;
  font-size: clamp(8px,2.3vw,10px);
  letter-spacing: -.045em;
  line-height: 1;
  text-overflow: clip;
  white-space: nowrap;
}
.career-hero { gap: 9px; padding: 12px; }
.career-hero h2 { margin: 3px 0; font-size: 21px; }
.career-hero p { font-size: 9px; line-height: 1.38; }
.career-trial-panel { margin-top: 7px; padding: 9px; }
.career-condition-grid,
.career-skill-grid { gap: 5px; }
.career-condition { padding: 6px; }
.career-condition b { font-size: 10px; }
.career-condition small,
.trial-note { font-size: 8px; line-height: 1.35; }
.career-skill-card { gap: 6px; padding: 7px 8px; }
.career-skill-card h3 { font-size: 11px; }
.career-skill-card p { margin-top: 2px; font-size: 8px; line-height: 1.32; }

.pet-dungeon-levels { gap: 5px; margin-bottom: 9px; }
.pet-dungeon-level { gap: 7px; padding: 7px 8px; }
.pet-dungeon-level b { font-size: 11px; }
.pet-dungeon-level span,
.pet-dungeon-level small { font-size: 8px; line-height: 1.32; }
.pet-skill-line { gap: 1px; margin-top: 5px; padding: 5px 7px; }
.pet-skill-line b { font-size: 10px; }
.pet-skill-line span,
.pet-skill-line small { font-size: 8px; }

.rank-summary { margin-bottom: 8px; padding: 11px; }
.rank-summary b { margin: 2px; font-size: 24px; }
.rank-summary span,
.rank-summary small { font-size: 8px; }
.match-events { margin-top: 5px; padding-left: 15px; font-size: 9px; line-height: 1.42; }
.stance-current { gap: 3px; padding: 8px; }

.chance-panel { padding: 9px 10px; }
.chance-panel > span { font-size: 9px; }
.chance-panel > b { margin: 3px 0; font-size: 27px; line-height: 1.2; }
.chance-panel p { margin-top: 3px; font-size: 10px; line-height: 1.42; }
.boost-select { gap: 4px; margin: 8px 0; }
.boost-select span { font-size: 10px; }
.boost-select small { font-size: 8px; line-height: 1.32; }
.sale-total { margin: 7px 0 9px; padding: 7px 9px; font-size: 10px; }

.modal { padding: 13px 13px calc(13px + var(--safe-bottom)); }
.modal h2 { margin-bottom: 6px; font-size: 18px; line-height: 1.2; }
.modal p { font-size: 10px; line-height: 1.46; }
.modal .field { gap: 4px; margin-block: 7px; font-size: 9px; }
.inventory-detail-hero { width: 108px; height: 108px; margin: 3px auto 8px; }
.equipment-detail-actions { gap: 5px; margin-top: 7px; }
.equipment-detail-actions button { min-height: 34px; }

.bag-item-detail { gap: 7px; }
.bag-item-detail > header { grid-template-columns: 56px minmax(0,1fr); gap: 8px; }
.bag-item-detail .bag-item-detail-icon { width: 56px; height: 56px; }
.bag-item-detail h3 { margin: 2px 0 1px; font-size: 16px; }
.bag-item-description { padding: 6px 8px; font-size: 9px !important; line-height: 1.44 !important; }
.bag-item-detail dl > div { grid-template-columns: 54px minmax(0,1fr); gap: 6px; padding: 5px 2px; }
.bag-item-detail dt { font-size: 8px; }
.bag-item-detail dd { font-size: 9px; line-height: 1.36; }
.bag-detail-actions { margin-top: 7px; }

.inventory-showcase { margin-bottom: 8px; padding: 9px 8px 7px; }
.inventory-showcase > header { padding-bottom: 5px; }
.inventory-slot-column { gap: 6px; }
.inventory-combat-summary { gap: 4px; }
.inventory-combat-summary > span { gap: 4px; padding: 4px 6px; }
.inventory-compact-summary { gap: 4px; margin-bottom: 5px; }
.inventory-compact-summary span { padding: 2px 5px; font-size: 8px; }
.inventory-compact-grid { gap: 5px; }
.inventory-compact-grid .compact-item-art .inventory-art-icon {
  width: 78%;
  height: 78%;
  margin: auto;
  padding: 0;
  opacity: .62;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.34));
}
.compact-inventory-list { gap: 3px; }
.compact-inventory-row { min-height: 43px; padding: 5px 7px; gap: 5px; }
.compact-inventory-row.item-resource-row { grid-template-columns: 34px minmax(0,1fr) auto; }
.compact-material-icon { width: 34px; height: 34px; }

.feature-card { min-height: 102px; }
.feature-card-art { width: 54px; height: 54px; margin-bottom: 1px; }
.world-entry-card { min-height: 132px; padding: 7px; }
.world-entry-art { width: 76px; height: 76px; }
.home-art-card { min-height: 118px; padding: 7px; }
.home-entry-art { width: 60px; height: 60px; }
.home-daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.realm-meditate-btn {
  min-height: 0 !important;
  padding: 2px 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--gold) !important;
  box-shadow: none !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
}
.realm-meditate-btn:hover { color: var(--text) !important; }
.realm-breakthrough-action { margin-top: 9px; }
.realm-breakthrough-action .primary { width: 100%; }

.tactical-toolbar { gap: 5px; margin-bottom: 5px; }
.tactical-toolbar > div:first-child { gap: 1px; }
.tactical-toolbar > div:last-child { gap: 3px; }
.tactical-toolbar small { font-size: 8px; }
.tactical-stats { gap: 3px; margin-bottom: 5px; }
.tactical-stats span { padding: 4px 3px; font-size: 8px; }
.map-tools { gap: 5px; margin: 3px 0 5px; font-size: 8px; }
.compact-hint { gap: 5px; padding: 5px 7px; }
.compact-hint b { font-size: 8px; }
.tactical-log { margin-top: 5px; max-height: 92px; padding: 6px 7px; font-size: 9px; line-height: 1.38; }
.tactical-log p,
.wheel-log p { margin-bottom: 2px; }
.tactical-encounter { margin-bottom: 8px; padding: 9px; }
.tactical-map-stage { position: relative; }
.tactical-map-stage > .tactical-encounter {
  position: absolute;
  z-index: 32;
  top: 7px;
  right: 7px;
  left: 7px;
  max-height: calc(100% - 14px);
  margin: 0;
  overflow-y: auto;
  border-color: rgba(201,169,106,.62);
  background: rgba(9,16,13,.97);
  box-shadow: 0 12px 34px rgba(0,0,0,.62);
}
.tactical-map-stage > .tactical-encounter.ambushed { border-color: rgba(213,95,85,.76); box-shadow: 0 12px 34px rgba(0,0,0,.62), inset 0 0 18px rgba(155,49,43,.12); }
.encounter-combatants { display: grid; grid-template-columns: minmax(0,1fr) 28px minmax(0,1fr); align-items: center; gap: 5px; margin: 7px 0; }
.encounter-combatants .encounter-side { min-width: 0; }
.encounter-combatants .encounter-side h3 { overflow: hidden; margin: 0 0 4px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.encounter-combatants .encounter-vs { font-size: 12px; }
.encounter-team-status { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 5px 0; color: var(--muted); font-size: 8px; }
.encounter-team-status > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.encounter-team-status .text-btn { flex: 0 0 auto; min-height: 0; padding: 2px 0; border: 0; background: none; color: var(--gold); font-size: 8px; }
.encounter-stage { gap: 6px; margin: 8px 0; }
.encounter-side h3 { margin: 3px 0; font-size: 13px; }
.encounter-portrait { height: 82px; }
.encounter-log { min-height: 36px; padding: 5px 7px; font-size: 9px; line-height: 1.35; }
.encounter-actions { gap: 4px; margin-top: 6px; }
.encounter-actions .small-btn { min-height: 34px; }
.encounter-actions.player-encounter-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: visible; }
.encounter-actions.player-encounter-actions button { min-width: 0; min-height: 31px; padding: 4px 3px; font-size: 9px; }
.objective-marker { position: relative; z-index: 2; display: grid; width: 70%; height: 70%; place-items: center; border: 1px solid rgba(212,181,103,.72); border-radius: 50%; background: rgba(61,46,21,.84); color: #f0d68b; font: 700 10px serif; box-shadow: 0 0 8px rgba(215,176,77,.45); }
.tactical-board .terrain-fence { cursor: not-allowed; }
.loot-item,
.wipe-result { padding: 10px; }
.loot-item h3 { margin: 4px 0; font-size: 17px; }
.loot-item p,
.wipe-result p { margin: 3px 0; font-size: 9px; line-height: 1.4; }
.loot-roll-list { gap: 3px; margin: 6px 0; }
.loot-roll-list p { padding: 5px 7px; font-size: 9px; }

.chat-panel header { padding: 7px 9px; }
.chat-panel header b { font-size: 13px; }
.chat-log { padding: 7px 8px; }
.chat-log p { gap: 4px; margin-bottom: 6px; font-size: 9px; line-height: 1.38; }
.chat-compose { gap: 4px; padding: 5px; }
.message-bubbles { gap: 5px; }
.message-bubble { min-height: 54px; padding: 6px; grid-template-columns: 32px 1fr 18px; gap: 6px; }
.message-bubble-icon { width: 30px; height: 30px; font-size: 16px; }
.message-bubble b { font-size: 11px; }
.message-bubble small { margin-top: 1px; font-size: 8px; line-height: 1.34; }

.divine-set-tabs { gap: 5px; }
.divine-set-tab { min-height: 50px; padding: 6px; }
.divine-set-tab b { font-size: 12px; }
.divine-set-tab span { margin-top: 2px; font-size: 8px; }
.divine-set-detail { margin-top: 6px; padding: 9px; }
.divine-set-detail h3 { margin: 2px 0; }
.divine-set-detail header p { line-height: 1.38; }
.divine-piece-grid { gap: 4px; margin-top: 6px; }
.divine-piece-grid article { gap: 4px; padding: 6px; }

/* V1.15 account and cloud-sync surfaces. */
.auth-gate,
.auth-status-card,
.offline-access-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(201,169,106,.2);
  border-radius: 8px;
  background: linear-gradient(145deg,rgba(19,31,26,.96),rgba(10,18,15,.96));
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.auth-gate { padding: 13px; }
.auth-gate header h2 { margin: 3px 0 3px; font: 500 19px/1.2 serif; letter-spacing: .06em; }
.auth-gate header p,
.auth-safety,
.auth-feedback { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.auth-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; margin: 11px 0 8px; padding: 3px; border-radius: 6px; background: rgba(4,10,7,.52); }
.auth-tabs button { min-height: 30px !important; padding: 4px 8px !important; border-color: transparent !important; background: transparent !important; color: var(--muted); font-size: 10px !important; }
.auth-tabs button.selected { border-color: rgba(111,157,138,.46) !important; background: #233a31 !important; color: var(--paper); }
.auth-fields { display: grid; gap: 6px; }
.auth-fields label { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.auth-fields input { width: 100%; min-width: 0; }
.auth-submit { min-height: 36px !important; margin-top: 9px !important; font-size: 11px !important; }
.auth-offline-link { display: block; min-height: 24px !important; margin: 7px auto 2px; padding: 2px 5px !important; border: 0 !important; background: transparent !important; color: var(--gold) !important; box-shadow: none !important; font-size: 9px !important; }
.auth-safety { display: block; margin-top: 6px; text-align: center; }
.auth-feedback { margin-top: 7px; padding: 5px 7px; border-radius: 4px; background: rgba(185,111,102,.1); color: #d7aaa3; text-align: center; }
.auth-feedback.verify { background: rgba(201,169,106,.1); color: #dbc899; }
.auth-status-card { display: grid; gap: 8px; padding: 10px 11px; }
.auth-status-main { display: grid; grid-template-columns: 9px minmax(0,1fr); align-items: center; gap: 8px; }
.auth-status-main small,
.offline-access-card small { display: block; color: var(--gold); font-size: 8px; letter-spacing: .11em; }
.auth-status-main b,
.offline-access-card b { display: block; margin-top: 1px; overflow: hidden; font-size: 11px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.auth-status-main p,
.offline-access-card p { margin: 2px 0 0; color: var(--muted); font-size: 8px; line-height: 1.38; }
.auth-orb { width: 7px; height: 7px; border-radius: 50%; background: #72ba9c; box-shadow: 0 0 9px rgba(114,186,156,.66); }
.cloud-error .auth-orb,
.cloud-conflict .auth-orb { background: #c77c70; box-shadow: 0 0 9px rgba(199,124,112,.58); }
.cloud-syncing .auth-orb,
.cloud-connecting .auth-orb { background: #d1b16f; animation: breathe 1.4s infinite; }
.cloud-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
.cloud-actions button { min-width: 0; min-height: 30px !important; padding: 3px 4px !important; overflow: hidden; font-size: 9px !important; text-overflow: ellipsis; white-space: nowrap; }
.cloud-actions .quiet { border-color: var(--line); color: var(--muted); }
.offline-access-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; margin-bottom: 10px; padding: 9px 10px; }
.offline-access-card button { min-height: 29px !important; padding-inline: 8px !important; font-size: 9px !important; }
.cloud-integrity-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; margin-top: 6px; }
.cloud-integrity-card b { display: block; font-size: 11px; font-weight: 550; }
.cloud-integrity-card small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.38; }
.cloud-conflict { padding: 8px 9px; border: 1px solid rgba(199,124,112,.25); border-radius: 6px; background: rgba(74,34,30,.12); }
.cloud-conflict b { font-size: 13px; }
.cloud-conflict p,
.cloud-conflict-note { margin: 3px 0 0 !important; font-size: 9px !important; }
.cloud-save-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.cloud-save-choices article { display: grid; gap: 3px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(8,15,12,.54); }
.cloud-save-choices span,
.cloud-save-choices small { color: var(--muted); font-size: 8px; }
.cloud-save-choices b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.cloud-save-choices button { min-width: 0; min-height: 31px !important; margin-top: 3px !important; padding: 3px 4px !important; font-size: 9px !important; }
.onboarding .auth-gate-onboarding { width: 100%; max-width: 420px; margin-inline: auto; }
.onboarding .auth-status-card { margin-bottom: 10px; }

@media (min-width:600px) {
  .content { padding-inline: 18px; }
  .hero-card { min-height: 160px; padding: 18px; }
}

@media (max-width:360px) {
  .content { padding-inline: 9px; }
  .page-heading h2 { font-size: 19px; }
  .card { padding: 8px; }
  .world-entry-card { min-height: 124px; }
  .world-entry-art { width: 70px; height: 70px; }
}
