:root {
  --teal: #1b5e6b;
  --teal-dark: #134a54;
  --parchment: #f5ead6;
  --parchment2: #ebe0c8;
  --gold: #c8922a;
  --gold-light: #e8b84b;
  --crimson: #8b2020;
  --ink: #1a1008;
  --muted: #6b5d4a;
  --font-ar: 'Noto Sans Arabic', sans-serif;
  --radius: 6px;
  --shadow: 0 4px 20px rgba(26, 16, 8, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--ink);
  background-color: var(--teal);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% 10%, rgba(232,184,75,0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 90% 90%, rgba(232,184,75,0.14), transparent 50%);
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.app {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.topbar-title {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--parchment);
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tool-btn,
.back-link {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.88rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(232,184,75,0.45);
  background: rgba(245,234,214,0.12);
  color: var(--parchment);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  touch-action: manipulation;
  min-height: 34px;
  direction: ltr;
}

.icon-btn {
  font-size: 1rem;
  padding: 0.35rem 0.55rem;
  min-width: 34px;
  justify-content: center;
}

.tool-btn:hover,
.back-link:hover {
  background: rgba(245,234,214,0.22);
  border-color: var(--gold-light);
}

.card {
  background: var(--parchment);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(200,146,42,0.25);
  padding: 1.25rem 1.1rem;
  position: relative;
}

.card h2 {
  font-family: var(--font-ar);
  color: var(--teal);
  font-size: 1.25rem;
  margin: 0 0 1rem;
  text-align: center;
}

.btn-primary {
  font-family: var(--font-ar);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--gold);
  background: var(--teal);
  color: var(--parchment);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}

.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  font-family: var(--font-ar);
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 40px;
}

.btn-secondary:hover { background: rgba(27,94,107,0.08); }

.game-link {
  display: block;
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(200,146,42,0.35);
  background: var(--parchment2);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.game-link:hover {
  background: rgba(27,94,107,0.08);
  border-color: var(--gold);
}

.game-link h3 {
  font-family: var(--font-ar);
  color: var(--teal);
  font-size: 1.1rem;
  margin: 0;
}

.site-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: rgba(245,234,214,0.75);
  direction: ltr;
}

.site-footer a {
  color: var(--gold-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(232,184,75,0.35);
}

.site-footer a:hover { color: #fff; }

.status-msg {
  font-family: var(--font-ar);
  text-align: center;
  color: var(--crimson);
  font-size: 0.95rem;
  margin: 0.75rem 0 0;
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
