/* =========================================
   RPS Flip Online PvP — Dark Mode Redesign
   Author: Andrew Hinkley
   2025
   ========================================= */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Roboto+Mono:wght@400;700&family=Comfortaa&display=swap');

/* ---------- CSS Variables & Theme ---------- */
:root {
  --bg-dark: #0d0d14;
  --bg-panel: #1c1c28;
  --bg-card: #23233c;
  --bg-hover: #33334d;
  --text-primary: #f0f0f5;
  --text-muted: #8a8aa0;
  --accent: #4fd1fe;
  --accent-dark: #1ac7ff;
  --win-color: #50fa7b;
  --lose-color: #ff5555;
  --tie-color: #f1fa8c;
  --border-color: #44445a;
  --shadow-color: rgba(0,0,0,0.5);
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Poppins', sans-serif;
  --font-mono: 'Roboto Mono', monospace;
  --border-radius: 12px;
  --spacing: 20px;
  --transition: 0.25s;

  --rarity-common: #b0b0b0;
  --rarity-uncommon: #50fa7b;
  --rarity-rare: #8be9fd;
  --rarity-epic: #bd93f9;
  --rarity-legendary: #ffb86c;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-body);
  font-size: 18px;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  scroll-behavior: smooth;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }

button {
  cursor: pointer;
  background-color: var(--accent);
  color: var(--bg-dark);
  border: none;
  padding: 10px 22px;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: background-color var(--transition), transform 0.1s ease;
}
button:hover { background-color: var(--accent-dark); }
button:active { transform: scale(0.96); }
button:disabled { background-color: var(--border-color); color: var(--text-muted); cursor: not-allowed; }

input[type="text"], input[type="number"], input[type="password"] {
  padding: 10px;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  background-color: var(--bg-panel);
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  text-align: center;
  transition: border-color var(--transition);
}
input:focus { border-color: var(--accent); }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 10px;
  background: var(--border-color);
  border-radius: 5px;
  outline: none;
  opacity: 0.8;
  transition: opacity var(--transition);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ---------- Typography ---------- */
.small { font-size: 0.9rem; }
.small-muted { font-size: 0.85rem; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; gap: var(--spacing); padding: var(--spacing); }
.sidebar { width: 350px; display: flex; flex-direction: column; gap: var(--spacing); flex-shrink: 0; }
.game-area { flex: 1; display: flex; flex-direction: column; gap: var(--spacing); }

/* ---------- Sidebar Components ---------- */
.brand { display: flex; align-items: center; gap: var(--spacing); padding-bottom: var(--spacing); border-bottom: 1px solid var(--border-color); }
.logo { font-size: 3rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }

.panel {
  background-color: var(--bg-panel);
  padding: var(--spacing);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coins-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing); }
.coin-display { display: flex; align-items: center; gap: 12px; }
.coin-icon { font-size: 2rem; }
.coin-text { font-family: var(--font-mono); font-size: 1.8rem; font-weight: 700; }

.value-pill { background-color: var(--bg-dark); color: var(--text-primary); padding: 6px 12px; border-radius: var(--border-radius); font-weight: 700; font-size: 1.1rem; }

/* ---------- Shop & Inventory ---------- */
.shop-list { display: flex; flex-direction: column; gap: 12px; height: 300px; overflow-y: auto; padding-right: 6px; }
.shop-list::-webkit-scrollbar { width: 10px; }
.shop-list::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 5px; }

.shop-item { display: flex; align-items: center; gap: 16px; padding: 12px; background-color: var(--bg-dark); border-radius: var(--border-radius); transition: background-color var(--transition); border: 2px solid transparent; flex-wrap: wrap; }
.shop-item:hover { background-color: var(--bg-hover); }
.shop-item .icon { font-size: 2.5rem; line-height: 1; }
.shop-item .info { flex: 1; }
.shop-item button { padding: 8px 16px; }
.shop-item.owned { opacity: 0.6; }

.shop-item.rarity-Common { border-color: var(--rarity-common); }
.shop-item.rarity-Common .rarity { color: var(--rarity-common); }
.shop-item.rarity-Uncommon { border-color: var(--rarity-uncommon); }
.shop-item.rarity-Uncommon .rarity { color: var(--rarity-uncommon); }
.shop-item.rarity-Rare { border-color: var(--rarity-rare); }
.shop-item.rarity-Rare .rarity { color: var(--rarity-rare); }
.shop-item.rarity-Epic { border-color: var(--rarity-epic); }
.shop-item.rarity-Epic .rarity { color: var(--rarity-epic); }
.shop-item.rarity-Legendary { border-color: var(--rarity-legendary); }
.shop-item.rarity-Legendary .rarity { color: var(--rarity-legendary); }

/* ---------- Footer ---------- */
.footer { display: flex; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: var(--spacing); font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Arena & Cards ---------- */
.arena { display: flex; justify-content: space-around; max-width: 900px; gap: 50px; margin: 0 auto; }
.card-inner { width: 120px; height: 160px; position: relative; transform-style: preserve-3d; transition: transform 0.6s; cursor: pointer; }
.card-inner.flipped { transform: rotateY(180deg); }
.card-front, .card-back { position: absolute; width: 100%; height: 100%; border-radius: var(--border-radius); backface-visibility: hidden; display: flex; justify-content: center; align-items: center; font-size: 3rem; }
.card-front { background-color: var(--bg-card); color: var(--text-primary); }
.card-back { background-color: var(--bg-hover); color: var(--accent); transform: rotateY(180deg); }

/* ---------- VS Area ---------- */
.vs-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.vs-bubble { background-color: var(--accent); color: var(--bg-dark); border-radius: 50%; width: 70px; height: 70px; display: flex; justify-content: center; align-items: center; font-weight: 700; font-size: 1.5rem; box-shadow: 0 4px 12px var(--shadow-color); }

/* ---------- Choices ---------- */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: var(--spacing); }
.choice { width: 90px; height: 90px; font-size: 2rem; display: flex; justify-content: center; align-items: center; flex-direction: column; border-radius: var(--border-radius); background: var(--bg-panel); transition: transform 0.25s, background-color 0.25s; cursor: pointer; box-shadow: 0 4px 10px var(--shadow-color); }
.choice:hover { transform: scale(1.1); background: var(--accent); }
.choice-label { font-size: 0.9rem; margin-top: 4px; color: var(--text-primary); }

/* ---------- Status Text ---------- */
#status-text { margin-top: 20px; font-size: 1.2rem; min-height: 24px; text-align: center; }
.win-text { color: var(--win-color); font-weight: 700; }
.lose-text { color: var(--lose-color); font-weight: 700; }
.tie-text { color: var(--tie-color); font-weight: 700; }

/* ---------- Loading Spinner ---------- */
#loading-spinner { border: 6px solid #222; border-top: 6px solid var(--accent); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; display: none; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ---------- Confetti ---------- */
.confetti-wrap { position: fixed; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:9999; }
.confetti-dot { position: absolute; width: 12px; height: 12px; background: var(--accent); border-radius: 50%; animation: fall 3s ease-in forwards; opacity: 0; }
@keyframes fall { 0% { transform: translateY(-100px) rotate(0deg); opacity:1; } 100% { transform: translateY(100vh) rotate(720deg); opacity:0; } }

/* ---------- Inventory ---------- */
#inventory-list { display: flex; flex-wrap: wrap; gap: 10px; max-height: 220px; overflow-y: auto; padding: 5px; }
.inventory-item { background-color: var(--bg-panel); padding: 6px 12px; border-radius: var(--border-radius); font-size: 1rem; color: var(--text-primary); display: flex; align-items: center; gap: 6px; cursor: pointer; transition: background-color var(--transition); }
.inventory-item:hover { background-color: var(--bg-hover); }

/* ---------- Top Buttons ---------- */
.top-buttons { display: flex; justify-content: space-between; padding: 10px 0; gap: 12px; }
.top-buttons .btn { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app { flex-direction: column; padding: 16px; }
  .sidebar { width: 100%; }
  .arena { flex-direction: column; align-items: center; gap: 40px; }
  .card-inner { width: 100px; height: 140px; }
  .choice { width: 70px; height: 70px; font-size: 1.6rem; }
}

@media (max-width: 500px) {
  .top-buttons { flex-direction: column; gap: 8px; }
  #match-id-input { width: 100%; margin-bottom: 8px; }
  .arena { gap: 20px; }
  .card-inner { width: 90px; height: 120px; }
  .choice { width: 60px; height: 60px; font-size: 1.4rem; }
}
.opponent-info {
  margin-top: 20px;
  padding: 10px;
  border-top: 2px solid #444;
  background-color: #1e1e2e;
  color: #fff;
  text-align: center;
}

.opponent-items {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.opponent-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 14px;
}
