@import url('https://fonts.googleapis.com/css2?family=Lalezar&family=Baloo+Bhaijaan+2:wght@400;500;700;800&display=swap');

:root {
  /* هوية سنسونة: ليل عنبي دافئ + مانجو + نعناع + عباد شمس */
  --bg: #1d0f3a;
  --bg2: #2a1650;
  --panel: rgba(52, 28, 98, .72);
  --panel-solid: #2d1a55;
  --line: rgba(255, 236, 214, .12);
  --text: #fff7ec;
  --muted: #c9b8e6;
  --mango: #ff8a1f;
  --mango-deep: #c75a00;
  --sky: #2ee6c5;
  --indigo: #7c4dff;
  --pink: #ff7aa2;
  --amber: #ffc93c;
  --green: #2ee6a0;
  --red: #ff4d6d;
  --radius: 22px;
  --display: 'Lalezar', 'Baloo Bhaijaan 2', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Baloo Bhaijaan 2', sans-serif;
  background: var(--panel-solid);
  background-image:
    radial-gradient(900px 520px at 85% -10%, rgba(255, 138, 31, .22), transparent 60%),
    radial-gradient(800px 480px at -10% 110%, rgba(46, 230, 197, .14), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--sky); }
button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: rgba(29, 15, 58, .82); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; color: var(--text); text-decoration: none; }
.brand .logo { width: 48px; height: 48px; display: grid; place-items: center; }
.brand .logo img { width: 48px; height: 48px; object-fit: contain; display: block; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.brand .name { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--mango); letter-spacing: .5px;
  -webkit-text-stroke: 1.5px #1f1040; paint-order: stroke fill; text-shadow: 0 3px 0 #1f1040; }
h1, h2, .display { font-family: var(--display); font-weight: 400; letter-spacing: .3px; }
.brand .name em { font-style: normal; color: var(--muted); font-weight: 700; font-size: .7em; -webkit-text-stroke: 0; text-shadow: none; }
.brand .name { white-space: nowrap; }
@media (max-width: 480px) { .topbar { padding: 10px 12px; } .brand .name { font-size: 22px; } .brand .logo, .brand .logo img { width: 38px; height: 38px; } }
.topbar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(10px);
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text);
  padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: transform .12s, background .2s, border-color .2s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); }
.btn:active { transform: translateY(3px); }
.btn:focus-visible, .input:focus-visible, .game-card:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--mango); border: 0; color: #2a1200; box-shadow: 0 5px 0 var(--mango-deep); }
.btn-primary:hover { background: #ff9a3a; }
.btn-primary:active, .btn-success:active { box-shadow: 0 2px 0 var(--mango-deep); }
.btn-success { background: var(--sky); border: 0; color: #08332c; box-shadow: 0 5px 0 #0f9e86; }
.btn-success:active { box-shadow: 0 2px 0 #0f9e86; }
.btn-danger { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .4); color: #fda4af; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 28px; font-size: 24px; border-radius: 18px; font-family: var(--display); font-weight: 400; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%; background: rgba(0, 0, 0, .25); border: 1.5px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 14px; font-size: 15px; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--sky); }
.textarea { resize: vertical; min-height: 70px; }
.select option { background: var(--panel-solid); }
label.lbl { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin: 0 0 6px; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.badge-warn { background: rgba(251, 191, 36, .15); color: var(--amber); border: 1px solid rgba(251, 191, 36, .35); }
.badge-ok { background: rgba(34, 197, 94, .15); color: #86efac; border: 1px solid rgba(34, 197, 94, .35); }
.badge-info { background: rgba(56, 189, 248, .15); color: #7dd3fc; }

.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(16, 7, 34, .78); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 760px; background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 24px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop .25s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 22px; }
.x { background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }

.tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, .25); padding: 5px; border-radius: 14px; margin-bottom: 16px; }
.tab { flex: 1; padding: 9px; border: 0; background: none; color: var(--muted); font-weight: 800; border-radius: 10px; cursor: pointer; font-size: 14px; }
.tab.active { background: rgba(255, 255, 255, .1); color: var(--text); }

/* ---------- toast ---------- */
#toast-box { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2d1a55; border: 1px solid var(--line); padding: 10px 20px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: opacity .4s, transform .4s; }
.toast-ok { border-color: rgba(34, 197, 94, .5); color: #86efac; }
.toast-err { border-color: rgba(244, 63, 94, .5); color: #fda4af; }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- game cards ---------- */
.game-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.game-card {
  position: relative; border: 2px solid var(--line); border-radius: 20px; padding: 18px; cursor: pointer;
  background: rgba(255, 255, 255, .03); transition: border-color .2s, transform .15s, background .2s; text-align: right;
  color: var(--text); font: inherit;
}
.game-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .06); }
.game-card.selected { border-color: var(--gc, var(--amber)); background: rgba(255, 201, 60, .08); box-shadow: 0 0 0 4px rgba(255, 201, 60, .14); }
.game-card .ge { font-size: 40px; }
.game-card h3 { margin: 6px 0 4px; font-size: 22px; font-family: var(--display); font-weight: 400; }
.game-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

.spinner { width: 22px; height: 22px; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 54px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
