/* ============================================================
   LUMINOA ARTIFACT — Global Stylesheet
   Dark Fantasy / Space Theme
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --bg-deep:     #07071a;
  --bg-mid:      #0e0e2a;
  --bg-card:     #13133a;
  --bg-hover:    #1a1a4a;
  --border:      rgba(120,100,255,0.25);
  --border-glow: rgba(120,100,255,0.55);

  --primary:     #7c3aed;
  --primary-lt:  #a855f7;
  --accent:      #f59e0b;
  --accent-lt:   #fbbf24;
  --cyan:        #06b6d4;
  --red:         #ef4444;
  --green:       #22c55e;

  --common:  #e0e0e0;
  --rare:    #4fc3f7;
  --epic:    #ce93d8;
  --legend:  #ffd700;
  --myth:    #ff5252;

  --text:    #f0f0ff;
  --text-sm: #9090c0;
  --radius:  14px;
  --trans:   0.25s ease;

  --nav-h:   64px;
  --hud-h:   54px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
input, textarea { user-select: text; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
canvas { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 500; }

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex   { display: flex; }
.col    { flex-direction: column; }
.center { align-items: center; justify-content: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 22px; }
.w100   { width: 100%; }
.bold   { font-weight: 700; }

/* ── Loading Screen ─────────────────────────────────────────── */
#screen-loading {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
  background: var(--bg-deep);
}
.loading-logo {
  font-size: 3.2rem; font-weight: 900; letter-spacing: 4px;
  background: linear-gradient(135deg, #a855f7, #ffd700, #06b6d4);
  background-clip: text;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: logoPulse 2s ease-in-out infinite;
}
.loading-sub {
  font-size: 1rem; color: var(--text-sm); letter-spacing: 6px; text-transform: uppercase;
}
.loading-bar-wrap {
  width: 240px; height: 6px;
  background: rgba(255,255,255,0.1); border-radius: 99px; overflow: hidden;
}
.loading-bar-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s ease;
}
.loading-tip { font-size: 0.8rem; color: var(--text-sm); max-width: 280px; text-align: center; }

@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 12px rgba(168,85,247,0.6)); }
  50%      { filter: drop-shadow(0 0 28px rgba(255,215,0,0.7)); }
}

/* ── Setup Screen ───────────────────────────────────────────── */
#screen-setup {
  position: fixed; inset: 0; z-index: 8000;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a3e 0%, var(--bg-deep) 70%);
}
#screen-setup.active { display: flex; }
.setup-box {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  padding: 40px 32px; max-width: 400px; width: 90%;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 60px rgba(124,58,237,0.3);
}
.setup-logo {
  font-size: 2rem; font-weight: 900;
  background: linear-gradient(135deg, #a855f7, #ffd700);
  background-clip: text;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.setup-desc { color: var(--text-sm); font-size: 0.9rem; text-align: center; line-height: 1.6; }
.input-field {
  width: 100%; padding: 14px 18px; font-size: 1rem;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-glow);
  border-radius: 10px; color: var(--text); outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.input-field:focus {
  border-color: var(--primary-lt);
  box-shadow: 0 0 12px rgba(168,85,247,0.35);
}
.input-field::placeholder { color: var(--text-sm); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 12px 24px; border-radius: 10px; font-size: 0.95rem; font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-lt));
  color: #fff; box-shadow: 0 4px 20px rgba(124,58,237,0.45);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(168,85,247,0.6); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-accent {
  background: linear-gradient(135deg, #d97706, var(--accent-lt));
  color: #fff; box-shadow: 0 4px 20px rgba(245,158,11,0.4);
}
.btn-accent:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(245,158,11,0.6); }
.btn-accent:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-danger {
  background: linear-gradient(135deg, #b91c1c, var(--red));
  color: #fff; box-shadow: 0 4px 20px rgba(239,68,68,0.4);
}
.btn-ghost {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-sm);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; border-radius: 12px; }
.btn-w100 { width: 100%; }

/* ── Game Container ──────────────────────────────────────────── */
#game-container {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

/* ── HUD ─────────────────────────────────────────────────────── */
.game-hud {
  height: var(--hud-h); min-height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: rgba(10,10,30,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.hud-left  { display: flex; flex-direction: column; gap: 1px; }
.hud-name  { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.hud-title { font-size: 0.7rem; color: var(--legend); font-weight: 600; min-height: 12px; }
.hud-center { display: flex; align-items: center; gap: 18px; }
.hud-lua {
  display: flex; align-items: center; gap: 6px;
  font-size: 1rem; font-weight: 800; color: var(--accent);
  background: rgba(245,158,11,0.12);
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid rgba(245,158,11,0.3);
}
.hud-badge {
  position: relative;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; transition: background var(--trans);
}
.hud-badge:hover { background: rgba(255,255,255,0.14); }
.hud-badge-dot {
  position: absolute; top: 2px; right: 2px;
  width: 9px; height: 9px;
  background: var(--red); border-radius: 50%;
  border: 2px solid var(--bg-deep);
  display: none;
}
.hud-badge-dot.show { display: block; }

/* ── Main Screen Area ────────────────────────────────────────── */
.game-screens {
  flex: 1; overflow: hidden; position: relative;
}
.game-screen {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px calc(var(--nav-h) + 16px);
  display: none;
  animation: fadeIn 0.22s ease;
}
.game-screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
.game-screen::-webkit-scrollbar { width: 4px; }
.game-screen::-webkit-scrollbar-track { background: transparent; }
.game-screen::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Bottom Navigation ───────────────────────────────────────── */
.game-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 200;
  display: flex;
  background: rgba(10,10,30,0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-sm); font-size: 0.65rem; font-weight: 600;
  transition: color var(--trans);
  position: relative; overflow: hidden;
}
.nav-btn .nav-icon { font-size: 1.3rem; transition: transform 0.2s; }
.nav-btn:hover .nav-icon { transform: scale(1.2); }
.nav-btn.active { color: var(--primary-lt); }
.nav-btn.active::after {
  content: '';
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--primary-lt); border-radius: 3px 3px 0 0;
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-title {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-sm);
  margin-bottom: 14px;
}

/* ── Section Header ──────────────────────────────────────────── */
.sec-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.sec-title { font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   ENHANCE SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-enhance {
  display: none; padding-bottom: calc(var(--nav-h) + 20px);
}
#screen-enhance.active { display: block; }

.enhance-layout { display: flex; flex-direction: column; gap: 18px; }

/* Artifact orb */
.artifact-stage {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding: 32px 16px;
  background: radial-gradient(ellipse at center, rgba(124,58,237,0.15) 0%, transparent 70%);
  border: 1px solid var(--border); border-radius: var(--radius);
  position: relative; overflow: hidden;
}
.artifact-stage::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E");
}
.orb-container {
  position: relative; width: 160px; height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.orb-ring {
  position: absolute; border-radius: 50%; border: 2px solid transparent;
  animation: orbRotate 4s linear infinite;
}
.orb-ring-1 {
  inset: 0;
  border-top-color: var(--primary-lt); border-right-color: transparent;
  border-bottom-color: var(--primary-lt); border-left-color: transparent;
}
.orb-ring-2 {
  inset: 10px;
  border-left-color: var(--accent); border-right-color: var(--accent);
  animation-direction: reverse; animation-duration: 3s;
}
.orb-ring-3 {
  inset: 22px;
  border-top-color: var(--cyan); border-bottom-color: transparent;
  animation-duration: 6s;
}
@keyframes orbRotate { to { transform: rotate(360deg); } }

.orb-core {
  position: relative; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff22, var(--bg-mid) 60%);
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 900;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
  box-shadow: 0 0 30px rgba(124,58,237,0.6), inset 0 0 20px rgba(0,0,0,0.5);
  z-index: 1;
}
.orb-level-text { color: var(--text); text-shadow: 0 0 12px rgba(255,255,255,0.8); }

.artifact-grade-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 700;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15);
  transition: color var(--trans), border-color var(--trans);
}
.artifact-name {
  font-size: 1rem; font-weight: 700; color: var(--text);
}

/* Orb glow by grade */
.orb-normal  .orb-core { box-shadow: 0 0 20px rgba(170,170,170,0.4), inset 0 0 15px rgba(0,0,0,0.5); }
.orb-common  .orb-core { box-shadow: 0 0 30px rgba(200,200,240,0.5), inset 0 0 20px rgba(0,0,0,0.5); }
.orb-rare    .orb-core { box-shadow: 0 0 40px rgba(79,195,247,0.6), inset 0 0 25px rgba(21,101,192,0.4); border-color: rgba(79,195,247,0.5); }
.orb-epic    .orb-core { box-shadow: 0 0 50px rgba(206,147,216,0.7), inset 0 0 30px rgba(106,27,154,0.5); border-color: rgba(171,71,188,0.6); }
.orb-legend  .orb-core { box-shadow: 0 0 60px rgba(255,215,0,0.8), inset 0 0 35px rgba(230,81,0,0.4); border-color: rgba(255,160,0,0.7); animation: legendPulse 2s ease-in-out infinite; }
.orb-myth    .orb-core { box-shadow: 0 0 80px rgba(255,82,82,0.9), inset 0 0 40px rgba(183,28,28,0.6); border-color: rgba(255,23,68,0.8); animation: mythPulse 1.5s ease-in-out infinite; }

@keyframes legendPulse {
  0%,100% { box-shadow: 0 0 60px rgba(255,215,0,0.8), inset 0 0 35px rgba(230,81,0,0.4); }
  50%      { box-shadow: 0 0 90px rgba(255,215,0,1.0), inset 0 0 50px rgba(255,100,0,0.5); }
}
@keyframes mythPulse {
  0%,100% { box-shadow: 0 0 80px rgba(255,82,82,0.9), inset 0 0 40px rgba(183,28,28,0.6); }
  50%      { box-shadow: 0 0 120px rgba(255,0,0,1.0),  inset 0 0 60px rgba(255,0,0,0.4); }
}

/* Enhance info panel */
.enhance-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.info-cell {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.info-label { font-size: 0.7rem; color: var(--text-sm); }
.info-value { font-size: 1.1rem; font-weight: 800; }

/* Success rate bar */
.rate-bar-wrap {
  height: 8px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden;
  margin-top: 4px;
}
.rate-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--red), var(--accent), var(--green));
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhance options */
.enhance-options {
  display: flex; flex-direction: column; gap: 10px;
}
.option-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
.option-label { font-size: 0.85rem; color: var(--text); }
.option-count { font-size: 0.8rem; color: var(--text-sm); }
.toggle-switch {
  position: relative; width: 44px; height: 24px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 12px;
  background: rgba(255,255,255,0.12); transition: background 0.25s;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.25s, background 0.25s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* Enhance button */
.btn-enhance {
  width: 100%; padding: 18px; font-size: 1.15rem; font-weight: 900;
  border-radius: 14px; letter-spacing: 1px;
  background: linear-gradient(135deg, #4c1d95, #7c3aed, #a855f7);
  color: #fff; box-shadow: 0 6px 32px rgba(124,58,237,0.6);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.btn-enhance::before {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: shimmer 2.5s infinite;
}
@keyframes shimmer { to { left: 200%; } }
.btn-enhance:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(168,85,247,0.7);
}
.btn-enhance:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-enhance:disabled::before { animation: none; }

/* Enhance log */
.enhance-log {
  max-height: 180px; overflow-y: auto;
  background: var(--bg-mid); border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.log-item {
  font-size: 0.78rem; padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex; justify-content: space-between; align-items: center;
}
.log-item:last-child { border-bottom: none; }
.log-success { color: var(--green); }
.log-fail    { color: #f87171; }
.log-break   { color: var(--red); font-weight: 700; }
.log-time    { font-size: 0.68rem; color: var(--text-sm); }

/* Enhance result overlay */
.enhance-result-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.enhance-result-box {
  text-align: center; padding: 40px 32px; max-width: 340px; width: 90%;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.result-emoji  { font-size: 4rem; margin-bottom: 12px; }
.result-title  { font-size: 1.5rem; font-weight: 900; margin-bottom: 8px; }
.result-desc   { font-size: 0.9rem; color: var(--text-sm); margin-bottom: 24px; }
.result-success { color: var(--accent); }
.result-fail    { color: #f87171; }
.result-break   { color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   BATTLE SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-battle { display: none; }
#screen-battle.active { display: block; }

/* Matchmaking */
.match-header { text-align: center; margin-bottom: 24px; }
.match-header h2 { font-size: 1.3rem; font-weight: 800; }
.match-header p  { font-size: 0.85rem; color: var(--text-sm); margin-top: 4px; }

.opponent-list { display: flex; flex-direction: column; gap: 12px; }
.opponent-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; transition: border-color var(--trans), background var(--trans);
}
.opponent-card:hover {
  border-color: var(--primary-lt);
  background: var(--bg-hover);
}
.opp-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; flex-shrink: 0;
  border: 2px solid var(--border);
}
.opp-info { flex: 1; min-width: 0; }
.opp-name { font-size: 0.95rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-desc { font-size: 0.75rem; color: var(--text-sm); }
.opp-meta { display: flex; gap: 8px; margin-top: 4px; }
.opp-badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 20px;
  background: rgba(255,255,255,0.07); color: var(--text-sm);
}
.opp-reward { font-size: 0.9rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.opp-diff-easy   .opp-avatar { border-color: var(--green); }
.opp-diff-normal .opp-avatar { border-color: var(--accent); }
.opp-diff-hard   .opp-avatar { border-color: var(--red); }

/* Battle arena */
.battle-arena {
  display: flex; flex-direction: column; gap: 16px;
}
.arena-vs-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px;
  align-items: center;
}
.fighter-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.3s;
}
.fighter-card.is-player { border-color: var(--primary-lt); }
.fighter-card.is-opponent { border-color: rgba(239,68,68,0.4); }
.fighter-avatar {
  font-size: 2.4rem; text-align: center; line-height: 1;
}
.fighter-name  { font-size: 0.85rem; font-weight: 700; text-align: center; }
.fighter-level { font-size: 0.7rem; color: var(--text-sm); text-align: center; }
.hp-bar-label  { display: flex; justify-content: space-between; font-size: 0.72rem; }
.hp-bar-wrap   { height: 10px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.hp-bar-fill   { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.hp-bar-player { background: linear-gradient(90deg, #16a34a, #4ade80); }
.hp-bar-enemy  { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.vs-badge {
  font-size: 1rem; font-weight: 900; color: var(--accent);
  background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3);
  padding: 8px 10px; border-radius: 8px;
}
.turn-indicator {
  text-align: center; font-size: 0.9rem; font-weight: 700;
  padding: 10px; border-radius: 10px;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3);
}
.turn-player { color: var(--primary-lt); }
.turn-enemy  { color: var(--red); }

/* Battle log */
.battle-log-box {
  max-height: 140px; overflow-y: auto;
  background: var(--bg-mid); border-radius: 10px; padding: 10px;
  font-size: 0.78rem; display: flex; flex-direction: column; gap: 3px;
}
.battle-log-item { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.battle-log-item:last-child { border: none; }
.blog-player  { color: #93c5fd; }
.blog-enemy   { color: #fca5a5; }
.blog-system  { color: var(--text-sm); font-style: italic; }
.blog-crit    { color: var(--legend); font-weight: 700; }

/* Skills grid */
.skills-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.skill-btn {
  padding: 12px 8px; border-radius: 10px; text-align: center;
  background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3);
  color: var(--text); font-size: 0.82rem; font-weight: 600;
  transition: background var(--trans), border-color var(--trans), transform 0.15s;
  cursor: pointer;
}
.skill-btn:hover:not(:disabled) {
  background: rgba(124,58,237,0.3); border-color: var(--primary-lt);
  transform: translateY(-1px);
}
.skill-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.skill-btn .skill-icon { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.skill-btn .skill-name { display: block; font-size: 0.8rem; }
.skill-btn .skill-cd   { display: block; font-size: 0.68rem; color: var(--text-sm); margin-top: 2px; }
.skill-btn.on-cooldown { opacity: 0.5; }

/* Battle result */
.battle-result {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.battle-result-box {
  text-align: center; padding: 40px 32px; max-width: 360px; width: 90%;
  background: var(--bg-card); border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.br-trophy { font-size: 4rem; margin-bottom: 12px; }
.br-title  { font-size: 1.8rem; font-weight: 900; margin-bottom: 8px; }
.br-victory { color: var(--legend); }
.br-defeat  { color: var(--red); }
.br-reward  { font-size: 1rem; color: var(--accent); margin: 8px 0 20px; }
.br-stats   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.br-stat    { background: rgba(255,255,255,0.05); border-radius: 8px; padding: 10px; }
.br-stat-label { font-size: 0.7rem; color: var(--text-sm); }
.br-stat-value { font-size: 1rem; font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   STOCK SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-stock { display: none; }
#screen-stock.active { display: block; }

.stock-portfolio-header {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.portfolio-value { font-size: 1.2rem; font-weight: 800; color: var(--accent); }
.portfolio-pnl   { font-size: 0.9rem; font-weight: 700; }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

.stock-list { display: flex; flex-direction: column; gap: 10px; }
.stock-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; transition: border-color var(--trans), background var(--trans);
}
.stock-item:hover { border-color: var(--cyan); background: var(--bg-hover); }
.stock-item-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stock-symbol     { font-size: 0.85rem; font-weight: 800; color: var(--cyan); }
.stock-name       { font-size: 0.75rem; color: var(--text-sm); margin-top: 2px; }
.stock-price      { font-size: 1.1rem; font-weight: 800; }
.stock-change     { font-size: 0.8rem; font-weight: 700; margin-top: 2px; text-align: right; }
.stock-change.up   { color: var(--green); }
.stock-change.down { color: var(--red); }
.stock-mini-chart  { height: 36px; }

/* Stock detail modal content */
.stock-detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.sd-cell { background: rgba(255,255,255,0.04); border-radius: 8px; padding: 10px; }
.sd-label { font-size: 0.7rem; color: var(--text-sm); }
.sd-value { font-size: 1rem; font-weight: 700; margin-top: 2px; }
.trade-input-row { display: flex; gap: 10px; margin: 12px 0; }
.qty-input {
  flex: 1; padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text); font-size: 1rem; text-align: center; outline: none;
}
.qty-input:focus { border-color: var(--cyan); box-shadow: 0 0 10px rgba(6,182,212,0.3); }
.trade-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ══════════════════════════════════════════════════════════════
   SHOP SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-shop { display: none; }
#screen-shop.active { display: block; }

.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.shop-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  text-align: center; transition: border-color var(--trans), background var(--trans);
}
.shop-item:hover { border-color: var(--accent); background: var(--bg-hover); }
.shop-item-icon   { font-size: 2.5rem; }
.shop-item-name   { font-size: 0.85rem; font-weight: 700; }
.shop-item-desc   { font-size: 0.72rem; color: var(--text-sm); line-height: 1.5; }
.shop-item-price  {
  font-size: 0.9rem; font-weight: 800; color: var(--accent);
  display: flex; align-items: center; gap: 4px;
}
.shop-item-count  { font-size: 0.72rem; color: var(--text-sm); }
.minigame-section { margin-top: 24px; }

/* ══════════════════════════════════════════════════════════════
   RANKING SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-rank { display: none; }
#screen-rank.active { display: block; }

.rank-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.rank-tab {
  padding: 8px 16px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text-sm); transition: all var(--trans); cursor: pointer;
}
.rank-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
}
.rank-item.is-me { border-color: var(--primary-lt); background: rgba(124,58,237,0.1); }
.rank-num {
  width: 28px; text-align: center; font-size: 1rem; font-weight: 800;
  flex-shrink: 0;
}
.rank-1 { color: var(--legend); }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }
.rank-avatar { font-size: 1.8rem; flex-shrink: 0; }
.rank-info  { flex: 1; min-width: 0; }
.rank-name  { font-size: 0.9rem; font-weight: 700; }
.rank-sub   { font-size: 0.72rem; color: var(--text-sm); }
.rank-value { font-size: 1rem; font-weight: 800; color: var(--accent); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   PROFILE SCREEN
   ══════════════════════════════════════════════════════════════ */
#screen-profile { display: none; }
#screen-profile.active { display: block; }

.profile-hero {
  background: radial-gradient(ellipse at top, rgba(124,58,237,0.25) 0%, transparent 60%);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.profile-avatar  { font-size: 4rem; }
.profile-name    { font-size: 1.3rem; font-weight: 900; }
.profile-title   { font-size: 0.8rem; color: var(--legend); font-weight: 700; }
.profile-rating  { font-size: 0.85rem; color: var(--text-sm); }
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px;
}
.pstat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; }
.pstat-value { font-size: 1.1rem; font-weight: 800; }
.pstat-label { font-size: 0.68rem; color: var(--text-sm); margin-top: 3px; }

.achievement-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.ach-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
}
.ach-item.locked { opacity: 0.4; }
.ach-icon { font-size: 1.6rem; flex-shrink: 0; }
.ach-info { min-width: 0; }
.ach-name { font-size: 0.8rem; font-weight: 700; }
.ach-desc { font-size: 0.68rem; color: var(--text-sm); }
.ach-reward { font-size: 0.68rem; color: var(--accent); }

.inventory-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 10px;
}
.inv-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; text-align: center;
}
.inv-icon { font-size: 1.8rem; }
.inv-name { font-size: 0.72rem; color: var(--text-sm); margin-top: 4px; }
.inv-qty  { font-size: 1rem; font-weight: 800; color: var(--text); }
.danger-zone { margin-top: 24px; }

/* ══════════════════════════════════════════════════════════════
   NOTIFICATION
   ══════════════════════════════════════════════════════════════ */
#notif-container {
  position: fixed; top: calc(var(--hud-h) + 8px); right: 12px;
  z-index: 800; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.notif {
  max-width: 280px; padding: 12px 16px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
  pointer-events: none;
}
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  to { transform: translateX(120%); opacity: 0; }
}
.notif-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 3px; }
.notif-body  { font-size: 0.75rem; color: var(--text-sm); }
.notif-success { border-color: rgba(34,197,94,0.5); }
.notif-success .notif-title { color: var(--green); }
.notif-error   { border-color: rgba(239,68,68,0.5); }
.notif-error   .notif-title { color: var(--red); }
.notif-info    { border-color: rgba(6,182,212,0.5); }
.notif-info    .notif-title { color: var(--cyan); }
.notif-achievement { border-color: rgba(255,215,0,0.5); }
.notif-achievement .notif-title { color: var(--legend); }

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
#modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
}
#modal-overlay.center-mode { align-items: center; }
.modal-panel {
  background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); width: 100%; max-width: 500px;
  padding: 20px; max-height: 85vh; overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#modal-overlay.center-mode .modal-panel {
  border-radius: var(--radius);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title { font-size: 1.1rem; font-weight: 800; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.07); display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-sm); cursor: pointer;
  transition: background var(--trans);
}
.modal-close:hover { background: rgba(255,255,255,0.15); }

/* ══════════════════════════════════════════════════════════════
   MINI GAME — Odd/Even
   ══════════════════════════════════════════════════════════════ */
.odd-even-game {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-top: 16px;
}
.oe-bet-row { display: flex; gap: 10px; margin: 12px 0; }
.oe-choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.oe-choice {
  padding: 14px; border-radius: 10px; font-size: 1rem; font-weight: 700;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12);
  color: var(--text); transition: all var(--trans); cursor: pointer;
  text-align: center;
}
.oe-choice.selected { background: rgba(124,58,237,0.3); border-color: var(--primary-lt); color: var(--primary-lt); }
.oe-result-display {
  font-size: 1.8rem; text-align: center; padding: 20px;
  font-weight: 900; border-radius: 10px;
  background: rgba(255,255,255,0.04);
}

/* ══════════════════════════════════════════════════════════════
   MISC / UTILITY
   ══════════════════════════════════════════════════════════════ */
.divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-sm); font-size: 0.9rem;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }

/* Canvas chart */
.chart-canvas { width: 100%; height: 80px; display: block; }

/* Shake animation */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.shake { animation: shake 0.5s ease; }

/* Flash animations */
@keyframes flashGreen {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  50%  { box-shadow: 0 0 30px 10px rgba(34,197,94,0.6); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes flashRed {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%  { box-shadow: 0 0 30px 10px rgba(239,68,68,0.6); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.flash-success { animation: flashGreen 0.7s ease; }
.flash-fail    { animation: flashRed   0.7s ease; }

/* Number animation */
.num-bump { animation: numBump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes numBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Responsive tweaks */
@media (max-width: 768px) {
  :root {
    --hud-h: 48px;
    --nav-h: 56px;
  }

  .setup-box {
    gap: 14px;
    padding: 24px 18px;
    max-width: 340px;
  }

  .setup-logo { font-size: 1.5rem; }
  .setup-desc { font-size: 0.82rem; line-height: 1.45; }
  .input-field { padding: 11px 14px; font-size: 0.92rem; }
  .btn-lg { padding: 12px 20px; font-size: 1rem; }

  .game-screen {
    overflow-y: auto;
    padding: 10px 10px calc(var(--nav-h) + 10px);
  }

  #screen-enhance {
    padding-bottom: calc(var(--nav-h) + 10px);
    overflow-y: hidden;
  }

  #screen-enhance .enhance-layout {
    height: calc(100dvh - var(--hud-h) - var(--nav-h) - 20px);
    gap: 8px;
    grid-auto-rows: min-content;
  }

  #screen-enhance .artifact-stage {
    padding: 12px 8px;
    gap: 9px;
  }

  #screen-enhance .orb-container {
    width: 96px;
    height: 96px;
  }

  #screen-enhance .orb-core {
    width: 62px;
    height: 62px;
    font-size: 1rem;
  }

  #screen-enhance .artifact-grade-badge {
    padding: 4px 9px;
    font-size: 0.68rem;
  }

  #screen-enhance .artifact-name { font-size: 0.84rem; }

  #screen-enhance .enhance-info { gap: 6px; }

  #screen-enhance .info-cell {
    padding: 7px 9px;
    gap: 2px;
  }

  #screen-enhance .info-label { font-size: 0.62rem; }
  #screen-enhance .info-value { font-size: 0.82rem; }
  #screen-enhance .rate-bar-wrap { height: 6px; margin-top: 2px; }

  #screen-enhance .enhance-options { gap: 6px; }

  #screen-enhance .option-row {
    padding: 8px 10px;
    border-radius: 8px;
  }

  #screen-enhance .option-label { font-size: 0.74rem; }
  #screen-enhance .option-count { font-size: 0.66rem; }

  #screen-enhance .toggle-switch {
    width: 36px;
    height: 20px;
  }

  #screen-enhance .toggle-thumb {
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
  }

  #screen-enhance .toggle-switch input:checked ~ .toggle-thumb {
    transform: translateX(16px);
  }

  #screen-enhance .btn-enhance {
    padding: 11px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  #screen-enhance .card {
    padding: 9px;
    border-radius: 10px;
  }

  #screen-enhance .card-title {
    margin-bottom: 8px;
    font-size: 0.62rem;
  }

  #screen-enhance .enhance-log {
    max-height: 56px;
    padding: 6px;
    gap: 2px;
  }

  #screen-enhance .log-item {
    font-size: 0.64rem;
    padding: 1px 0;
  }

  .nav-btn {
    font-size: 0.58rem;
    gap: 1px;
  }

  .nav-btn .nav-icon { font-size: 1.12rem; }
}

@media (max-width: 360px) {
  .skills-grid     { grid-template-columns: 1fr 1fr; }
  .shop-grid       { grid-template-columns: 1fr; }
  .profile-stats   { grid-template-columns: repeat(3, 1fr); }
}
