/* css/mine.css — Phòng Mỏ Đá */

/* ══ Wrapper ══════════════════════════════════════════════════ */
.mine-room-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  box-sizing: border-box;
}

/* ══ Header ═══════════════════════════════════════════════════ */
.mine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #2a2a3e, #1a1a2e);
  border: 1px solid #6c3d00;
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 0 2px 12px rgba(180, 100, 0, 0.2);
}

.mine-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0a030;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mine-icon {
  font-size: 1.4rem;
  animation: mine-swing 1.2s ease-in-out infinite alternate;
}

@keyframes mine-swing {
  from { transform: rotate(-15deg); }
  to   { transform: rotate(15deg); }
}

.mine-player-count {
  color: #aaa;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ══ Arena ════════════════════════════════════════════════════ */
.mine-arena {
  background: linear-gradient(160deg, #1c1c2e 0%, #12121f 100%);
  border: 1px solid #333;
  border-radius: 18px;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

/* ══ HP Bar ═══════════════════════════════════════════════════ */
.mine-hp-bar-wrap {
  width: 100%;
}

.mine-hp-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #bbb;
  margin-bottom: 6px;
  font-weight: 600;
}

.mine-hp-bar-bg {
  width: 100%;
  height: 18px;
  background: #1a1a2e;
  border-radius: 999px;
  border: 1px solid #333;
  overflow: hidden;
  position: relative;
}

.mine-hp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e65c00, #f9d423);
  border-radius: 999px;
  transition: width 0.18s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  z-index: 1;
}

.mine-hp-bar-fill::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  right: 6px;
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
}

/* Flash đỏ khi bị trừ máu */
.mine-hp-dmg-flash {
  position: absolute;
  inset: 0;
  background: rgba(255, 50, 50, 0.5);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.mine-hp-dmg-flash.flash {
  animation: mine-flash 0.25s ease-out;
}

@keyframes mine-flash {
  0%   { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ══ Cục Đá ═══════════════════════════════════════════════════ */
.mine-rock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mine-rock {
  width: 130px;
  height: 130px;
  cursor: pointer;
  user-select: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #555, #222);
  box-shadow:
    0 0 0 4px #333,
    0 0 30px rgba(180, 100, 0, 0.25),
    inset 0 4px 8px rgba(255,255,255,0.08);
  transition: transform 0.07s, box-shadow 0.07s;
  -webkit-tap-highlight-color: transparent;
}

.mine-rock:active,
.mine-rock.hitting {
  transform: scale(0.90) rotate(-3deg);
  box-shadow:
    0 0 0 2px #555,
    0 0 12px rgba(255,100,0,0.4),
    inset 0 2px 4px rgba(255,255,255,0.05);
}

.mine-rock-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mine-rock-emoji {
  font-size: 4.5rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
  pointer-events: none;
}

/* Vết nứt hiện ra theo HP */
.mine-rock-cracks {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  opacity: 0;
  background-image:
    radial-gradient(ellipse at 40% 35%, transparent 42%, rgba(255,255,255,0.08) 43%, transparent 44%),
    linear-gradient(135deg, transparent 48%, rgba(255,255,255,0.06) 49%, transparent 50%);
  transition: opacity 0.3s;
}

.mine-rock.cracked-1 .mine-rock-cracks { opacity: 0.4; }
.mine-rock.cracked-2 .mine-rock-cracks { opacity: 0.75; }
.mine-rock.cracked-3 .mine-rock-cracks { opacity: 1; }

.mine-rock-hint {
  font-size: 0.75rem;
  color: #666;
  margin: 0;
  text-align: center;
}

/* ══ Số trừ máu nổi lên ══════════════════════════════════════ */
.mine-dmg-numbers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.mine-dmg-number {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 900;
  color: #ff6b35;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  animation: mine-dmg-float 0.8s ease-out forwards;
}

@keyframes mine-dmg-float {
  0%   { transform: translateY(0) scale(1);    opacity: 1; }
  60%  { transform: translateY(-50px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-80px) scale(0.8); opacity: 0; }
}

/* ══ Reward Toast ═════════════════════════════════════════════ */
.mine-reward-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: linear-gradient(135deg, #f9a825, #e65c00);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
  padding: 16px 32px;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(249,168,37,0.6);
  z-index: 999;
  pointer-events: none;
  animation: mine-reward-pop 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes mine-reward-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  60%  { opacity: 1; transform: translate(-50%, -65%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

/* ══ Feed bảng tin ════════════════════════════════════════════ */
.mine-feed {
  width: 100%;
  background: #13131f;
  border: 1px solid #2a2a3e;
  border-radius: 12px;
  padding: 10px 12px;
  max-height: 130px;
  overflow-y: auto;
}

.mine-feed-title {
  font-size: 0.78rem;
  color: #888;
  margin: 0 0 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mine-feed-item {
  font-size: 0.8rem;
  color: #ccc;
  padding: 3px 0;
  border-bottom: 1px solid #1e1e30;
  animation: mine-feed-in 0.3s ease-out;
}

.mine-feed-item:last-child { border-bottom: none; }
.mine-feed-item .mine-feed-name { color: #f0a030; font-weight: 700; }
.mine-feed-item .mine-feed-amount { color: #4caf50; font-weight: 700; }

@keyframes mine-feed-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══ Danh sách người ══════════════════════════════════════════ */
.mine-players-section {
  background: #13131f;
  border: 1px solid #2a2a3e;
  border-radius: 12px;
  padding: 10px 12px;
}

.mine-players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mine-player-chip {
  background: #1e1e30;
  border: 1px solid #333;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  color: #ccc;
}

/* ══ Lobby card phòng mỏ ══════════════════════════════════════ */
.mine-lobby-card {
  background: linear-gradient(135deg, #1e1a10, #2a2010);
  border: 2px solid #8b6914;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(180, 130, 0, 0.15);
  margin-bottom: 14px;
}

.mine-lobby-card:hover,
.mine-lobby-card:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(180, 130, 0, 0.3);
  border-color: #f0a030;
}

.mine-lobby-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mine-lobby-badge {
  display: inline-block;
  background: #8b6914;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  width: fit-content;
}

.mine-lobby-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f0a030;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mine-lobby-sub {
  font-size: 0.75rem;
  color: #999;
}

.mine-lobby-right {
  font-size: 2rem;
}

/* Screen phòng mỏ (toàn màn hình giống game-screen) */
#mine-screen {
  padding: 0;
  display: none;
  flex-direction: column;
}

#mine-screen.active {
  display: flex;
}

.mine-screen-header {
  background: #0e0e1a;
  border-bottom: 1px solid #2a2a3e;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.mine-screen-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f0a030;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mine-screen-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mine-back-btn {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mine-back-btn:active { opacity: 0.7; }

.mine-balance-display {
  font-size: 0.85rem;
  color: #f0a030;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ══ Lobby icon: SVG trên PC, emoji trên mobile ══════════════════════ */
.mine-lobby-svg {
  width: 52px;
  height: 46px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.mine-lobby-emoji {
  display: none;
  font-size: 2.4rem;
  line-height: 1;
}

/* Mobile: ẩn SVG, hiện emoji (emoji render tốt hơn trên mobile) */
@media (max-width: 768px) {
  .mine-lobby-svg  { display: none; }
  .mine-lobby-emoji { display: block; }
}
