/* TDS 105 - Klavye Yazım Teknikleri — öğrenci uygulaması */
body { overflow: hidden; }
.app { display: flex; height: 100vh; height: 100dvh; }

/* ------------------------------------------------------------------ */
/* Kenar menü                                                          */
/* ------------------------------------------------------------------ */
.side {
  width: 312px;
  flex: none;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(500px 300px at -10% -5%, rgba(255, 255, 255, .12), transparent 60%),
    radial-gradient(400px 300px at 120% 105%, rgba(167, 139, 250, .22), transparent 60%),
    linear-gradient(180deg, var(--side-2), var(--side));
  color: var(--side-muted);
  position: relative;
  z-index: 50;
  transition: margin-left .35s cubic-bezier(.22, 1, .36, 1), transform .35s cubic-bezier(.22, 1, .36, 1);
  border-right: 1px solid rgba(255, 255, 255, .1);
}
.app.focus .side { margin-left: -312px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--grad);
  box-shadow: 0 10px 26px -8px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
  color: #fff;
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-txt b { color: #fff; font: 800 18px var(--display); letter-spacing: .02em; }
.brand-txt span { font-size: 12.5px; font-weight: 600; color: var(--side-muted); }
.side-close { display: none; margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: none; background: rgba(255, 255, 255, .12); color: var(--side-ink); font-size: 20px; }

.me {
  margin: 4px 14px 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  display: flex;
  align-items: center;
  gap: 12px;
}
.me .av { --s: 42px; }
.me-txt { flex: 1; min-width: 0; }
.me-name { color: #fff; font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-no { font-size: 12px; color: var(--side-muted); font-family: var(--mono); }
.ring { --p: 0; width: 46px; height: 46px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: rgba(255, 255, 255, .2); }
.ring .fg { stroke: url(#ringGrad); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: calc(113.1 - 113.1 * var(--p) / 100); transition: stroke-dashoffset 1s cubic-bezier(.22, 1, .36, 1); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 800 12px var(--display); }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 6px; }
.nav-gh {
  display: flex;
  justify-content: space-between;
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #c7cdef;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  margin: 2px 0;
  border: none;
  border-radius: 13px;
  background: transparent;
  color: inherit;
  text-align: left;
  position: relative;
  transition: background .2s ease, color .2s ease, transform .2s ease;
  animation: nav-in .45s cubic-bezier(.22, 1, .36, 1) both;
}
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #fcd34d; }
.ni-num {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .13);
  color: #eef0fb;
  font: 800 13.5px var(--display);
  transition: background .2s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.nav-item.active .ni-num { background: var(--card); color: var(--brand); box-shadow: 0 6px 16px -6px rgba(20, 24, 60, .5); }
.nav-item.done .ni-num { background: rgba(134, 239, 172, .24); color: #d1fadf; }
.nav-item.done.active .ni-num { background: linear-gradient(135deg, #22c55e, #059669); color: #fff; }
.nav-item.exam .ni-num { box-shadow: inset 0 0 0 1.5px rgba(252, 211, 77, .7); }
.ni-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ni-txt b { font-weight: 600; font-size: 13.5px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.active .ni-txt b { font-weight: 700; }
.ni-txt small { font-size: 11.5px; color: #c3cae9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.active .ni-txt small { color: #e6e9ff; }
.ni-st { flex: none; width: 22px; height: 22px; display: grid; place-items: center; }
.ni-st svg { width: 18px; height: 18px; }
.mini-ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 3.2; }
.mini-ring .bg { stroke: rgba(255, 255, 255, .2); }
.mini-ring .fg { stroke: #fcd34d; stroke-linecap: round; stroke-dasharray: 56.5; transition: stroke-dashoffset .8s ease; }
.nav-item.locked { opacity: .55; }
.nav-item.locked:hover { opacity: .8; }
.nav-item.locked .ni-num { background: rgba(255, 255, 255, .07); }
.nav-item.just-done .ni-num { animation: done-pop .7s cubic-bezier(.34, 1.56, .64, 1); }

.side-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; gap: 8px; }
.side-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .09);
  color: var(--side-ink);
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.side-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.side-btn.logout:hover { background: rgba(251, 113, 133, .28); border-color: rgba(254, 205, 211, .5); color: #fff; }
.side-btn svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------------ */
/* Ana alan                                                            */
/* ------------------------------------------------------------------ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.top {
  height: 76px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: rgba(244, 246, 251, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink-2);
  transition: background .2s ease, transform .15s ease, border-color .2s ease;
}
.icon-btn:hover { background: var(--card-2); border-color: #bcc5d8; }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 19px; height: 19px; }
.top-title { flex: 1; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; white-space: nowrap; overflow: hidden; }
.crumb #crumbNum { color: var(--brand); }
.crumb .step { margin-left: 6px; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: #3a46b0; font-weight: 700; }
.crumb .step:empty { display: none; }
.top-title h1 { font: 800 21px/1.25 var(--display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title h1.swap { animation: title-in .5s cubic-bezier(.22, 1, .36, 1); }

.metrics { display: flex; gap: 8px; }
.metric {
  min-width: 84px;
  padding: 7px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
  overflow: hidden;
}
.metric span { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.metric b { font: 800 19px/1.15 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.metric small { position: absolute; right: 10px; bottom: 9px; font-size: 10px; font-weight: 800; color: #94a3b8; }
.metric .m-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #dde3ee; }
.metric .m-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .8s cubic-bezier(.22, 1, .36, 1); }
.metric.good b { color: var(--ok); }
.metric.mid b { color: var(--warn); }
.metric.low b { color: var(--bad); }
.metric.streak.hot { background: linear-gradient(135deg, #fbefdf, #f8e2c6); border-color: #f2b37a; }
.metric.streak.hot b { color: #ea580c; }
.metric.streak.hot b::after { content: ' 🔥'; font-size: 14px; }
.metric.bump { animation: bump .45s cubic-bezier(.34, 1.56, .64, 1); }

.top-actions { display: flex; align-items: center; gap: 10px; }
.game-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px 0 11px;
  border: none;
  border-radius: 12px;
  background: var(--grad);
  color: #f4f6fb;
  font: 800 13.5px var(--font);
  cursor: pointer;
  box-shadow: 0 10px 22px -12px rgba(76, 91, 212, .85);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.game-btn svg { width: 20px; height: 20px; }
.game-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(76, 91, 212, .9); }
.game-btn.locked { background: var(--card-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.game-btn.locked:hover { transform: none; box-shadow: inset 0 0 0 1px #c4ccf5; }
.app.game-open .stage { visibility: hidden; }
.game-btn.fresh { animation: game-fresh 1.2s cubic-bezier(.34, 1.56, .64, 1) 3; }
@keyframes game-fresh { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.12) rotate(-3deg); box-shadow: 0 0 0 6px rgba(76, 91, 212, .25); } 60% { transform: scale(1) rotate(2deg); } }
.conn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--ok-soft); color: #166534; font-size: 12px; font-weight: 700; white-space: nowrap; }
.conn .dot { background: #22c55e; animation: live-ping 1.8s ease-out infinite; }
.conn.off { background: var(--warn-soft); color: #92400e; }
.conn.off .dot { background: #f59e0b; animation: none; }

.stage { flex: 1; position: relative; overflow: hidden; }
#frame { width: 100%; height: 100%; border: 0; display: block; opacity: 0; transform: translateY(10px); transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1); background: transparent; }
#frame.loaded { opacity: 1; transform: none; }

.loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity .3s ease, visibility .3s;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.ld-keys { display: flex; gap: 8px; }
.ld-keys span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fafd, #e6ebf3);
  box-shadow: inset 0 -4px 0 #c5cddc, 0 6px 16px -8px rgba(15, 23, 42, .25);
  font: 800 19px var(--mono);
  color: var(--ink-2);
  animation: key-press 1.5s ease-in-out infinite;
}
.ld-keys span:nth-child(2) { animation-delay: .12s; }
.ld-keys span:nth-child(3) { animation-delay: .24s; }
.ld-keys span:nth-child(4) { animation-delay: .36s; margin-left: 10px; }
.ld-keys span:nth-child(5) { animation-delay: .48s; }
.ld-keys span:nth-child(6) { animation-delay: .6s; }
.loader p { font-weight: 700; color: var(--muted); font-size: 14px; }

.scrim { display: none; }

/* Kilitli bölüm penceresi */
.lock-card { text-align: center; }
.lock-date { margin: 14px auto 4px; padding: 14px; border-radius: 16px; background: var(--brand-soft); color: #3730a3; font: 800 18px var(--display); }
.lock-count { font-size: 13px; color: var(--muted); font-weight: 600; }

@keyframes nav-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes title-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes key-press { 0%, 60%, 100% { transform: translateY(0); box-shadow: inset 0 -4px 0 #cbd5e1, 0 6px 16px -8px rgba(15, 23, 42, .25); } 30% { transform: translateY(3px); box-shadow: inset 0 -1px 0 #cbd5e1, 0 2px 6px -4px rgba(15, 23, 42, .2); background: linear-gradient(180deg, #eef2ff, #e0e7ff); color: var(--brand); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes done-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-8deg); } 100% { transform: scale(1); } }

/* ------------------------------------------------------------------ */
/* Duyarlı yerleşim                                                    */
/* ------------------------------------------------------------------ */
@media (max-width: 1280px) {
  .metric[data-k="streak"] { display: none; }
}
@media (max-width: 1100px) {
  .metric[data-k="acc"], .metric[data-k="wpm"] { display: none; }
}
@media (max-width: 1024px) {
  .side { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); box-shadow: 30px 0 60px -20px rgba(0, 0, 0, .5); }
  .app.menu-open .side { transform: none; }
  .app.focus .side { margin-left: 0; }
  .side-close { display: grid; place-items: center; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(40, 48, 90, .4); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .app.menu-open .scrim { opacity: 1; pointer-events: auto; }
  #focusBtn { display: none; }
}
@media (max-width: 640px) {
  .top { padding: 0 12px; gap: 10px; height: 64px; }
  .top-title h1 { font-size: 17px; }
  .metrics, .conn span, .game-btn span { display: none; }
  .game-btn { padding: 0 9px; }
}
