/* ==========================================================================
   Crystal Mods — Minecraft theme tokens & primitives
   ========================================================================== */
:root {
  --bg: #0f1115;
  --bg-2: #14171d;
  --panel: #1b1f27;
  --panel-2: #222733;
  --line: #2f3542;

  --crystal: #1fd67a;
  --crystal-dark: #14a35b;
  --crystal-glow: rgba(31, 214, 122, 0.35);
  --grass: #5fae3a;
  --grass-dark: #3f8226;
  --gold: #ffa502;
  --gold-dark: #c47c00;
  --redstone: #ff4b3e;
  --redstone-dark: #a30b08;
  --diamond: #4aedd9;
  --xp: #7efc20;

  --slot-dark: #373737;
  --slot-mid: #8b8b8b;
  --slot-light: #ffffff;
  --btn-face: #6f6f6f;
  --btn-face-hover: #7f8bff;
  --tooltip-bg: rgba(16, 0, 16, 0.94);
  --tooltip-border: #2a0a5e;
  --tooltip-border-2: #5000ff;

  --text: #f1f2f6;
  --text-muted: #a4b0be;
  --text-dim: #6c7684;

  --font-pixel: 'Press Start 2P', monospace;
  --font-head: 'Pixelify Sans', 'Tajawal', sans-serif;
  --font-body: 'Pixelify Sans', 'Tajawal', sans-serif;

  --radius: 2px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

html[lang='ar'] {
  --font-head: 'Tajawal', 'Pixelify Sans', sans-serif;
  --font-body: 'Tajawal', 'Pixelify Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  /* deepslate grid */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(31, 214, 122, 0.08), transparent 60%);
  background-size: 32px 32px, 32px 32px, 100% 600px;
  background-repeat: repeat, repeat, no-repeat;
}
html[lang='ar'] body { font-size: 17px; }

img { display: block; max-width: 100%; }
.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul { list-style: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--slot-dark); border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--crystal-dark); }

::selection { background: var(--crystal); color: #04140b; }

/* ---------- typography ---------- */
.pixel { font-family: var(--font-pixel); letter-spacing: 0; line-height: 1.6; }
.pixel-sm { font-family: var(--font-pixel); font-size: 0.6rem; line-height: 1.8; }
.pixel-xs { font-family: var(--font-pixel); font-size: 0.5rem; line-height: 1.8; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; font-weight: 700; }
.mc-shadow { text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.7); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-crystal { color: var(--crystal); }
.text-gold { color: var(--gold); }
.text-red { color: var(--redstone); }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.grid { display: grid; gap: 24px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; } .mt-6 { margin-top: 64px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 40px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   Minecraft button
   ========================================================================== */
.mc-btn {
  --face: var(--btn-face);
  --face-hover: var(--btn-face-hover);
  --ink: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 22px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55);
  background: var(--face);
  border: 2px solid #000;
  border-radius: var(--radius);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.45),
    inset -3px -3px 0 rgba(0, 0, 0, 0.45);
  transition: background-color 0.08s, transform 0.05s, box-shadow 0.08s;
  user-select: none;
  white-space: nowrap;
}
html[lang='ar'] .mc-btn { font-family: var(--font-head); }
.mc-btn:hover { background: var(--face-hover); }
.mc-btn:active {
  transform: translateY(2px);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.35), inset -2px -2px 0 rgba(255, 255, 255, 0.2);
}
.mc-btn:disabled, .mc-btn[aria-disabled='true'] {
  cursor: not-allowed;
  filter: grayscale(0.7) brightness(0.6);
  transform: none;
}
.mc-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.mc-btn-green { --face: var(--grass); --face-hover: #70c44a; }
.mc-btn-crystal { --face: var(--crystal-dark); --face-hover: var(--crystal); --ink: #fff; }
.mc-btn-gold { --face: var(--gold-dark); --face-hover: var(--gold); }
.mc-btn-red { --face: var(--redstone-dark); --face-hover: #d4211a; }
.mc-btn-dark { --face: #2b3038; --face-hover: #3a414c; }
.mc-btn-sm { min-height: 34px; padding: 6px 14px; font-size: 0.9rem; }
.mc-btn-xs { min-height: 28px; padding: 2px 10px; font-size: 0.8rem; }
.mc-btn-icon { width: 44px; padding: 0; }
.mc-btn-block { width: 100%; }

/* ==========================================================================
   Panels / inventory slots
   ========================================================================== */
.mc-panel {
  background: var(--panel);
  border: 2px solid #000;
  border-radius: var(--radius);
  box-shadow:
    inset 3px 3px 0 rgba(255, 255, 255, 0.08),
    inset -3px -3px 0 rgba(0, 0, 0, 0.45),
    0 6px 0 rgba(0, 0, 0, 0.35);
  padding: 24px;
}
.mc-panel-light {
  background: #c6c6c6;
  color: #3f3f3f;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555;
}
.mc-slot {
  background: #8b8b8b;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 var(--slot-dark), inset -2px -2px 0 var(--slot-light);
}
.mc-slot-dark {
  background: var(--bg-2);
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.7), inset -2px -2px 0 rgba(255, 255, 255, 0.1);
}

/* Grass strip divider (grass over dirt) */
.grass-strip {
  height: 14px;
  width: 100%;
  background:
    linear-gradient(90deg, var(--grass) 0 25%, var(--grass-dark) 25% 50%, var(--grass) 50% 75%, #6cbb43 75% 100%) top / 32px 6px repeat-x,
    linear-gradient(90deg, #8b5a2b 0 30%, #7a4e24 30% 60%, #9c6631 60% 100%) bottom / 24px 8px repeat-x;
  border-top: 2px solid #3f8226;
  border-bottom: 2px solid #4a2e12;
}

/* Chips / tags */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-2);
  border: 2px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius);
  white-space: nowrap;
}
.chip-crystal { border-color: var(--crystal-dark); color: var(--crystal); }
.chip-gold { border-color: var(--gold-dark); color: var(--gold); }
.chip-red { border-color: var(--redstone-dark); color: var(--redstone); }

/* Minecraft tooltip (purple) */
.mc-tooltip {
  position: relative;
}
.mc-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--tooltip-bg);
  border: 2px solid var(--tooltip-border-2);
  outline: 2px solid var(--tooltip-border);
  color: #fff;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 50;
}
html[dir='rtl'] .mc-tooltip::after { transform: translateX(50%); }
.mc-tooltip:hover::after { opacity: 1; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; color: var(--text-muted); font-size: 0.95rem; }
.mc-input, .mc-select, .mc-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: #000;
  color: var(--text);
  border: 2px solid #a0a0a0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px #1a1a1a;
  outline: none;
  transition: border-color 0.12s;
}
.mc-textarea { min-height: 120px; resize: vertical; }
.mc-input:focus, .mc-select:focus, .mc-textarea:focus { border-color: #fff; }
.mc-input::placeholder, .mc-textarea::placeholder { color: var(--text-dim); }
.mc-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #a0a0a0 50%), linear-gradient(135deg, #a0a0a0 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-inline-end: 34px;
}
html[dir='rtl'] .mc-select { background-position: 18px 50%, 12px 50%; }
.mc-select option { background: #111; }
.mc-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.mc-check input { width: 20px; height: 20px; accent-color: var(--crystal); }
.form-error { color: var(--redstone); font-size: 0.9rem; min-height: 1.2em; }
.help { color: var(--text-dim); font-size: 0.85rem; }

/* ==========================================================================
   Toast — advancement style
   ========================================================================== */
.toast-stack {
  position: fixed;
  top: 90px;
  inset-inline-end: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}
.mc-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
  max-width: 360px;
  padding: 10px 14px;
  background: #212121;
  border: 2px solid #000;
  box-shadow: inset 3px 3px 0 #555, inset -3px -3px 0 #111, var(--shadow);
  animation: toast-in 0.25s ease-out;
}
.mc-toast.out { animation: toast-out 0.3s ease-in forwards; }
.mc-toast .toast-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: #8b8b8b;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff;
}
.mc-toast .toast-title { font-family: var(--font-head); font-weight: 700; color: var(--gold); font-size: 0.95rem; }
.mc-toast.success .toast-title { color: var(--xp); }
.mc-toast.error .toast-title { color: var(--redstone); }
.mc-toast .toast-body { color: #fff; font-size: 0.92rem; }
@keyframes toast-in { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-20px); opacity: 0; } }
html[dir='rtl'] .mc-toast { animation-name: toast-in-rtl; }
@keyframes toast-in-rtl { from { transform: translateX(-120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ==========================================================================
   Misc
   ========================================================================== */
.xp-bar {
  height: 10px;
  background: #000;
  border: 2px solid #3a3a3a;
  position: relative;
  overflow: hidden;
}
.xp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(#a5ff4a, var(--xp) 60%, #4fb300);
}
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  min-height: 20px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.fade-in { animation: fade-in 0.3s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.float { animation: float 4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
