/* Sabah — Sade, reklamsız, gölgesiz, tek elli mobil tasarım */
/* Yalnız regular (400) ve medium (500) yazı ağırlıkları; kart ayrımı ince çerçeveyle. */

:root {
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --surface-subtle: #F3EFE8;
  --text: #18181B;
  --text-muted: #5C5B57;
  --text-soft: #7E7C76;
  --border: #E5E0D7;
  --border-strong: #CFC8BC;
  --accent: #B84A27;
  --accent-surface: #FDF1EC;
  --accent-border: #EAC0B0;
  --success: #1D7344;
  --success-surface: #EEF8F2;
  --danger: #B91C1C;
  --danger-surface: #FEF2F2;
  --warning: #A16207;
  --warning-surface: #FEFCE8;
  --grid-active: #18181B;
  --grid-cell: #F3EFE8;
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --surface: #181A1E;
    --surface-subtle: #202329;
    --text: #F2F3F5;
    --text-muted: #A6ABB6;
    --text-soft: #7D8390;
    --border: #2B2F37;
    --border-strong: #3E4450;
    --accent: #E27D57;
    --accent-surface: #2A1E19;
    --accent-border: #5E392B;
    --success: #4ADE80;
    --success-surface: #13251B;
    --danger: #F87171;
    --danger-surface: #2B1717;
    --warning: #FBBF24;
    --warning-surface: #282112;
    --grid-active: #E27D57;
    --grid-cell: #202329;
  }
}

:root[data-theme="dark"] {
  --bg: #111214;
  --surface: #181A1E;
  --surface-subtle: #202329;
  --text: #F2F3F5;
  --text-muted: #A6ABB6;
  --text-soft: #7D8390;
  --border: #2B2F37;
  --border-strong: #3E4450;
  --accent: #E27D57;
  --accent-surface: #2A1E19;
  --accent-border: #5E392B;
  --success: #4ADE80;
  --success-surface: #13251B;
  --danger: #F87171;
  --danger-surface: #2B1717;
  --warning: #FBBF24;
  --warning-surface: #282112;
  --grid-active: #E27D57;
  --grid-cell: #202329;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, a {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.app-shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Üst çubuk */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-group {
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.brand-date {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:active {
  background: var(--surface-subtle);
}

.icon-btn.spinning svg.icon-refresh {
  animation: spin 0.8s linear infinite;
}

.icon-btn.ok {
  border-color: var(--success);
  color: var(--success);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Durum şeridi */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-muted);
}

.status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.status-pill.ready {
  border-color: transparent;
  background: var(--success-surface);
  color: var(--success);
}

.status-pill.warn {
  border-color: transparent;
  background: var(--warning-surface);
  color: var(--warning);
}

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent-surface);
  font-size: 14px;
}

.text-btn {
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--accent-border);
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  font-size: 13px;
}

/* Ana içerik */
.view-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.section-meta {
  font-size: 12px;
  color: var(--text-soft);
}

/* Haber kartları */
.news-list {
  display: flex;
  flex-direction: column;
}

.news-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.news-item:first-child {
  border-top: 0;
  padding-top: 2px;
}

.news-item:last-child {
  padding-bottom: 2px;
}

.news-item.is-read .news-title {
  color: var(--text-muted);
}

.news-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.news-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

.news-summary {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.news-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.news-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.news-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip-btn {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.chip-btn.active {
  border-color: var(--accent-border);
  background: var(--accent-surface);
  color: var(--accent);
}

.chip-btn:active {
  background: var(--surface-subtle);
}

/* Ana butonlar */
.primary-btn {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 500;
  font-size: 15.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:active {
  opacity: 0.9;
}

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

.secondary-btn {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.secondary-btn:active {
  background: var(--surface-subtle);
}

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

.btn-row > * {
  flex: 1;
}

/* Egzersiz listesi (ana ekran alt başparmak alanı) */
.hero-play-card {
  border: 1px solid var(--accent-border);
  background: var(--accent-surface);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-play-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hero-play-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.hero-play-title {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 500;
}

.hero-play-sub {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exercise-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exercise-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.exercise-info {
  min-width: 0;
}

.exercise-name {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}

.exercise-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.exercise-start-btn {
  flex-shrink: 0;
  min-height: 44px;
  min-width: 82px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.exercise-start-btn.done {
  border-color: transparent;
  background: var(--success-surface);
  color: var(--success);
}

.science-toggle {
  background: none;
  border: 0;
  padding: 2px 0;
  text-align: left;
  font-size: 12.5px;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.science-box {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

/* Oyun ekranları ortak */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

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

.option-btn {
  min-height: 56px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.option-btn:active:not(:disabled) {
  background: var(--surface-subtle);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-surface);
  color: var(--success);
}

.option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-surface);
  color: var(--danger);
}

/* N-Back ızgarası */
.nback-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.seg-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-subtle);
}

.seg-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
}

.nback-grid {
  width: min(100%, 276px);
  aspect-ratio: 1;
  margin: 4px auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.nback-cell {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--grid-cell);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.nback-cell.lit {
  background: var(--grid-active);
  border-color: var(--grid-active);
}

.nback-feedback {
  text-align: center;
  min-height: 22px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.nback-feedback.ok { color: var(--success); }
.nback-feedback.err { color: var(--danger); }

/* Stroop stimulus */
.rule-banner {
  text-align: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.rule-banner.rule-color {
  border-color: var(--accent-border);
  background: var(--accent-surface);
  color: var(--accent);
}

.stroop-stage {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 12px;
  gap: 8px;
}

.stroop-word {
  font-size: 40px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Oran sorusu */
.math-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-surface);
  padding: 3px 8px;
  border-radius: 6px;
}

.math-prompt {
  margin: 8px 0 4px;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.4;
}

.explain-box {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

/* Sonuç metrikleri */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-subtle);
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 22px;
  font-weight: 500;
  margin-top: 2px;
}

/* Bülten sonu */
.bulletin-end {
  text-align: center;
  padding: 18px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  padding: 18px 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
