:root {
  --bg-dark: #0b0716;
  --bg-panel: rgba(23, 15, 38, 0.92);
  --border-glow: rgba(236, 72, 153, 0.4);
  
  --sexy-pink: #ff2a70;
  --sexy-purple: #9d4edd;
  --sexy-glow: rgba(255, 42, 112, 0.5);
  
  --pure-blue: #38bdf8;
  --pure-teal: #2dd4bf;
  --pure-glow: rgba(56, 189, 248, 0.5);

  --text-primary: #f8fafc;
  --text-muted: #a0aec0;
  
  --font-main: 'Outfit', 'Noto Sans KR', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

#app-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* SCREEN SHAKE ANIMATION */
.shake {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

#fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

#floating-text-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}

.float-num {
  position: absolute;
  font-weight: 900;
  font-size: 1.8rem;
  text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.9);
  animation: floatUp 1.2s ease-out forwards;
}

.float-dmg { color: #f43f5e; }
.float-heal { color: #10b981; }
.float-mp { color: #3b82f6; }
.float-heart { color: #ec4899; }

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-30px) scale(1.3); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.9); }
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 60px;
  background: rgba(15, 10, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 1px;
}

.glow-icon {
  color: var(--sexy-pink);
  filter: drop-shadow(0 0 8px var(--sexy-pink));
}

.sub-badge {
  font-size: 0.75rem;
  background: linear-gradient(135deg, var(--sexy-pink), var(--pure-blue));
  padding: 2px 8px;
  border-radius: 20px;
  color: white;
  font-weight: 700;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-btn, .nav-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 10;
}

.icon-btn:hover, .nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 42, 112, 0.4);
}

/* SCREENS SYSTEM */
.screen {
  display: none;
  flex: 1;
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 30px 20px;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* TITLE SCREEN */
#screen-title {
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 25% 25%, rgba(255, 42, 112, 0.18), transparent 55%),
              radial-gradient(circle at 75% 75%, rgba(56, 189, 248, 0.18), transparent 55%);
}

.title-content {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin: 0 auto;
}

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

.main-title {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, var(--sexy-pink) 50%, var(--pure-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 25px rgba(255, 42, 112, 0.35);
  letter-spacing: 1px;
  word-break: keep-all;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  margin-top: 6px;
  word-break: keep-all;
}

.character-cards-container {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 24px;
  width: 100%;
  flex-wrap: wrap;
}

.char-select-card {
  background: var(--bg-panel);
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  position: relative;
  z-index: 10;
}

.char-select-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.4);
}

.char-select-card.selected.sexy-theme {
  border-color: var(--sexy-pink);
  box-shadow: 0 0 30px var(--sexy-glow), 0 10px 30px rgba(0,0,0,0.6);
  transform: translateY(-6px) scale(1.02);
}

.char-select-card.selected.pure-theme {
  border-color: var(--pure-blue);
  box-shadow: 0 0 30px var(--pure-glow), 0 10px 30px rgba(0,0,0,0.6);
  transform: translateY(-6px) scale(1.02);
}

.selected-badge {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: #10b981;
  color: white;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  z-index: 5;
}

.char-select-card.selected .selected-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.char-img-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 14px;
  overflow: hidden;
}

.char-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.char-select-card:hover img {
  transform: scale(1.05);
}

.char-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  backdrop-filter: blur(8px);
  z-index: 5;
}

.sexy-tag { background: rgba(255, 42, 112, 0.9); }
.pure-tag { background: rgba(56, 189, 248, 0.9); }

.char-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-info h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  word-break: keep-all;
  line-height: 1.3;
}

.char-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: keep-all;
}

.stat-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.bar-bg {
  width: 60%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
}

.fill-pink { background: linear-gradient(90deg, var(--sexy-pink), var(--sexy-purple)); }
.fill-blue { background: linear-gradient(90deg, var(--pure-blue), var(--pure-teal)); }

.vs-divider {
  font-size: 2.2rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
}

.mode-select-box {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.mode-btn {
  padding: 16px 32px;
  border-radius: 16px;
  border: none;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.btn-primary-gradient {
  background: linear-gradient(135deg, #e11d48, #c026d3);
  box-shadow: 0 6px 25px rgba(225, 29, 72, 0.45);
}

.btn-secondary-gradient {
  background: linear-gradient(135deg, #0284c7, #0d9488);
  box-shadow: 0 6px 25px rgba(2, 132, 199, 0.45);
}

.mode-btn:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.2);
}

.mode-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* VISUAL NOVEL SCREEN */
#screen-vn {
  justify-content: flex-end;
  position: relative;
  min-height: calc(100vh - 60px);
}

.vn-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  position: relative;
  min-height: 550px;
}

.vn-portrait-area {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 75%;
  max-width: 450px;
  pointer-events: none;
  z-index: 2;
}

.vn-portrait-area img {
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(0,0,0,0.85));
  transition: all 0.3s ease;
}

.vn-badge {
  position: absolute;
  top: 10%;
  left: -10px;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid var(--sexy-pink);
  padding: 6px 16px;
  border-radius: 20px;
  color: white;
  font-weight: 800;
}

.vn-dialogue-box {
  position: relative;
  z-index: 10;
  background: rgba(15, 10, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 24px 30px;
  margin-bottom: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vn-speaker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vn-speaker {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--sexy-pink);
  letter-spacing: 0.5px;
}

.vn-chapter {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 10px;
  border-radius: 10px;
  color: var(--text-muted);
}

.vn-text {
  font-size: 1.15rem;
  line-height: 1.6;
  color: #f1f5f9;
  min-height: 50px;
  word-break: keep-all;
}

.vn-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.vn-choice-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 20;
}

.vn-choice-btn:hover {
  background: rgba(255, 42, 112, 0.3);
  border-color: var(--sexy-pink);
  transform: translateX(6px);
}

.favor-status-panel {
  position: absolute;
  top: 10px;
  left: 20px;
  z-index: 10;
  background: rgba(15, 10, 26, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}

.favor-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.favor-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-pink { color: var(--sexy-pink); }
.text-blue { color: var(--pure-blue); }

.favor-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.favor-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.fill-sexy { background: linear-gradient(90deg, var(--sexy-pink), #e11d48); }
.fill-pure { background: linear-gradient(90deg, var(--pure-blue), #0284c7); }

.favor-val {
  font-size: 0.75rem;
  color: #e2e8f0;
  text-align: right;
}

.vn-back-btn {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 20;
}

/* CARD BATTLE SCREEN */
#screen-battle {
  padding: 20px;
  background: radial-gradient(circle at center, #170f26 0%, #080410 100%);
}

.battle-container {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  gap: 16px;
}

.field-unit {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(23, 15, 38, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 16px 24px;
  transition: transform 0.2s ease;
}

.enemy-unit {
  flex-direction: row-reverse;
  border-color: rgba(56, 189, 248, 0.3);
}

.player-unit {
  border-color: rgba(255, 42, 112, 0.3);
}

.unit-portrait-frame {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.unit-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.unit-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.unit-tag {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.bar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bar-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.gauge-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gauge-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.fill-hp { background: linear-gradient(90deg, #ef4444, #f43f5e); }
.fill-mp { background: linear-gradient(90deg, #3b82f6, #06b6d4); }

.battle-center-hud {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.turn-indicator {
  font-size: 1.1rem;
  font-weight: 900;
  color: #facc15;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.battle-msg {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 0.95rem;
  color: #e2e8f0;
  word-break: keep-all;
}

/* HAND & CARDS */
.card-hand-area {
  background: rgba(15, 10, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-turn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: white;
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
  position: relative;
  z-index: 20;
}

.btn-turn:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

.cards-wrapper {
  display: flex;
  gap: 14px;
  justify-content: center;
  overflow-x: auto;
  padding: 10px 0;
}

.game-card {
  width: 140px;
  height: 190px;
  background: linear-gradient(145deg, #2a1b40, #160c26);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  z-index: 20;
}

.game-card:hover {
  transform: translateY(-12px) scale(1.05);
  border-color: var(--sexy-pink);
  box-shadow: 0 12px 24px var(--sexy-glow);
}

.card-cost {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  background: #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  border: 2px solid white;
}

.card-icon {
  font-size: 2rem;
  text-align: center;
  margin-top: 10px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  word-break: keep-all;
}

.card-desc-mini {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  word-break: keep-all;
}

.battle-back-btn {
  position: absolute;
  top: 80px;
  left: 30px;
  z-index: 20;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  max-width: 600px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.gallery-modal-card {
  max-width: 900px;
}

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

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.close-modal:hover { color: white; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0,0,0,0.4);
}

.cg-img-box {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
}

.cg-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lock-icon-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: white;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.gallery-caption {
  padding: 12px 16px;
}

.gallery-caption h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.gallery-caption p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cg-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
}

.cg-badge.unlocked {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.cg-badge.locked {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.modal-body ul {
  margin-left: 20px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .main-title { font-size: 2.2rem; }
  .char-select-card { width: 100%; max-width: 100%; }
  .vs-divider { display: none; }
  .cards-wrapper { justify-content: flex-start; }
  .game-card { width: 110px; height: 160px; }
  .mode-btn { width: 100%; justify-content: center; }
}
