* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Alef", "Rubik", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fdf7ea;
  color: #222;
  direction: rtl;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fffbea;
  overflow: hidden;
}

/* Top bar */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffe7a3;
  border-bottom: 2px solid #f3c45c;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.dots {
  display: flex;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0c88b;
}

.dot.active {
  background: #ff8a5c;
}

.score-box {
  background: #fffdf3;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  border: 1px solid #f3c45c;
}

/* Main screen */

.screen {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task {
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.task.active {
  display: flex;
}

.task-title {
  font-size: 18px;
  font-weight: 700;
  color: #e5673c;
}

.task-inst {
  font-size: 14px;
  color: #444;
}

/* Drag & Drop */

.dragdrop {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drag-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.drag-item {
  background: #fff;
  border-radius: 16px;
  padding: 8px 12px;
  min-width: 90px;
  text-align: center;
  font-size: 14px;
  border: 2px dashed #ffa45e;
  cursor: grab;
  user-select: none;
}

.drag-item.dragging {
  opacity: 0.6;
  border-style: solid;
}

.drop-zones {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(60px, 1fr);
  gap: 6px;
  padding-top: 4px;
}

.drop-zone {
  background: #fffdf3;
  border-radius: 16px;
  border: 2px dashed #b0d98f;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  position: relative;
}

.drop-zone.over {
  background: #f5ffe4;
}

.drop-label {
  font-size: 13px;
  text-align: center;
  color: #486b1a;
  padding: 0 4px;
}

.drop-zone .drag-item {
  border-style: solid;
  border-color: #7cc576;
  margin: 0;
}

/* True / False */

.tf-card {
  flex: 1;
  background: #fff;
  border-radius: 18px;
  border: 2px solid #ffb77b;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.tf-text {
  font-size: 18px;
  text-align: center;
  padding: 4px;
}

.tf-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.tf-counter {
  text-align: center;
  font-size: 13px;
  color: #555;
}

/* Flip cards */

.flip-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(80px, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.flip-card {
  position: relative;
  perspective: 800px;
  cursor: pointer;
}

.flip-card-inner {
  position: absolute;
  inset: 0;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
}

.flip-face.front {
  background: #fff;
  border: 2px solid #7bc8ff;
  color: #245c7a;
}

.flip-face.back {
  background: #d9f3ff;
  border: 2px solid #7bc8ff;
  color: #14445a;
  transform: rotateY(180deg);
}

/* Memory game */

.memory-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(60px, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.memory-card {
  background: #fff;
  border-radius: 14px;
  border: 2px solid #9dd8ff;
  font-size: 13px;
  padding: 4px;
  text-align: center;
  cursor: pointer;
  color: #245c7a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.memory-card.pic-card {
  padding: 0;
}

.memory-card.open {
  background: #e5f6ff;
  border-color: #4fb0ff;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.memory-card:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Bottom bar */

.bottom-bar {
  padding: 6px 10px;
  background: #ffe7a3;
  border-top: 2px solid #f3c45c;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feedback {
  min-height: 22px;
  font-size: 13px;
  text-align: center;
  color: #44503b;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
}

/* Buttons */

.btn {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #ff8a5c;
  color: #fff;
  box-shadow: 0 2px 0 #d9613e;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #d9613e;
}

.btn.small {
  padding: 6px 16px;
  font-size: 13px;
}

.btn.wide {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* Intro overlay */

.intro-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 231, 163, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.intro-overlay.hidden {
  display: none;
}

.intro-card {
  width: 90%;
  max-width: 360px;
  background: #fffdf5;
  border-radius: 22px;
  border: 2px solid #ffd37b;
  padding: 18px;
  text-align: center;
}

.intro-title {
  font-size: 26px;
  color: #e5673c;
  margin-bottom: 8px;
  font-weight: 700;
}

.intro-sub {
  font-size: 14px;
  color: #444;
  margin-bottom: 14px;
}

/* Summary overlay */

.summary-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.summary-overlay.hidden {
  display: none;
}

.summary-card {
  width: 90%;
  max-width: 360px;
  background: #fffdf5;
  border-radius: 20px;
  border: 2px solid #ffd37b;
  padding: 16px;
  text-align: center;
}

.summary-title {
  font-size: 22px;
  color: #e5673c;
  margin-bottom: 8px;
}

.summary-text {
  font-size: 15px;
  margin-bottom: 6px;
}

.summary-message {
  font-size: 14px;
  color: #355317;
  margin-bottom: 12px;
}

/* Responsive tweaks */

@media (max-height: 600px) {
  .task-title {
    font-size: 16px;
  }
  .tf-text {
    font-size: 16px;
  }
  .flip-face {
    font-size: 13px;
  }
}