/* ==== Obecná ekonomie II — drill app ==== */
:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1f2630;
  --bg-4: #2a323e;
  --border: #2d3543;
  --fg: #e6edf3;
  --fg-2: #9aa6b2;
  --fg-3: #6b7684;
  --accent: #4ea1ff;
  --accent-2: #6ee7b7;
  --green: #2ea043;
  --green-soft: #1f6f2c;
  --red: #f85149;
  --red-soft: #6e2e30;
  --yellow: #d29922;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #1d2738 0%, transparent 60%),
              radial-gradient(1000px 800px at 100% 10%, #1a2a25 0%, transparent 50%),
              var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==== Top bar ==== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(14,17,22,.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1320;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 10px;
  letter-spacing: .5px;
  font-size: 14px;
}
.brand-meta h1 { margin: 0; font-size: 17px; font-weight: 700; }
.brand-meta p { margin: 2px 0 0; font-size: 12px; color: var(--fg-2); }

.stats { display: flex; gap: 8px; }
.stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}
.stat .num { font-weight: 800; font-size: 16px; }
.stat .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg-2); }

.reset {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s ease;
}
.reset:hover { color: var(--fg); border-color: var(--fg-3); }

/* ==== Mode tabs ==== */
.modes {
  display: flex;
  gap: 6px;
  padding: 14px 28px 6px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: rgba(14,17,22,.5);
}
.mode-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-2);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.mode-btn:hover { color: var(--fg); background: var(--bg-2); }
.mode-btn.active {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--border);
}

/* ==== Main content ==== */
main {
  flex: 1;
  padding: 32px 24px;
  display: flex;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 760px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
}

.topic-tag {
  display: inline-block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent);
  background: rgba(78,161,255,.1);
  border: 1px solid rgba(78,161,255,.25);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
  cursor: help;
}

.topic-title {
  font-size: 14px;
  color: var(--fg-2);
  margin: 0 0 8px;
  font-weight: 500;
  line-height: 1.5;
}

.statement {
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
  margin: 12px 0 24px;
  color: var(--fg);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.btn {
  font-size: 18px;
  font-weight: 700;
  padding: 18px 24px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg-3);
  color: var(--fg);
  cursor: pointer;
  transition: all .15s ease;
  letter-spacing: .5px;
}
.btn.ano:hover { background: var(--green-soft); border-color: var(--green); }
.btn.ne:hover { background: var(--red-soft); border-color: var(--red); }

.btn.correct { background: var(--green); border-color: var(--green); color: #fff; }
.btn.wrong { background: var(--red); border-color: var(--red); color: #fff; }
.btn.fade { opacity: .35; }

.feedback {
  display: none;
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-3);
}
.feedback.show { display: block; animation: slideIn .25s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.feedback .verdict {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 8px;
}
.feedback.ok .verdict { color: var(--accent-2); }
.feedback.bad .verdict { color: var(--red); }

.feedback .why {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
}
.feedback .concept {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-2);
}
.feedback .concept strong { color: var(--fg); }

.next-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}

.btn-next {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1320;
  font-weight: 700;
  padding: 12px 22px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}
.btn-next:hover { filter: brightness(1.1); }

.kbd-hint {
  font-size: 12px;
  color: var(--fg-3);
}
.kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  margin: 0 2px;
}

/* ==== Topics grid ==== */
.topics-grid {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.topic-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all .15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.topic-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(78,161,255,.1);
}
.topic-card .tname {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
}
.topic-card .tmeta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.topic-card .progress-bar {
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
}
.topic-card .progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}

/* ==== Browse view ==== */
.browse-wrap {
  width: 100%;
  max-width: 900px;
}
.browse-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: sticky;
  top: 84px;
  z-index: 5;
  backdrop-filter: blur(10px);
}
.browse-info {
  font-size: 13px;
  color: var(--fg-2);
}
.browse-info strong {
  color: var(--fg);
  font-weight: 700;
}
.browse-toggle {
  display: flex;
  gap: 6px;
}
.btn-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-pill:hover { color: var(--fg); border-color: var(--fg-3); }
.btn-pill.active {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--accent);
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.browse-topic {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
}
.browse-topic h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--fg);
}
.browse-topic .concept {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.55;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(78,161,255,.05);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.browse-topic ul { list-style: none; padding: 0; margin: 0; }
.browse-topic li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 30px 60px 1fr;
  gap: 12px;
  align-items: start;
  transition: opacity .15s ease;
}
.browse-topic li:first-child { border-top: none; }
.browse-topic li.studied { opacity: 0.55; }
.browse-topic li.studied .stmt-text { text-decoration: line-through; text-decoration-color: var(--fg-3); }

/* Browse: topic head with checkbox + progress */
.browse-topic-head {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}
.browse-topic-head h3 { margin: 0; }
.browse-topic.topic-done { border-color: rgba(46,160,67,.5); background: rgba(46,160,67,.04); }
.browse-topic.topic-done h3 { color: #7be08a; }

.topic-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
}
.tp-num { font-weight: 600; min-width: 36px; text-align: right; }
.tp-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.tp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}

/* Browse: checkboxes (custom-styled) */
.topic-check, .stmt-check {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.topic-check input, .stmt-check input { display: none; }
.chk-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--fg-3);
  border-radius: 6px;
  background: var(--bg-2);
  display: inline-block;
  position: relative;
  transition: all .15s ease;
  flex-shrink: 0;
}
.topic-check:hover .chk-box, .stmt-check:hover .chk-box { border-color: var(--accent); }
input:checked + .chk-box {
  background: var(--accent);
  border-color: var(--accent);
}
input:checked + .chk-box::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

/* Browse controls (filter + reset) */
.browse-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.browse-filter {
  display: flex;
  gap: 6px;
}
.browse-progress {
  margin-left: 10px;
  font-size: 13px;
  color: var(--fg-2);
}
.browse-progress b { color: var(--accent-2); font-weight: 700; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-2);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { color: var(--fg); border-color: var(--fg-3); }

/* Browse: overall progress bar under toolbar */
.browse-overall {
  margin: 0 0 18px;
  padding: 0 4px;
}
.bo-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}
.bo-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}
.browse-topic .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  padding: 4px 0;
  border-radius: 6px;
  text-align: center;
}
.browse-topic .badge.ANO { background: rgba(46,160,67,.15); color: #46d967; border: 1px solid rgba(46,160,67,.4); }
.browse-topic .badge.NE { background: rgba(248,81,73,.15); color: #ff7b73; border: 1px solid rgba(248,81,73,.4); }
.browse-topic .stmt-text {
  font-size: 14px;
  line-height: 1.5;
}
.browse-topic .stmt-text .why {
  margin-top: 6px;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.55;
  padding-left: 12px;
  border-left: 2px solid var(--accent);
}
.browse-topic .stmt-text {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--fg);
}

/* ==== Test view ==== */
.test-summary {
  text-align: center;
  padding: 40px 20px;
}
.test-summary .score {
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.test-summary .grade {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-2);
  margin-top: 8px;
}
.test-summary .review-list {
  text-align: left;
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.test-summary .review-item {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-3);
  border-left: 3px solid var(--green);
  font-size: 13px;
  line-height: 1.5;
}
.test-summary .review-item.bad { border-left-color: var(--red); }
.test-summary .review-item .ans { font-size: 11px; color: var(--fg-2); margin-top: 4px; }

.test-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 16px;
}
.test-progress .bar {
  flex: 1;
  margin: 0 14px;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.test-progress .bar .fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s;
}

/* ==== Footer ==== */
.foot {
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-3);
  border-top: 1px solid var(--border);
}

/* ==== Empty / info states ==== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-2);
}
.empty h3 { color: var(--fg); margin: 0 0 8px; }

/* ==== Group (exam-format) mode ==== */
.group-card {
  max-width: 880px;
}
.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.group-counter {
  font-size: 12px;
  color: var(--fg-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
}
.group-title {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.4;
  display: inline-block;
  padding: 6px 12px;
  background: #fff39a;
  color: #1a1a1a;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255,243,154,.3);
  font-weight: 700;
}
.group-hint {
  font-size: 13px;
  color: var(--fg-2);
  margin: 14px 0 18px;
}

.group-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}
.group-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
  transition: all .2s ease;
}
.group-row.correct { border-color: var(--green); background: rgba(46,160,67,.08); }
.group-row.wrong { border-color: var(--red); background: rgba(248,81,73,.08); }

.group-row-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
}
.group-row-num {
  display: inline-block;
  width: 26px;
  font-weight: 700;
  color: var(--fg-3);
}

.group-row-buttons {
  display: flex;
  gap: 6px;
}
.g-btn {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  color: var(--fg-2);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  transition: all .12s ease;
  min-width: 56px;
}
.g-btn:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--fg-3);
  transform: translateY(-1px);
}
.g-btn.ano:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.g-btn.ne:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.g-btn.picked.ano { background: var(--green-soft); border-color: var(--green); color: #fff; }
.g-btn.picked.ne { background: var(--red-soft); border-color: var(--red); color: #fff; }
.g-btn.correct {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.g-btn.wrong {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.g-btn:disabled { cursor: default; }

.group-row-feedback {
  display: none;
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  line-height: 1.5;
}
.verdict-mini {
  display: inline-block;
  font-weight: 700;
  margin-right: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.verdict-mini.ok { color: var(--accent-2); }
.verdict-mini.bad { color: var(--red); }
.why-mini {
  color: var(--fg-2);
}

.group-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-2);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-secondary:hover { color: var(--fg); border-color: var(--fg-3); }

.group-score {
  flex: 1;
  font-size: 16px;
  padding: 14px 18px;
  background: var(--bg-3);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  color: var(--fg);
}
.group-score.all-ok { border-left-color: var(--green); background: rgba(46,160,67,.08); }
.group-score.all-bad { border-left-color: var(--red); background: rgba(248,81,73,.08); }
.group-score strong {
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.group-score.all-ok strong { background: var(--green); -webkit-background-clip: text; background-clip: text; color: transparent; }
.group-score.all-bad strong { background: var(--red); -webkit-background-clip: text; background-clip: text; color: transparent; }
.group-concept {
  margin-top: 8px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.5;
}

/* ==== Mobile ==== */
@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .modes { padding: 10px 16px 4px; }
  main { padding: 20px 14px; }
  .card { padding: 22px 18px; }
  .statement { font-size: 18px; }
  .btn { font-size: 16px; padding: 14px; }
  .stats .stat { min-width: 52px; padding: 4px 8px; }
  .stat .num { font-size: 14px; }
  .brand-meta h1 { font-size: 15px; }
  .group-row { grid-template-columns: 1fr; gap: 10px; }
  .group-row-buttons { justify-content: flex-start; }
  .group-title { font-size: 17px; }
  .g-btn { padding: 10px 18px; flex: 1; }
}
