/* 10 parmak — akışkan, viewport-öncelikli arayüz */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@600;700&family=JetBrains+Mono:wght@600;700&display=swap');

.tp-shell {
  --tp-red: #e30613;
  --tp-ink: #0f172a;
  --tp-muted: #64748b;
  --tp-line: #e2e8f0;
  --tp-bg: #f4f7fb;
  --tp-card: #fff;
  --k: clamp(1.55rem, 2.35vw, 2.55rem);
  --g: clamp(0.18rem, 0.38vw, 0.38rem);
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(227, 6, 19, 0.08), transparent 55%),
    var(--tp-bg);
  padding: clamp(8px, 1.4vw, 22px) clamp(10px, 2vw, 24px) clamp(28px, 4vw, 56px);
  overflow-x: clip;
}

.tp-wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.tp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: clamp(10px, 1.4vw, 18px);
}
.tp-topbar h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.1vw, 1.45rem);
  font-weight: 800;
  color: var(--tp-ink);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tp-topbar h1 i { color: var(--tp-red); font-size: 0.9em; }
.tp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tp-line);
  color: var(--tp-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tp-back:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08); color: var(--tp-ink); }

.tp-path {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.tp-path button {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #0b1220;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}
.tp-path button.is-on {
  background: linear-gradient(135deg, #e30613, #be123c);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(227, 6, 19, 0.22);
}
.tp-path button.is-done {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
}

.tp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: clamp(10px, 1.3vw, 16px);
}
.tp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 12px 4px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--tp-line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tp-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.tp-chip i { color: var(--tp-red); font-size: 0.78rem; }
.tp-chip select {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: inherit;
  max-width: 42vw;
  cursor: pointer;
  outline: none;
}
.tp-chip.ghost { background: #fff; }
.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }
#typingSaveHint { font-size: 0.72rem; color: #16a34a; font-weight: 700; }
#typingSaveHint:empty { display: none; }
.tp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--tp-line);
  background: #fff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.tp-btn:hover { transform: translateY(-1px); background: #f8fafc; }
.tp-btn.primary {
  background: linear-gradient(135deg, #e30613, #be123c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(227, 6, 19, 0.22);
}
.tp-btn.icon { padding: 0 10px; min-width: 38px; justify-content: center; }

.tp-wordbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 12px);
  margin-bottom: clamp(10px, 1.3vw, 16px);
}
.tp-wordstat {
  background: #fff;
  border: 1px solid var(--tp-line);
  border-top: 4px solid var(--tp-line);
  border-radius: 16px;
  padding: 12px 8px 10px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.tp-wordstat.ok { border-top-color: #059669; }
.tp-wordstat.bad { border-top-color: #dc2626; }
.tp-wordstat.goal { border-top-color: #2563eb; }
.tp-wordstat.left { border-top-color: #d97706; }
.tp-wordstat b {
  display: block;
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--tp-ink);
}
.tp-wordstat span {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}
.tp-wordstat.ok b { color: #047857; }
.tp-wordstat.bad b { color: #b91c1c; }
.tp-wordstat.goal b { color: #2563eb; }
.tp-wordstat.left b { color: #d97706; }
.tp-wordbar.is-pass .tp-wordstat.ok {
  background: #f0fdf4;
  border-color: #86efac;
}
.tp-wordbar.is-pass .tp-wordstat.left b { color: #16a34a; }

.tp-verdict {
  text-align: center;
  border-radius: 18px;
  padding: 22px 16px 18px;
  margin-bottom: 16px;
  border: 2px solid #e2e8f0;
}
.tp-verdict.is-pass { background: #f0fdf4; border-color: #86efac; }
.tp-verdict.is-fail { background: #fef2f2; border-color: #fecaca; }
.tp-verdict-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.tp-verdict.is-pass .tp-verdict-badge { background: #16a34a; color: #fff; }
.tp-verdict.is-fail .tp-verdict-badge { background: #dc2626; color: #fff; }
.tp-verdict-score {
  font-weight: 900;
  line-height: 1;
  color: #0f172a;
}
.tp-verdict-score span { font-size: clamp(2.4rem, 6vw, 3.4rem); }
.tp-verdict-score small { font-size: 1.2rem; color: #64748b; margin-left: 4px; }
.tp-verdict-cap { margin-top: 6px; font-size: 0.85rem; font-weight: 700; color: #475569; }
.tp-verdict-msg { margin: 10px auto 0; max-width: 520px; font-size: 0.9rem; color: #334155; }
.tp-verdict-sub { margin-top: 8px; font-size: 0.8rem; color: #64748b; }

.tp-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 14px);
  margin-bottom: clamp(10px, 1.3vw, 16px);
}
.tp-metric {
  background: var(--tp-card);
  border: 1px solid var(--tp-line);
  border-radius: 16px;
  padding: clamp(8px, 1vw, 12px) 8px 10px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tp-metric.is-warn { animation: tpWarn 0.9s ease-in-out infinite; }
.tp-ring {
  --p: 0;
  --c: #16a34a;
  width: clamp(3.4rem, 7vw, 4.6rem);
  height: clamp(3.4rem, 7vw, 4.6rem);
  margin: 0 auto 6px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #eef2f7 0);
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.25s linear;
}
.tp-ring::after {
  content: '';
  position: absolute;
  inset: 7px;
  background: #fff;
  border-radius: 50%;
}
.tp-ring span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: clamp(0.78rem, 1.5vw, 1.05rem);
  color: var(--tp-ink);
  letter-spacing: -0.03em;
}
.tp-metric-lbl {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tp-muted);
}
.tp-metric-sub { font-size: 0.62rem; color: #94a3b8; margin-top: 1px; }

.tp-stage {
  position: relative;
  background: var(--tp-card);
  border: 1px solid var(--tp-line);
  border-radius: 18px;
  padding: clamp(12px, 1.8vw, 22px);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
  margin-bottom: 10px;
  cursor: text;
  overflow: hidden;
}
.typing-app.is-running .tp-stage,
.tp-app.is-running .tp-stage { border-color: rgba(227, 6, 19, 0.28); box-shadow: 0 10px 28px rgba(227, 6, 19, 0.08); }
.tp-target {
  font-family: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: clamp(1.08rem, 1.45vw + 0.42rem, 1.42rem);
  font-weight: 600;
  line-height: 1.9;
  color: #1e293b;
  position: relative;
  min-height: 7.4em;
  max-height: min(38vh, 300px);
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.32em 0.5em;
  align-content: flex-start;
  letter-spacing: 0;
  user-select: none;
}
.tp-word {
  display: inline-flex;
  white-space: pre;
  padding: 0 5px;
  border-radius: 7px;
  color: #1e293b;
}
.tp-word.is-ok { color: #047857; font-weight: 700; background: #d1fae5; }
.tp-word.is-bad { color: #b91c1c; font-weight: 700; background: #fecaca; text-decoration: underline wavy #ef4444; }
.tp-word.is-cur { color: #0b1220; background: #ffe4e6; font-weight: 700; }
.tp-target .ch { border-radius: 3px; transition: color 0.08s ease, background 0.08s ease; }
.tp-target .ch.ok { color: #047857; font-weight: 700; }
.tp-target .ch.bad { color: #fff; background: #dc2626; animation: tpBad 0.22s ease; }
.tp-target .ch.extra { opacity: 0.85; }
.tp-target .ch.cur {
  color: var(--tp-ink);
  position: relative;
}
.tp-target .ch.cur::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  min-width: 8px;
  height: 2px;
  background: var(--tp-red);
  animation: tpCaret 1s steps(1) infinite;
}
.tp-target .ch.sp.cur::after { min-width: 10px; }
.tp-ghost {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  resize: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  caret-color: transparent;
  background: transparent;
  color: transparent;
  outline: none;
  z-index: 0;
}
.tp-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 28px 12px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0.94) 42%);
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.tp-overlay.is-hidden { opacity: 0; visibility: hidden; }
.tp-overlay span {
  background: linear-gradient(135deg, #e30613, #be123c);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 28px rgba(227, 6, 19, 0.28);
  animation: tpFloat 2.4s ease-in-out infinite;
}

.tp-progress {
  height: 4px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
  margin: 0 2px 12px;
}
.tp-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e30613, #fb7185);
  border-radius: inherit;
  transition: width 0.2s linear;
}

.tp-caps {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
}
.tp-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.tp-kb-card {
  background: var(--tp-card);
  border: 1px solid var(--tp-line);
  border-radius: 18px;
  padding: clamp(10px, 1.4vw, 16px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  margin-bottom: 14px;
}
.tp-kb-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 10px;
}
.tp-shell .typing-kb { width: 100%; }
.tp-shell .typing-kb-row {
  display: flex;
  justify-content: center;
  gap: var(--g);
  margin-bottom: var(--g);
  flex-wrap: nowrap;
}
.tp-shell .typing-kb-key {
  flex: 0 0 var(--k);
  width: var(--k);
  height: calc(var(--k) * 0.92);
  min-width: 0;
  border: 1px solid var(--tp-line);
  border-radius: calc(var(--k) * 0.22);
  background: #f8fafc;
  color: #475569;
  font-size: calc(var(--k) * 0.34);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  cursor: default;
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tp-shell .typing-kb-key[data-key="space"] {
  flex: 0 0 calc(var(--k) * 6.4);
  width: auto;
  min-width: 0;
  font-size: calc(var(--k) * 0.26);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tp-shell .typing-kb-key.is-next {
  background: #fff1f2;
  border-color: var(--tp-red);
  color: var(--tp-red);
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 18px rgba(227, 6, 19, 0.18);
  animation: tpNext 1.15s ease-in-out infinite;
}
.tp-shell .typing-kb-key.is-hot {
  background: hsl(calc(12 + (1 - var(--heat, 0)) * 40), 92%, calc(96% - var(--heat, 0) * 28%));
  border-color: hsl(8, 80%, calc(70% - var(--heat, 0) * 20%));
  color: #9f1239;
}
.tp-shell .typing-kb-key.is-pressed-ok { animation: tpPopOk 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.tp-shell .typing-kb-key.is-pressed-err { animation: tpPopErr 0.28s ease; }
.tp-shell .typing-kb-key .ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 50%;
  top: 50%;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  pointer-events: none;
  animation: tpRipple 0.32s ease-out forwards;
}
.tp-shell .typing-kb-key .ripple.ok { background: rgba(22, 163, 74, 0.4); }
.tp-shell .typing-kb-key .ripple.err { background: rgba(239, 68, 68, 0.45); }

.tp-fingers {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.tp-fingers span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tp-fingers .lp { background: #f59e0b; } .tp-fingers .lr { background: #84cc16; }
.tp-fingers .lm { background: #22c55e; } .tp-fingers .li { background: #06b6d4; }
.tp-fingers .th { background: #94a3b8; }
.tp-fingers .ri { background: #3b82f6; } .tp-fingers .rm { background: #8b5cf6; }
.tp-fingers .rr { background: #ec4899; } .tp-fingers .rp { background: #f43f5e; }
.tp-shell .typing-kb-key[data-finger="lp"] { box-shadow: inset 0 -2px 0 #f59e0b; }
.tp-shell .typing-kb-key[data-finger="lr"] { box-shadow: inset 0 -2px 0 #84cc16; }
.tp-shell .typing-kb-key[data-finger="lm"] { box-shadow: inset 0 -2px 0 #22c55e; }
.tp-shell .typing-kb-key[data-finger="li"] { box-shadow: inset 0 -2px 0 #06b6d4; }
.tp-shell .typing-kb-key[data-finger="th"] { box-shadow: inset 0 -2px 0 #94a3b8; }
.tp-shell .typing-kb-key[data-finger="ri"] { box-shadow: inset 0 -2px 0 #3b82f6; }
.tp-shell .typing-kb-key[data-finger="rm"] { box-shadow: inset 0 -2px 0 #8b5cf6; }
.tp-shell .typing-kb-key[data-finger="rr"] { box-shadow: inset 0 -2px 0 #ec4899; }
.tp-shell .typing-kb-key[data-finger="rp"] { box-shadow: inset 0 -2px 0 #f43f5e; }

.tp-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tp-info article {
  background: #fff;
  border: 1px solid var(--tp-line);
  border-radius: 14px;
  padding: 14px 16px;
}
.tp-info h4 {
  font-size: 0.8rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--tp-ink);
}
.tp-info li {
  font-size: 0.75rem;
  color: var(--tp-muted);
  padding: 3px 0;
  list-style: none;
}
.tp-info ul { margin: 0; padding: 0; }

.typing-app[data-mode="speed_test"] .tp-only-lesson,
.tp-app[data-mode="speed_test"] .tp-only-lesson { display: none !important; }
.typing-app[data-mode="lesson"] .tp-only-speed,
.tp-app[data-mode="lesson"] .tp-only-speed { display: none !important; }

.tp-result-hero { text-align: center; margin-bottom: 16px; }
.tp-result-icon { font-size: 2.2rem; line-height: 1; }
.tp-result-level { font-weight: 900; font-size: 1.15rem; }
.tp-result-note { color: #64748b; font-size: 0.75rem; margin: 6px 0 0; }
.tp-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.tp-result-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-result-box { border-radius: 12px; padding: 12px; }
.tp-result-box h6 { font-size: 0.75rem; font-weight: 800; margin: 0 0 8px; }
.tp-result-box span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  margin: 2px;
  font-size: 0.75rem;
}
.tp-result-box.err { background: #fef2f2; border: 1px solid #fecaca; }
.tp-result-box.keys { background: #fffbeb; border: 1px solid #fde68a; }
.typing-metric {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.typing-metric .label { color: #475569; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.typing-metric .value { font-size: 1.35rem; font-weight: 900; color: #0f172a; }

.tp-modal .modal-content {
  border: 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(11, 18, 32, 0.28);
}
.tp-modal .modal-header {
  border: 0;
  padding: 22px 24px 8px;
  background: linear-gradient(180deg, #fff1f2, #fff);
}
.tp-modal .modal-title {
  font-weight: 900;
  font-size: 1.25rem;
  color: #0b1220;
  letter-spacing: -0.02em;
}
.tp-modal .modal-body { padding: 8px 24px 8px; }
.tp-modal .modal-footer {
  border: 0;
  padding: 16px 24px 22px;
  gap: 8px;
  background: #f8fafc;
}
.tp-modal .btn {
  border-radius: 12px;
  font-weight: 800;
  padding: 10px 16px;
}
.tp-modal .btn-danger {
  background: linear-gradient(135deg, #e30613, #be123c);
  border: 0;
  box-shadow: 0 8px 20px rgba(227, 6, 19, 0.25);
}
.tp-modal .btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
}

@keyframes tpCaret { 50% { opacity: 0; } }
@keyframes tpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes tpNext { 50% { transform: translateY(-3px) scale(1.08); } }
@keyframes tpPopOk { 40% { transform: scale(1.18); } }
@keyframes tpPopErr { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 100% { transform: none; } }
@keyframes tpRipple { to { transform: scale(6); opacity: 0; } }
@keyframes tpBad { from { transform: scale(1.12); } }
@keyframes tpWarn { 50% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); } }

@media (max-width: 900px) {
  .tp-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tp-actions { margin-left: 0; width: 100%; }
  .tp-info { grid-template-columns: 1fr; }
  .tp-result-grid, .tp-result-split { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .tp-metrics { grid-template-columns: 1fr 1fr; }
  .tp-wordbar { grid-template-columns: 1fr 1fr; }
  .tp-target { max-height: 28vh; }
  .tp-chip select { max-width: 58vw; }
}
@media (max-width: 520px) {
  .tp-result-grid, .tp-result-split { grid-template-columns: 1fr; }
  .tp-shell .typing-kb { overflow-x: auto; }
  .tp-shell .typing-kb-key[data-key="space"] { flex-basis: calc(var(--k) * 4.8); }
}
@media (max-height: 760px) {
  .tp-info { display: none; }
  .tp-target { max-height: 22vh; min-height: 3.6em; }
  .tp-kb-card { padding: 8px; }
  .tp-shell { --k: clamp(1.4rem, 2.1vw, 2.1rem); }
}
@media (prefers-reduced-motion: reduce) {
  .tp-target .ch.cur::after, .tp-overlay span, .typing-kb-key.is-next, .tp-metric.is-warn { animation: none; }
}
