/* ============================================================================
 * aac.css — AAC panosu (salt iletişim ekranı)
 * ----------------------------------------------------------------------------
 * Yapı: üstte cümle şeridi, altında resimli kategori şeridi, altında kart grid'i.
 * Düzenleme/ayar arayüzü yok. Kart görselleri aac-assets/<key>.jpg, yoksa emoji.
 * Terapideki "Kartla Yanıtla" modalı da buradaki .aac-card / .aac-nav-btn /
 * .th-aac-* sınıflarını kullanır.
 * ========================================================================= */

#aac-screen {
  padding: 0 !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  align-items: stretch;
  background: linear-gradient(180deg, #eaf4fd 0%, #f2f8f1 55%, #eef5ea 100%);
}

:root {
  --aac-card-bg:  #ffffff;
  --aac-card-ink: #1f2937;
  --aac-accent:   #6C63FF;
  --aac-danger:   #e53e3e;
}

.aac-board {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 1100px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 10px clamp(10px, 2vw, 24px) 14px;
  font-family: 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

/* ---- Cümle şeridi (üstte) ---- */
.aac-sentence-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--aac-card-bg);
  border-radius: 22px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(29, 47, 86, 0.1);
  flex-shrink: 0;
}

.aac-home-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  background: #eef2f7;
  color: #475569;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aac-home-btn:active { transform: scale(0.94); background: #e2e8f0; }

.aac-sentence-words {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
  min-height: 48px;
  scrollbar-width: thin;
}

.aac-sentence-placeholder {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.aac-word-chip {
  background: #eef2ff;
  border: 1.5px solid #c7d2fe;
  color: #3730a3;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.aac-word-chip:hover { border-color: var(--aac-danger); color: var(--aac-danger); }

.aac-sentence-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.aac-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s;
}
.aac-action-btn:active { transform: scale(0.88); }
.aac-action-btn.speak   { background: var(--aac-accent); color: #fff; box-shadow: 0 6px 16px rgba(108, 99, 255, 0.35); }
.aac-action-btn.clear   { background: #eef2f7; color: #4b6079; }
.aac-action-btn:disabled { opacity: 0.35; pointer-events: none; }

/* ---- Kategori şeridi ---- */
.aac-cats {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 4px 10px;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.aac-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  flex-shrink: 0;
  width: 86px;
  font-family: inherit;
}

.aac-cat-visual {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--aac-card-bg);
  border: 3px solid #e2e8f0;
  box-shadow: 0 6px 14px rgba(29, 47, 86, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.aac-cat-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.aac-cat-emoji { font-size: 1.9rem; line-height: 1; }

.aac-cat-label {
  font-size: 0.74rem;
  font-weight: 800;
  color: #64748b;
  text-align: center;
  line-height: 1.15;
}

.aac-cat-btn.active .aac-cat-visual {
  border-color: var(--aac-accent);
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.22), 0 6px 14px rgba(29, 47, 86, 0.14);
  transform: scale(1.05);
}
.aac-cat-btn.active .aac-cat-label { color: var(--aac-accent); }
.aac-cat-btn:active .aac-cat-visual { transform: scale(0.95); }

/* ---- Kart grid'i ---- */
.aac-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 4px 4px 12px;
  -webkit-overflow-scrolling: touch;
}

.aac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.aac-card {
  background: var(--aac-card-bg);
  border: 2.5px solid transparent;
  border-radius: 22px;
  padding: 14px 10px 12px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(29, 47, 86, 0.1);
  transition: transform 0.12s, border-color 0.12s;
  font-family: inherit;
}
.aac-card:active { transform: scale(0.95); }
.aac-card.tapped {
  border-color: var(--aac-accent);
  animation: aacCardPop 0.35s ease;
}
@keyframes aacCardPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

.aac-card-img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 16px;
}
.aac-card-emoji {
  font-size: 3rem;
  line-height: 1;
}
.aac-card-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--aac-card-ink);
  text-align: center;
  line-height: 1.2;
}

/* ---- Terapi: kartla yanıt modalı ---- */
.aac-nav-btn {
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 9px 14px;
  min-height: 44px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.aac-nav-btn.active {
  background: var(--aac-accent);
  border-color: var(--aac-accent);
  color: #fff;
}
.aac-nav-btn:not(.active):active { background: #e2e8f0; }

.th-aac-box { max-width: 560px; width: 94%; }
.th-aac-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0;
  flex-shrink: 0;
}
.th-aac-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 42vh;
  overflow-y: auto;
  margin: 8px 0;
  padding: 2px;
}
.th-aac-grid .aac-card {
  min-height: 92px;
  padding: 8px 6px;
  gap: 5px;
  border-radius: 14px;
}
.th-aac-grid .aac-card-emoji { font-size: 1.7rem; }
.th-aac-grid .aac-card-img { width: 44px; height: 44px; border-radius: 10px; }
.th-aac-grid .aac-card-text { font-size: 0.72rem; }
.th-aac-sentence-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  min-height: 56px;
}
.th-aac-sentence-words {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  min-width: 0;
}
@media (max-width: 480px) {
  .th-aac-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Mobil ---- */
@media (max-width: 640px) {
  .aac-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
  .aac-card { min-height: 118px; border-radius: 18px; padding: 10px 8px; gap: 7px; }
  .aac-card-img { width: 62px; height: 62px; }
  .aac-card-emoji { font-size: 2.3rem; }
  .aac-card-text { font-size: 0.82rem; }
  .aac-cat-visual { width: 54px; height: 54px; }
  .aac-cat-emoji { font-size: 1.6rem; }
  .aac-cat-btn { width: 72px; }
  .aac-sentence-bar { border-radius: 18px; }
}

/* ---- Erişilebilirlik ---- */
@media (prefers-reduced-motion: reduce) {
  .aac-card.tapped { animation: none; }
  .aac-card, .aac-cat-visual, .aac-action-btn { transition: none; }
}

body.a11y-high-contrast .aac-card { border-color: #1f2937; }
body.a11y-high-contrast .aac-cat-visual { border-color: #1f2937; }
body.a11y-high-contrast .aac-card-text, body.a11y-high-contrast .aac-cat-label { color: #000; }
