/* =========================================================
   GLITCH // PROJECT MANABURN
   Game Styles
   ========================================================= */

:root {
  --mtg-bg: #02070d;
  --mtg-panel: rgba(8, 20, 40, 0.85);
  --mtg-cyan: #40e0ff;
  --mtg-green: #39ff9f;
  --mtg-pink: #ff3ecb;
  --mtg-text: #e8f2ff;
  --mtg-text-dim: #4a6580;
  --mtg-line: rgba(100, 200, 255, 0.14);
}

/* =========================================================
   GAME ROOT
   ========================================================= */

.mtg-game {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  padding: 1rem;

  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 85, 0, 0.1), transparent 50%),
    radial-gradient(ellipse at 85% 0%, rgba(0, 255, 65, 0.1), transparent 50%),
    var(--mtg-bg);

  color: var(--mtg-text);
  font-family: "Courier New", monospace;
}

.mtg-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

/* =========================================================
   HEADER
   ========================================================= */

.mtg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.2rem;
  border-bottom: 1px solid var(--mtg-line);
  margin-bottom: 1.5rem;
}

.mtg-title {
  color: var(--mtg-cyan);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mtg-close {
  border: 1px solid rgba(255, 62, 203, 0.4);
  background: rgba(255, 62, 203, 0.08);
  color: var(--mtg-pink);
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mtg-close:hover {
  border-color: var(--mtg-pink);
  background: rgba(255, 62, 203, 0.16);
  color: #fff;
}

/* =========================================================
   PHASE INFO
   ========================================================= */

.mtg-phase-info {
  display: flex;
  gap: 2rem;
  padding: 0.8rem 1rem;
  background: rgba(6, 13, 24, 0.9);
  border: 1px solid var(--mtg-line);
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.mtg-phase {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.mtg-turn {
  color: var(--mtg-green);
  font-weight: 700;
  font-size: 1.1rem;
}

.mtg-step {
  color: var(--mtg-cyan);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

.mtg-priority {
  color: var(--mtg-text-dim);
  font-size: 0.85rem;
  margin-left: auto;
}

/* =========================================================
   BOARD LAYOUT
   ========================================================= */

.mtg-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.mtg-player-section {
  border: 1px solid var(--mtg-line);
  border-radius: 12px;
  padding: 1rem;
  background: var(--mtg-panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.mtg-player-section:nth-child(1) {
  border-color: rgba(255, 85, 0, 0.3);
}

.mtg-player-section:nth-child(2) {
  border-color: rgba(0, 255, 65, 0.3);
}

.mtg-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--mtg-line);
}

.mtg-player-name {
  font-weight: 700;
  color: var(--mtg-cyan);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.mtg-player-life {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--mtg-green);
}

/* =========================================================
   ZONES
   ========================================================= */

.mtg-zone {
  margin-bottom: 1rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(100, 200, 255, 0.08);
  border-radius: 8px;
}

.mtg-zone:last-child {
  margin-bottom: 0;
}

.mtg-zone-label {
  font-size: 0.75rem;
  color: var(--mtg-text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.mtg-creature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
}

.mtg-hand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.mtg-stack-zone {
  border: 1px solid var(--mtg-line);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(6, 13, 24, 0.9);
  margin-bottom: 1.5rem;
}

/* =========================================================
   CARDS
   ========================================================= */

.mtg-card-mini {
  padding: 0.6rem;
  background: rgba(10, 22, 42, 0.92);
  border: 1px solid var(--mtg-line);
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
}

.mtg-card-mini:hover {
  border-color: var(--mtg-cyan);
  background: rgba(64, 224, 255, 0.1);
  transform: translateY(-2px);
}

.mtg-card-name {
  font-weight: 700;
  color: var(--mtg-cyan);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtg-card-mana {
  color: var(--mtg-text-dim);
  font-size: 0.7rem;
}

.mtg-card-inline {
  padding: 0.8rem;
  background: rgba(10, 22, 42, 0.95);
  border: 1px solid var(--mtg-line);
  border-radius: 8px;
  text-align: center;
  transition: all 0.15s ease;
}

.mtg-card-inline.tapped {
  opacity: 0.65;
  transform: rotate(-90deg);
}

.mtg-card-inline.damaged {
  border-color: rgba(255, 77, 109, 0.5);
  background: rgba(255, 77, 109, 0.05);
}

.mtg-card-stats {
  color: var(--mtg-green);
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 0.4rem;
}

/* =========================================================
   LOG
   ========================================================= */

.mtg-log-container {
  border: 1px solid var(--mtg-line);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(1, 5, 10, 0.8);
  margin-bottom: 1.5rem;
}

.mtg-log-label {
  font-size: 0.75rem;
  color: var(--mtg-text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.mtg-log-lines {
  max-height: 250px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: var(--mtg-text-dim);
  font-family: "Courier New", monospace;
}

.mtg-log-line {
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(100, 200, 255, 0.05);
  line-height: 1.4;
}

.mtg-log-line:last-child {
  border-bottom: none;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.mtg-actions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem;
  background: rgba(6, 13, 24, 0.9);
  border: 1px solid var(--mtg-line);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.mtg-btn {
  border: 1px solid var(--mtg-line);
  background: rgba(6, 13, 24, 0.9);
  color: var(--mtg-text);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mtg-btn:hover:not(:disabled) {
  border-color: var(--mtg-cyan);
  color: var(--mtg-cyan);
  background: rgba(64, 224, 255, 0.07);
  box-shadow: 0 0 10px rgba(64, 224, 255, 0.1);
}

.mtg-btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.mtg-action-btn {
  flex-shrink: 0;
}

/* =========================================================
   GAME OVER
   ========================================================= */

.mtg-game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
}

.mtg-game-over-panel {
  background: var(--mtg-panel);
  border: 2px solid var(--mtg-cyan);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 0 30px rgba(64, 224, 255, 0.2);
}

.mtg-game-over-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--mtg-pink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mtg-game-over-winner {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--mtg-green);
  letter-spacing: 0.05em;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1024px) {
  .mtg-board {
    grid-template-columns: 1fr;
  }

  .mtg-creature-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (max-width: 640px) {
  .mtg-game {
    padding: 0.6rem;
  }

  .mtg-title {
    font-size: 1.3rem;
  }

  .mtg-player-section {
    padding: 0.8rem;
  }

  .mtg-actions-container {
    flex-direction: column;
  }

  .mtg-btn {
    width: 100%;
    text-align: center;
  }

  .mtg-creature-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* =========================================================
   SCROLLBAR STYLING
   ========================================================= */

.mtg-log-lines::-webkit-scrollbar {
  width: 6px;
}

.mtg-log-lines::-webkit-scrollbar-track {
  background: transparent;
}

.mtg-log-lines::-webkit-scrollbar-thumb {
  background: rgba(64, 224, 255, 0.25);
  border-radius: 3px;
}

.mtg-log-lines::-webkit-scrollbar-thumb:hover {
  background: rgba(64, 224, 255, 0.4);
}
