* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  width: 100%;
  overflow-x: hidden;
}
body {
  background: radial-gradient(circle at 50% 0%, #241a0f 0%, #0c0906 70%);
  color: #f0e2c0;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: 118px;
  overflow-x: hidden;
}
#app { width: 100%; max-width: 480px; margin: 0 auto; overflow-x: hidden; }
.brand {
  text-align: center; padding: 10px 0 0; font-weight: 800; font-size: 16px;
  letter-spacing: .5px; color: #ffd27a; text-shadow: 0 0 10px #ffd27a55;
}

.topbar {
  display: flex; gap: 10px; padding: 14px 12px;
  justify-content: space-between;
}
.stat {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 8px 14px; font-weight: 700; font-size: 15px; flex: 1; text-align: center;
}
.stat .ico { margin-right: 6px; }
.stat .cur { font-size: 10px; opacity: .6; margin-left: 4px; font-weight: 400; }
.lang-btn {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  color: #ffd27a; font-weight: 700; font-size: 12px; padding: 8px 10px; cursor: pointer;
  flex-shrink: 0;
}

.shaft-view { padding: 10px 16px; text-align: center; }

/* Живая сцена цитадели */
.citadel-scene {
  position: relative; height: 190px; border-radius: 16px; overflow: hidden;
  margin-bottom: 14px; border: 1px solid #4a3319;
  background-image: url('assets/citadel-bg.png'), linear-gradient(180deg, #1a1108 0%, #2b1c0d 60%, #1c1409 100%);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
.citadel-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,9,4,0) 55%, rgba(13,9,4,.78) 100%);
}
.portal {
  position: absolute; right: 14px; top: 18px; font-size: 26px;
  animation: portalSpin 6s linear infinite; opacity: .85;
  text-shadow: 0 0 10px #5fa8ff;
}
.phase-traveling .portal { animation-duration: 2.2s; }
@keyframes portalSpin { to { transform: rotate(360deg); } }

.path-glow {
  position: absolute; left: 20%; right: 18%; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, #ffd27a 0 6px, transparent 6px 14px);
  opacity: 0;
}
.phase-traveling .path-glow, .phase-departing .path-glow { opacity: .6; animation: pathPulse 1.2s linear infinite; }
@keyframes pathPulse { from { background-position: 0 0; } to { background-position: 40px 0; } }

.npc { position: absolute; bottom: 14px; font-size: 15px; opacity: .85; }
.npc-1 { left: 15%; animation: walk1 7s ease-in-out infinite; }
.npc-2 { left: 30%; animation: walk2 9s ease-in-out infinite; animation-delay: -2s; }
.npc-3 { left: 45%; bottom: 20px; animation: walk3 8s ease-in-out infinite; animation-delay: -4s; }
.npc-4 { left: 55%; bottom: 10px; font-size: 12px; opacity: .6; animation: flicker 1.4s ease-in-out infinite; }
@keyframes walk1 { 0%,100% { transform: translateX(0); } 50% { transform: translateX(28px); } }
@keyframes walk2 { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-22px); } }
@keyframes walk3 { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }
@keyframes flicker { 0%,100% { opacity: .5; transform: scale(1); } 50% { opacity: .9; transform: scale(1.15); } }

.party { position: absolute; bottom: 26px; left: 45%; font-size: 15px; opacity: 0; white-space: nowrap; }
.phase-departing .party-out { animation: partyLeave 2.6s ease forwards; }
.phase-ready .party-back { animation: partyReturn 2s ease forwards; }
@keyframes partyLeave {
  0% { left: 45%; opacity: 0; }
  15% { opacity: 1; }
  100% { left: 80%; opacity: 0; }
}
@keyframes partyReturn {
  0% { left: 80%; opacity: 0; }
  15% { opacity: 1; }
  100% { left: 42%; opacity: 1; }
}

.flash-collect::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 45% 65%, #ffe6a3aa 0%, transparent 60%);
  animation: collectFlash .7s ease-out;
}
@keyframes collectFlash { from { opacity: 1; } to { opacity: 0; } }

.mine-pill {
  position: absolute; top: 10px; left: 10px;
  background: #0f0a05cc; border: 1px solid #d9a441; color: #ffd27a;
  border-radius: 20px; padding: 6px 12px; font-size: 12px; cursor: pointer; z-index: 2;
}

.shift-box {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 14px;
  padding: 16px; margin-bottom: 12px;
}
.shift-label { font-size: 14px; opacity: .8; margin-bottom: 4px; }
.shift-timer { font-size: 22px; font-weight: 800; margin-bottom: 10px; color: #ffd27a; }

.btn-gold {
  background: linear-gradient(180deg, #ffe6a3, #d9a441);
  color: #2b1c0d; border: none; border-radius: 30px;
  padding: 14px 20px; font-weight: 800; font-size: 16px;
  width: 100%; cursor: pointer;
}
.btn-gold:disabled { opacity: .5; }

.danger-box {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 14px;
  padding: 12px; font-size: 13px; opacity: .9;
}
.danger-bar { height: 6px; background: #3a2a17; border-radius: 4px; margin: 8px 0; overflow: hidden; }
.danger-fill { height: 100%; background: #5fa8ff; width: 0%; }

.tabbar {
  position: fixed; bottom: 0; left: 50%; width: 100%; max-width: 480px;
  transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #150f08; border-top: 1px solid #4a3319;
  overflow: hidden;
}
.tab {
  min-width: 0; background: none; border: none; color: #cbb98a; padding: 9px 2px;
  font-size: 10px; line-height: 1.15; cursor: pointer; white-space: normal;
}
.tab.active { color: #ffd27a; }

.panel { padding: 14px 16px; }
.panel h2 { margin-bottom: 12px; font-size: 18px; }
.hidden { display: none !important; }

.upgrade-list { display: flex; flex-direction: column; gap: 10px; }
.upgrade-card {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 14px;
  padding: 12px 14px;
}
.upgrade-top { display: flex; justify-content: space-between; align-items: center; }
.upgrade-name { font-weight: 700; }
.upgrade-lvl { font-size: 12px; opacity: .7; }
.upgrade-effect { font-size: 12px; color: #ffd27a; margin: 6px 0; }
.upgrade-buy {
  background: linear-gradient(180deg, #ffe6a3, #d9a441); color: #2b1c0d;
  border: none; border-radius: 20px; padding: 8px 14px; font-weight: 700; cursor: pointer;
  width: 100%;
}
.upgrade-buy:disabled { opacity: .4; }

.daily-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.daily-cell {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 10px;
  padding: 10px 4px; text-align: center; font-size: 12px;
}
.daily-cell.active { border-color: #ffd27a; box-shadow: 0 0 8px #ffd27a55; }
.daily-cell .d { opacity: .7; }
.daily-cell .v { font-weight: 800; margin-top: 4px; }

.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter-card {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 12px 14px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
}
.chapter-card.locked { opacity: .4; }
.chapter-card .badge { font-size: 11px; color: #ffd27a; }
.chapter-card .new-dot { width: 8px; height: 8px; border-radius: 50%; background: #5fd97a; }

/* Задания */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-card {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 12px 14px;
}
.task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.task-title { font-weight: 700; font-size: 14px; }
.task-reward { font-size: 12px; color: #ffd27a; }
.task-progress { font-size: 11px; opacity: .7; margin-bottom: 8px; }
.task-btn {
  width: 100%; border: none; border-radius: 18px; padding: 8px; font-weight: 700; cursor: pointer;
  background: linear-gradient(180deg, #ffe6a3, #d9a441); color: #2b1c0d;
}
.task-btn:disabled { opacity: .4; background: #3a2a17; color: #cbb98a; }

/* Друзья */
.friends-info { font-size: 13px; opacity: .85; margin-bottom: 14px; line-height: 1.5; }
.ref-link-box {
  display: flex; gap: 8px; align-items: center;
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 14px;
}
#refLinkText { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-mini {
  background: #3a2a17; color: #ffd27a; border: 1px solid #d9a441; border-radius: 14px;
  padding: 6px 12px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.friends-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.fstat {
  flex: 1; background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 12px; text-align: center;
}
.fval { font-size: 20px; font-weight: 800; color: #ffd27a; }
.flabel { font-size: 11px; opacity: .7; margin-top: 2px; }
.friends-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 10px;
  padding: 10px 12px; display: flex; justify-content: space-between; font-size: 13px;
}

/* История */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 10px;
  padding: 10px 12px; display: flex; justify-content: space-between; align-items: center;
}
.hist-label { font-size: 13px; }
.hist-time { font-size: 11px; opacity: .6; }
.hist-amount { font-weight: 800; font-size: 14px; }
.hist-amount.pos { color: #6fd97a; }
.hist-amount.neg { color: #e08a6a; }
.empty-note { text-align: center; opacity: .5; font-size: 13px; padding: 20px 0; }

/* Выбор шахты */
.mine-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 60vh; overflow-y: auto; }
.mine-card {
  background: #241a0f; border: 1px solid #4a3319; border-radius: 12px;
  padding: 12px 14px; cursor: pointer;
}
.mine-card.current { border-color: #ffd27a; box-shadow: 0 0 8px #ffd27a44; }
.mine-card.locked { opacity: .45; cursor: not-allowed; }
.mine-card .mn-top { display: flex; justify-content: space-between; font-weight: 700; }
.mine-card .mn-desc { font-size: 12px; opacity: .8; margin-top: 4px; }
.mine-card .mn-badge { font-size: 11px; color: #ffd27a; }

/* AUREL */
.aurel-tagline { font-size: 14px; font-weight: 700; color: #ffd27a; margin-bottom: 10px; line-height: 1.4; }
.aurel-disclaimer { font-size: 11px; opacity: .6; margin-bottom: 16px; line-height: 1.5; font-style: italic; }
.aurel-detail-box {
  background: #1c140b; border: 1px solid #4a3319; border-radius: 12px;
  padding: 4px 14px; margin-top: 4px;
}
.aurel-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid #2a1e10; font-size: 13px;
}
.aurel-row:last-child { border-bottom: none; }

#aurelPanel {
  position: relative;
  background-image: url('assets/vault-bg.png');
  background-size: cover; background-position: center;
  border-radius: 16px; margin: 0 16px 16px;
  padding: 14px 16px;
}
#aurelPanel::before {
  content: ''; position: absolute; inset: 0; border-radius: 16px; z-index: 0;
  background: linear-gradient(180deg, rgba(12,9,6,.55) 0%, rgba(12,9,6,.88) 100%);
}
#aurelPanel > * { position: relative; z-index: 1; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-box {
  background: #1c140b; border: 1px solid #d9a441; border-radius: 16px;
  padding: 20px; max-width: 420px; width: 100%;
}
.modal-speaker { color: #ffd27a; font-size: 13px; margin-bottom: 4px; }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.modal-text { font-size: 15px; line-height: 1.5; margin-bottom: 16px; white-space: pre-wrap; }

.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #2b1c0d; border: 1px solid #d9a441; color: #ffd27a;
  padding: 10px 18px; border-radius: 20px; font-size: 13px; z-index: 60;
}
