/* ─── Değişkenler ─────────────────────────────────────────────────────────── */
:root {
  --color-bg:          #023059;
  --color-bg2:         #032d52;
  --color-accent:      #0a7fd4;
  --color-accent2:     #1a96f0;
  --color-highlight:   rgba(10, 127, 212, 0.18);
  --color-card-bg:     rgba(255, 255, 255, 0.07);
  --color-card-border: rgba(255, 255, 255, 0.13);
  --color-text:        #ffffff;
  --color-muted:       rgba(255, 255, 255, 0.45);
  --color-near:        rgba(255, 255, 255, 0.72);
  --picker-item-h:     52px;
  --picker-visible:    5;
  --picker-h:          260px; /* 5 × 52 */
  --radius-card:       18px;
  --radius-btn:        50px;
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display',
               'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  user-select: none;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── App Kapsayıcı ───────────────────────────────────────────────────────── */
#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* ─── Ekranlar ────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(28px);
  transition: opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.screen.exiting {
  opacity: 0;
  transform: translateY(-22px);
  pointer-events: none;
}

/* ─── Arkaplan Dekorasyon ─────────────────────────────────────────────────── */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 400px; height: 400px;
  background: rgba(10, 127, 212, 0.12);
  top: -120px; right: -100px;
}
.bg-glow-2 {
  width: 300px; height: 300px;
  background: rgba(10, 127, 212, 0.08);
  bottom: -80px; left: -80px;
}

/* ─── ANA SAYFA ───────────────────────────────────────────────────────────── */
#screen-home {
  padding: 24px 20px;
  gap: 0;
  z-index: 1;
}

.home-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  max-width: 360px;
}

.brand {
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.75) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 14px;
  color: var(--color-muted);
  letter-spacing: 0.05em;
  margin-top: -18px;
}

/* ─── Drum Picker ─────────────────────────────────────────────────────────── */
#picker-root {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: var(--picker-h);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  display: flex;
}

/* Üst ve alt gradient silinme */
#picker-root::before,
#picker-root::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 95px;
  z-index: 3;
  pointer-events: none;
}
#picker-root::before {
  top: 0;
  background: linear-gradient(to bottom,
    var(--color-bg) 0%,
    rgba(2, 48, 89, 0.85) 40%,
    transparent 100%);
}
#picker-root::after {
  bottom: 0;
  background: linear-gradient(to top,
    var(--color-bg) 0%,
    rgba(2, 48, 89, 0.85) 40%,
    transparent 100%);
}

/* Merkez seçim şeridi */
.picker-highlight {
  position: absolute;
  left: 0; right: 0;
  top: 104px; /* 2 × 52 */
  height: var(--picker-item-h);
  z-index: 2;
  pointer-events: none;
  background: var(--color-highlight);
  border-top: 1px solid rgba(10, 127, 212, 0.45);
  border-bottom: 1px solid rgba(10, 127, 212, 0.45);
}

.picker-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.picker-col + .picker-col {
  border-left: 1px solid rgba(255,255,255,0.07);
}

.picker-col-label {
  position: absolute;
  top: 8px;
  left: 0; right: 0;
  z-index: 4;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  pointer-events: none;
}

.picker-inner {
  width: 100%;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--picker-item-h);
  font-size: 17px;
  font-weight: 500;
  color: var(--color-muted);
  transition: color 0.15s ease, font-size 0.15s ease, font-weight 0.15s ease;
}

.picker-item.near2 {
  color: rgba(255,255,255,0.35);
  font-size: 15px;
}

.picker-item.near1 {
  color: var(--color-near);
  font-size: 16px;
}

.picker-item.selected {
  color: #ffffff;
  font-size: 19px;
  font-weight: 700;
}

.picker-spacer {
  color: transparent !important;
}

/* ─── Ana Buton ───────────────────────────────────────────────────────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
  padding: 17px 52px;
  border: none;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--color-accent2) 0%, #0558a0 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(10, 127, 212, 0.4),
              0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(10, 127, 212, 0.3);
}

.btn-ripple-el {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0);
  animation: ripple-expand 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to { transform: scale(1); opacity: 0; }
}

/* Shake animasyonu */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

.shake {
  animation: shake 0.45s ease;
}

/* ─── YÜKLENİYOR EKRANI ───────────────────────────────────────────────────── */
#screen-loading {
  gap: 28px;
  z-index: 1;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.ekg-wrap {
  position: relative;
}

#ekg-canvas {
  display: block;
  border-radius: 8px;
  -webkit-mask-image: linear-gradient(to right, black 55%, transparent 100%);
  mask-image: linear-gradient(to right, black 55%, transparent 100%);
}

.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  opacity: 0.3;
  animation: dot-pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

.loading-text {
  font-size: 15px;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-align: center;
}

/* ─── SONUÇLAR EKRANI ─────────────────────────────────────────────────────── */
#screen-results {
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  align-items: center;
  z-index: 1;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 52px 20px 16px;
  flex-shrink: 0;
  width: 100%;
  max-width: 512px;
}

.btn-back {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}

.btn-back:hover {
  background: rgba(255,255,255,0.16);
}

.results-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ─── Sekmeler ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 13px;
  padding: 4px;
  width: calc(100% - 32px);
  max-width: 480px;
  margin: 0 auto 16px;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.22s ease, color 0.22s ease;
  text-transform: uppercase;
}

.tab-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(10, 127, 212, 0.4);
}

/* ─── Panel ve Kartlar ────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 32px;
  width: 100%;
  max-width: 512px;
}

.tab-panel.active {
  display: grid;
}

.stat-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.stat-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.stat-card.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 20px 20px;
}

.stat-card.wide .stat-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.stat-card.wide .stat-value {
  font-size: 30px;
}

.stat-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
  min-width: 0;
}

.stat-label {
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

/* ─── Tablet ve Masaüstü ──────────────────────────────────────────────────── */
@media (min-width: 420px) {
  .tab-panel { padding: 0 20px 40px; gap: 12px; }
  .stat-value { font-size: 28px; }
  .stat-card.wide .stat-value { font-size: 34px; }
}

@media (min-width: 600px) {
  .tab-panel { padding: 0 0 40px; gap: 14px; }
  .brand { font-size: 52px; }
  #picker-root { max-width: 380px; }
  .btn-primary { font-size: 15px; }
}

/* ─── Yaşam Beklentisi Modali ─────────────────────────────────────────────── */
.life-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 30, 55, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.life-modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.life-modal-card {
  background: #04457a;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 24px 24px 0 0;
  padding: 32px 28px 40px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  transform: translateY(60px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.life-modal-overlay.visible .life-modal-card {
  transform: translateY(0);
}

.life-modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
  margin-bottom: -8px;
}

.life-modal-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  color: #fff;
}

.life-counter {
  display: flex;
  align-items: center;
  gap: 20px;
}

.life-count-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}

.life-count-btn:active {
  background: rgba(255,255,255,0.2);
  transform: scale(0.92);
}

.life-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 100px;
  justify-content: center;
}

#life-number {
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  transition: transform 0.1s ease;
}

.life-unit {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-muted);
}

.life-note {
  font-size: 12px;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.life-confirm {
  width: 100%;
  padding: 16px;
  font-size: 14px;
}

/* Değiştir chip'i — GÖRECEKLERİM panelinde gösterilir */
.life-change-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 127, 212, 0.12);
  border: 1px solid rgba(10, 127, 212, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 2px;
}

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

.life-change-value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.life-change-btn {
  background: rgba(10, 127, 212, 0.3);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.life-change-btn:hover {
  background: rgba(10, 127, 212, 0.5);
}

/* ─── İndir Butonu ───────────────────────────────────────────────────────── */
.download-bar {
  width: 100%;
  max-width: 512px;
  padding: 8px 16px 40px;
  flex-shrink: 0;
}

.btn-download {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-download:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-download:active {
  transform: scale(0.97);
}

.btn-download.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn-download svg {
  flex-shrink: 0;
}

/* ─── Kaydırma çubuğu ───────────────────────────────────────────────────── */
#screen-results::-webkit-scrollbar { width: 4px; }
#screen-results::-webkit-scrollbar-track { background: transparent; }
#screen-results::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
