/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --banana-yellow: #FFD43B;
  --banana-dark: #F0B800;
  --banana-light: #FFF8E1;
  --banana-glow: rgba(255, 212, 59, 0.25);
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #4A4A6A;
  --text-muted: #8888A0;
  --border: #E8E8F0;
  --border-hover: #D0D0E0;
  --danger-red: #EF4444;
  --focus-ring: #2563EB;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 30px var(--banana-glow);
  --transition: 0.2s ease;
  --font-body: 'Heebo', sans-serif;
}

/* ===== Clean Dark Mode ===== */
[data-theme="dark"]:not([data-style="military"]) {
  --banana-light: #2A2520;
  --banana-glow: rgba(255, 212, 59, 0.15);
  --bg: #16161E;
  --bg-card: #1E1E2A;
  --text-primary: #EAEAF2;
  --text-secondary: #B0B0C8;
  --text-muted: #7878A0;
  --border: #2C2C40;
  --border-hover: #3C3C58;
  --focus-ring: #60A5FA;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 30px var(--banana-glow);
}

[data-theme="dark"]:not([data-style="military"]) .modal {
  background: var(--bg-card);
}

[data-theme="dark"]:not([data-style="military"]) .modal-overlay {
  background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"]:not([data-style="military"]) .result-card {
  background: linear-gradient(135deg, #2A2520 0%, var(--bg-card) 100%);
}

[data-theme="dark"]:not([data-style="military"]) .footer-disclaimer {
  background: #0C0C14;
}

[data-theme="dark"]:not([data-style="military"]) .banana-hero-img {
  filter: drop-shadow(0 0 12px rgba(255, 212, 59, 0.3));
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  padding: 8px;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  top: -100px;
  right: 0;
  background: var(--focus-ring);
  color: #fff;
  padding: 8px 16px;
  z-index: 2000;
  font-size: 0.9rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ===== Focus Styles ===== */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ===== Theme Controls ===== */
.theme-controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 900;
  display: flex;
  gap: 8px;
}

.theme-btn {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.theme-btn:hover {
  border-color: var(--banana-yellow);
  box-shadow: var(--shadow-md);
  transform: scale(1.08);
}

.theme-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 30, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 40px 28px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: wiggle 1.5s ease-in-out infinite;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.modal-body {
  text-align: right;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-warning {
  font-weight: 700;
  color: var(--danger-red);
}

.modal-confirm-text {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-accept {
  margin-top: 24px;
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  background: var(--banana-yellow);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-accept:hover {
  background: var(--banana-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-accept:active {
  transform: translateY(0);
}

/* ===== Hero ===== */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.banana-hero-link {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
}

.banana-hero-img {
  width: 180px;
  height: auto;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
  transition: transform 0.2s ease;
}

.banana-hero-link:hover .banana-hero-img {
  transform: scale(1.05);
}

.title {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -1px;
  direction: ltr;
  unicode-bidi: bidi-override;
  color: var(--text-primary);
}

.title-highlight {
  color: var(--banana-dark);
}

.subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.intro {
  font-size: 1.2rem;
  font-weight: 500;
  margin-top: 24px;
  color: var(--text-primary);
}

.helper-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Questions ===== */
.questions-section {
  padding: 8px 0 32px;
}

.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.question-card:hover {
  box-shadow: var(--shadow-md);
}

.question-label {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-btn {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.option-btn:hover {
  border-color: var(--banana-yellow);
  background: var(--banana-light);
  color: var(--text-primary);
}

.option-btn.selected {
  border-color: var(--banana-yellow);
  background: var(--banana-yellow);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}

.option-btn-wide {
  grid-column: 1 / -1;
}

/* ===== Calculate Button ===== */
.calc-btn-wrapper {
  text-align: center;
  padding: 12px 0 8px;
}

.btn-calculate {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-body);
  border: none;
  border-radius: var(--radius-xl);
  background: var(--banana-yellow);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.btn-calculate:not(:disabled):hover {
  background: var(--banana-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-calculate:not(:disabled):active {
  transform: translateY(0);
}

.btn-calculate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 1.3rem;
}

/* ===== Result Section ===== */
.result-section {
  padding: 16px 0 32px;
  animation: fadeIn 0.5s ease;
}

.result-card {
  background: linear-gradient(135deg, #FFF9E6 0%, #FFFFFF 100%);
  border: 2px solid var(--banana-yellow);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-glow);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.result-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.result-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.8;
  color: var(--text-primary);
}

.result-system-line {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 16px;
  direction: rtl;
}

/* ===== Basis & Stats Cards ===== */
.basis-card,
.stats-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.basis-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.stats-list {
  list-style: none;
  padding: 0;
}

.stats-list li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.7;
  opacity: 0;
  animation: fadeSlideIn 0.4s ease forwards;
}

.stats-list li:last-child {
  border-bottom: none;
}

.stats-list li::before {
  content: '🍌 ';
  margin-left: 4px;
}

.stats-list li:nth-child(1) { animation-delay: 0.1s; }
.stats-list li:nth-child(2) { animation-delay: 0.25s; }
.stats-list li:nth-child(3) { animation-delay: 0.4s; }
.stats-list li:nth-child(4) { animation-delay: 0.55s; }
.stats-list li:nth-child(5) { animation-delay: 0.7s; }

/* ===== Reset Button ===== */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-body);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-reset:hover {
  border-color: var(--banana-yellow);
  background: var(--banana-light);
  color: var(--text-primary);
}

/* ===== About Section ===== */
.about-section {
  text-align: center;
  padding: 24px 0 0;
}

.about-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.about-text strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ===== Accessibility Button (Fixed Bottom-Left) ===== */
.a11y-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 900;
  width: 50px;
  height: 50px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

.a11y-btn:hover {
  border-color: var(--focus-ring);
  box-shadow: var(--shadow-lg);
  transform: scale(1.08);
}

.a11y-btn-icon {
  font-size: 1.4rem;
  line-height: 1;
}

/* ===== Accessibility Panel ===== */
.a11y-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.a11y-panel-inner {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
}

.a11y-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.a11y-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.a11y-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.a11y-panel-body {
  padding: 16px 24px 24px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Groups */
.a11y-group {
  margin-bottom: 16px;
}

.a11y-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.a11y-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a11y-option-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.a11y-option-btn:hover {
  border-color: var(--focus-ring);
  color: var(--text-primary);
}

.a11y-option-btn.active {
  background: var(--focus-ring);
  border-color: var(--focus-ring);
  color: #fff;
}

.a11y-reset-btn {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.a11y-group-reset {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.a11y-reset-all-btn {
  width: 100%;
  text-align: center;
  color: var(--danger-red);
  border-color: var(--danger-red);
  font-weight: 700;
}

.a11y-reset-all-btn:hover {
  background: var(--danger-red);
  color: #fff;
}

/* Statement */
.a11y-statement {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
  text-align: right;
}

.a11y-statement p {
  margin-bottom: 4px;
}

/* ===== Accessibility Overrides ===== */
.a11y-high-contrast {
  filter: contrast(1.5);
}

.a11y-invert-colors {
  filter: invert(1) hue-rotate(180deg);
}

.a11y-invert-colors img,
.a11y-invert-colors .modal-icon,
.a11y-invert-colors .btn-icon {
  filter: invert(1) hue-rotate(180deg);
}

.a11y-grayscale {
  filter: grayscale(1);
}

.a11y-highlight-links a,
.a11y-highlight-links button {
  outline: 2px solid var(--focus-ring) !important;
  outline-offset: 2px !important;
}

.a11y-big-cursor,
.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M4 4l16 36 6-14 14-6z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

.a11y-reading-guide {
  /* Guide line rendered via JS */
}

.a11y-readable-font,
.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.02em;
}

.a11y-text-spacing,
.a11y-text-spacing * {
  line-height: 2.2 !important;
  letter-spacing: 0.08em !important;
  word-spacing: 0.2em !important;
}

.a11y-stop-animations,
.a11y-stop-animations *,
.a11y-stop-animations *::before,
.a11y-stop-animations *::after {
  animation: none !important;
  transition: none !important;
}

/* Reading Guide Line */
#a11y-reading-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(37, 99, 235, 0.5);
  pointer-events: none;
  z-index: 99999;
  display: none;
}

.a11y-reading-guide #a11y-reading-line {
  display: block;
}

/* ===== Footer Disclaimer ===== */
.footer-disclaimer {
  background: var(--text-primary);
  color: rgba(255,255,255,0.7);
  padding: 20px 0;
  font-size: 0.78rem;
  line-height: 1.8;
  text-align: center;
  margin-top: 40px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(15px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .title {
    font-size: 2.2rem;
  }

  .modal {
    padding: 28px 20px 24px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .option-btn-wide {
    grid-column: 1;
  }

  .btn-calculate {
    width: 100%;
    justify-content: center;
  }

  .result-text {
    font-size: 1.15rem;
  }

  .hero {
    padding: 32px 0 24px;
  }

  .banana-hero-img {
    width: 130px;
  }

  .theme-controls {
    top: 10px;
    left: 10px;
    gap: 6px;
  }

  .theme-btn {
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .title {
    font-size: 2.5rem;
  }
}
