/* General Root Variables & Dark Theme */
:root {
  --bg-color: #0b0203;
  --bg-gradient: radial-gradient(circle, #220508 0%, #080102 100%);
  --accent-gold: #e2c175;
  --accent-gold-hover: #f0d598;
  --accent-red: #c91e25;
  --accent-red-glow: rgba(201, 30, 37, 0.4);
  --accent-blue: #2358b5;
  --text-light: #f5eae6;
  --text-dim: #ab9592;
  --panel-bg: rgba(28, 9, 11, 0.85);
  --panel-border: rgba(226, 193, 117, 0.2);
  --panel-glow: rgba(0, 0, 0, 0.6);
  --font-title: 'Gowun Batang', serif;
  --font-ui: 'Outfit', 'Noto Sans KR', sans-serif;
  --card-width: 62px;
  --card-height: 100px;
  --card-radius: 6px;
}

/* Reset and Globals */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-light);
  font-family: var(--font-ui);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Grids & Glows */
.bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vh;
  background: radial-gradient(circle, rgba(201, 30, 37, 0.12) 0%, rgba(0,0,0,0) 70%);
  z-index: 0;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(rgba(226, 193, 117, 0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(226, 193, 117, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
  pointer-events: none;
}

/* Screen Transitions */
.screen {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}

/* Buttons System */
button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: var(--font-ui);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-red) 0%, #900c11 100%);
  color: #fff;
  font-weight: 600;
  padding: 14px 30px;
  font-size: 1.1rem;
  border: 1px solid var(--accent-gold);
  box-shadow: 0 4px 15px rgba(201, 30, 37, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 30, 37, 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--panel-bg);
  color: var(--accent-gold);
  font-weight: 600;
  padding: 14px 30px;
  font-size: 1.1rem;
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  color: #fff;
  box-shadow: 0 6px 20px rgba(226, 193, 117, 0.15);
}

.btn-tertiary {
  background: transparent;
  color: var(--text-dim);
  font-weight: 500;
  padding: 10px 20px;
  font-size: 0.95rem;
}

.btn-tertiary:hover {
  color: var(--text-light);
}

.btn-danger {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  color: #fff;
  font-weight: 600;
  padding: 14px 30px;
  font-size: 1.1rem;
  border: 1px solid #ff8a80;
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(211, 47, 47, 0.5);
  filter: brightness(1.1);
}

.btn-back {
  background: transparent;
  color: var(--accent-gold);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn-back:hover {
  background: rgba(226, 193, 117, 0.1);
  border-color: var(--accent-gold);
  color: #fff;
}

.btn-icon {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--accent-gold);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-icon:hover {
  border-color: var(--accent-gold);
  transform: scale(1.05);
}

/* Utility bar */
#utility-bar {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 100;
}

/* SCREEN 1: LOBBY CSS */
.lobby-container {
  text-align: center;
  max-width: 600px;
  z-index: 10;
  padding: 40px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 20px 50px var(--panel-glow);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.8s ease;
}

.game-title {
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-title .sub-title {
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 6px;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.game-title .main-title {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 10px var(--accent-red-glow), 0 0 20px rgba(226, 193, 117, 0.3);
  position: relative;
}

.game-desc {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 40px;
  line-height: 1.6;
}

.lobby-menu {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 280px;
  margin: 0 auto;
}

.lobby-footer {
  margin-top: 40px;
  font-size: 0.8rem;
  color: rgba(171, 149, 146, 0.4);
}

/* SCREEN 2: CAMPAIGN CSS */
.campaign-container {
  width: 90%;
  max-width: 1100px;
  height: 85%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px var(--panel-glow);
  backdrop-filter: blur(12px);
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(226, 193, 117, 0.1);
  padding-bottom: 15px;
}

.screen-header h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: #fff;
  letter-spacing: 1px;
}

.general-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  overflow-y: auto;
  padding-right: 5px;
}

/* General Card Design */
.general-card {
  background: rgba(15, 5, 6, 0.7);
  border: 1px solid rgba(226, 193, 117, 0.1);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
}

.general-card.locked {
  cursor: not-allowed;
  opacity: 0.6;
}

.general-card:not(.locked):hover {
  transform: translateY(-5px);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(226, 193, 117, 0.15);
  background: rgba(38, 12, 16, 0.7);
}

.general-portrait-box {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid rgba(226, 193, 117, 0.3);
  margin-bottom: 15px;
  background-size: cover;
  background-position: center;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  transition: border-color 0.3s;
}

.general-card:not(.locked):hover .general-portrait-box {
  border-color: var(--accent-gold);
}

.general-card.locked .general-portrait-box {
  filter: brightness(0) contrast(1.2); /* Silhouette */
  border-color: rgba(255,255,255,0.05);
}

.general-card.locked::before {
  content: '🔒';
  position: absolute;
  top: 50px;
  font-size: 2rem;
  z-index: 5;
}

.general-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: #fff;
}

.general-card.locked .general-name {
  color: var(--text-dim);
}

.diff-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.diff-tag.easy { background-color: #2e7d32; color: #e8f5e9; }
.diff-tag.normal { background-color: #f57f17; color: #fffde7; }
.diff-tag.hard { background-color: #c62828; color: #ffebee; }
.diff-tag.very-hard { background-color: #880e4f; color: #fce4ec; }
.diff-tag.expert { background-color: #4a148c; color: #f3e5f5; }

.general-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 15px;
  flex: 1;
}

.btn-battle {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.general-card.locked .btn-battle {
  background: #332224;
  color: rgba(255,255,255,0.2);
  border-color: transparent;
  box-shadow: none;
}

/* SCREEN 3: GAME BOARD CSS */
.game-layout {
  display: flex;
  width: 98vw;
  height: 96vh;
  gap: 15px;
  max-width: 1500px;
}

.side-panel {
  width: 250px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}

.opponent-portrait-container {
  width: 140px;
  height: 140px;
  position: relative;
  margin-bottom: 15px;
}

.opponent-portrait {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 2px solid var(--accent-gold);
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 15px rgba(0,0,0,0.6);
}

.opponent-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-red);
  color: #fff;
  border: 1px solid var(--accent-gold);
  border-radius: 4px;
  padding: 2px 12px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.dialog-bubble {
  width: 100%;
  background: rgba(15, 5, 6, 0.8);
  border: 1px solid rgba(226, 193, 117, 0.2);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-light);
  margin-top: 15px;
  position: relative;
  min-height: 80px;
}

.opp-stats {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(226, 193, 117, 0.1);
  padding-top: 15px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.badge {
  background: rgba(226, 193, 117, 0.1);
  border: 1px solid rgba(226, 193, 117, 0.3);
  color: var(--accent-gold);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Center Board Area */
.board-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Player Boards Slots (CPU & Player) */
.player-slot {
  background: rgba(20, 6, 7, 0.8);
  border: 1px solid rgba(226, 193, 117, 0.15);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 5px;
}

.slot-header h3 {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 500;
}

.score-display {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-light);
}

.score-value {
  color: var(--accent-gold);
  font-size: 1.3rem;
  font-weight: 800;
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 15px;
}

.player-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}

.game-status-indicators {
  display: flex;
  gap: 8px;
}

.status-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--accent-gold);
}

/* Collected Cards layout */
.collected-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  min-height: 90px;
}

.card-group-slot {
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  padding: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px dashed rgba(226, 193, 117, 0.05);
}

.group-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.cards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  position: relative;
}

/* Hwatu Card Styling */
.hwatu-card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  background: #fff;
  border: 2px solid var(--accent-red);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  user-select: none;
  cursor: pointer;
  flex-shrink: 0;
}

.hwatu-card.selected {
  transform: translateY(-15px) scale(1.05);
  box-shadow: 0 8px 20px var(--accent-red-glow);
  border-color: var(--accent-gold);
  z-index: 10;
}

.hwatu-card.playable:hover {
  transform: translateY(-8px);
  border-color: var(--accent-gold);
  box-shadow: 0 6px 15px rgba(226, 193, 117, 0.4);
}

/* Card representation inside collected slot (scaled down) */
.collected-cards .hwatu-card {
  width: 32px;
  height: 52px;
  border-width: 1px;
  border-radius: 3px;
  margin-right: -18px; /* overlap cards */
  box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  cursor: default;
}

.collected-cards .hwatu-card:hover {
  transform: translateY(-5px) scale(1.2);
  margin-right: 2px;
  z-index: 20;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* Back of Card */
.hwatu-card.back {
  background: var(--accent-red);
  background-image: radial-gradient(circle, #e62e35 0%, #900c11 100%);
  border: 2.5px solid #ffdd90;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.hwatu-card.back::after {
  content: '화투';
  color: var(--accent-gold);
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(226,193,117,0.3);
  padding: 4px;
  border-radius: 2px;
}

/* Card SVG Internals */
.hwatu-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ground Field CSS */
.ground-field-container {
  flex: 1;
  background: rgba(13, 3, 4, 0.9);
  border: 2px solid rgba(226, 193, 117, 0.15);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  gap: 20px;
  position: relative;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.ground-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 15px;
}

/* Monthly slot on ground */
.ground-slot {
  background: rgba(226, 193, 117, 0.02);
  border: 1px dashed rgba(226, 193, 117, 0.08);
  border-radius: var(--card-radius);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
}

.ground-slot .hwatu-card {
  position: absolute;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
}

/* Offset matching cards stacked on ground */
.ground-slot .hwatu-card:nth-child(2) {
  transform: translate(6px, 6px);
  z-index: 2;
}
.ground-slot .hwatu-card:nth-child(3) {
  transform: translate(12px, 12px);
  z-index: 3;
}
.ground-slot .hwatu-card:nth-child(4) {
  transform: translate(18px, 18px);
  z-index: 4;
}

/* Highlights for matches */
.ground-slot.highlight-match {
  background: rgba(226, 193, 117, 0.08);
  border: 1px solid rgba(226, 193, 117, 0.4);
  box-shadow: 0 0 12px rgba(226, 193, 117, 0.15);
}

/* Deck Draw Pile & Game Messages */
.deck-area {
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-left: 1px solid rgba(226, 193, 117, 0.1);
  padding-left: 20px;
}

.deck-card-visual {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  box-shadow: 0 6px 15px rgba(0,0,0,0.6);
  cursor: default;
}

.deck-card-inner {
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  background: var(--accent-red);
  background-image: radial-gradient(circle, #e62e35 0%, #900c11 100%);
  border: 2.5px solid #ffdd90;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
}

.deck-card-inner::after {
  content: '화투';
  color: var(--accent-gold);
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(226,193,117,0.3);
  padding: 4px;
  border-radius: 2px;
}

/* 3D stack shadow effect for deck */
.deck-card-visual::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  background: #60070b;
  border: 2px solid #b39b61;
  z-index: -1;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.deck-count {
  position: absolute;
  bottom: -10px;
  right: -10px;
  background: var(--accent-gold);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.game-action-message {
  font-size: 0.85rem;
  color: var(--accent-gold);
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(226, 193, 117, 0.2);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  line-height: 1.4;
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hand Grid (Bottom Panel) */
.player-hand-container {
  display: flex;
  justify-content: center;
  padding: 5px 0;
}

.hand-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 20px;
  max-width: 100%;
}

/* SCREEN 4: GALLERY CSS */
.gallery-container {
  width: 90%;
  max-width: 1100px;
  height: 85%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px var(--panel-glow);
  backdrop-filter: blur(12px);
}

.unlock-counter {
  font-size: 1rem;
  color: var(--accent-gold);
  font-weight: 600;
  background: rgba(226, 193, 117, 0.1);
  padding: 4px 15px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
}

.gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Gallery Item Card */
.gallery-item {
  background: rgba(15, 5, 6, 0.7);
  border: 1px solid rgba(226, 193, 117, 0.1);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
}

.gallery-item:not(.locked):hover {
  transform: translateY(-5px);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(226, 193, 117, 0.2);
}

.gallery-thumbnail-box {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: #0b0203;
  position: relative;
}

.gallery-item.locked .gallery-thumbnail-box {
  filter: brightness(0.08) contrast(1.1); /* extremely dark/silhouette */
}

.gallery-item.locked .gallery-thumbnail-box::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
}

.gallery-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.gallery-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.gallery-item.locked .gallery-title {
  color: var(--text-dim);
}

.gallery-condition {
  font-size: 0.75rem;
  color: #ef9a9a;
  background: rgba(239, 154, 154, 0.08);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(239, 154, 154, 0.2);
  display: inline-block;
  align-self: flex-start;
}

.gallery-desc-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.btn-zoom {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
  margin-top: auto;
}

/* MODALS LAYOUT */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: #1f0b0d;
  background-image: radial-gradient(circle at top, #2f1013 0%, #130607 100%);
  border: 1.5px solid var(--accent-gold);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(201, 30, 37, 0.2);
  width: 90%;
  max-width: 450px;
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.modal-content.max-w-lg {
  max-width: 550px;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.modal-desc {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 25px;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.modal-buttons button {
  flex: 1;
}

.btn-lg {
  padding: 16px 24px;
  font-size: 1.15rem;
}

.text-center {
  text-align: center;
}

/* Card Selection Modal Grid */
.card-selection-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
}

.card-selection-grid .hwatu-card:hover {
  transform: scale(1.1);
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(226, 193, 117, 0.5);
}

/* Modal Rules Internals */
.rules-body {
  text-align: left;
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 5px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.rules-body h3 {
  font-family: var(--font-title);
  color: var(--accent-gold);
  margin: 15px 0 5px;
}

.rules-body ul {
  padding-left: 15px;
  margin-bottom: 10px;
}

.rules-body li {
  margin-bottom: 4px;
}

/* Result Modal details */
.result-body {
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 25px;
  border: 1px solid rgba(226,193,117,0.1);
}

.result-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.result-row span:last-child {
  font-weight: 600;
  color: var(--text-light);
}

.total-row {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin-top: 10px;
}

.total-row span:last-child {
  color: var(--accent-gold);
  font-size: 1.4rem;
  font-weight: 800;
}

.result-divider {
  border: none;
  border-top: 1px solid rgba(226, 193, 117, 0.2);
  margin: 10px 0;
}

.unlock-msg {
  color: #81c784;
  background: rgba(129, 199, 132, 0.1);
  border: 1px dashed rgba(129, 199, 132, 0.3);
  border-radius: 6px;
  padding: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 15px;
  display: none;
}

/* Modal 5: Collection Unlock Presentation Page */
.unlock-presentation-content {
  max-width: 500px;
  background: #110304;
  background-image: radial-gradient(circle, #29080c 0%, #060102 100%);
  overflow: hidden;
}

.unlock-header {
  font-family: var(--font-title);
  color: var(--accent-gold);
  font-size: 2rem;
  text-shadow: 0 0 15px rgba(226,193,117,0.4);
  margin-bottom: 20px;
}

.unlocked-card-container {
  width: 100%;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1000px;
}

.unlocked-card-container img {
  width: 75%;
  max-height: 250px;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 0 25px rgba(226, 193, 117, 0.2);
  animation: cardDealFlip 0.8s ease-out;
}

.unlocked-card-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-top: 15px;
  letter-spacing: 1px;
}

.unlock-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 25px;
}

/* Zoom Modal */
#modal-zoom {
  background: rgba(0, 0, 0, 0.9);
}

.zoom-close {
  position: absolute;
  top: 30px;
  right: 40px;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  z-index: 1010;
  transition: color 0.2s;
}

.zoom-close:hover {
  color: #fff;
}

.zoom-content-container {
  display: flex;
  max-width: 950px;
  width: 90%;
  background: #140506;
  border: 2px solid var(--accent-gold);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.9);
  z-index: 1005;
}

.zoom-content-container img {
  width: 60%;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
}

.zoom-details {
  width: 40%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--panel-border);
}

.zoom-details h3 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(226,193,117,0.2);
  padding-bottom: 10px;
}

.zoom-details p {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 30px;
}

.zoom-details .btn-primary {
  align-self: flex-start;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes cardDealFlip {
  0% { transform: translateY(100px) rotateY(90deg) scale(0.5); opacity: 0; }
  100% { transform: translateY(0) rotateY(0) scale(1); opacity: 1; }
}

@keyframes pulse {
  0% { transform: scale(1); text-shadow: 0 0 5px rgba(226,193,117,0.2); }
  50% { transform: scale(1.03); text-shadow: 0 0 20px rgba(226,193,117,0.6); }
  100% { transform: scale(1); text-shadow: 0 0 5px rgba(226,193,117,0.2); }
}

.animate-pulse {
  animation: pulse 2s infinite ease-in-out;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .game-layout {
    flex-direction: column;
    overflow-y: auto;
    height: 98vh;
    padding: 10px;
  }
  
  .side-panel {
    width: 100%;
    flex-direction: row;
    height: auto;
    gap: 20px;
    padding: 15px;
  }
  
  .opponent-portrait-container {
    width: 70px;
    height: 70px;
    margin-bottom: 0;
  }
  
  .opponent-badge {
    bottom: -5px;
    font-size: 0.75rem;
    padding: 1px 6px;
  }
  
  .dialog-bubble {
    margin-top: 0;
    flex: 1;
    min-height: 50px;
  }
  
  .opp-stats {
    width: auto;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .zoom-content-container {
    flex-direction: column;
  }
  .zoom-content-container img {
    width: 100%;
    max-height: 45vh;
  }
  .zoom-details {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--panel-border);
    padding: 20px;
  }
}
