/* Testandmore Training — modern module styling */
:root {
  --brand: #ed411e;
  --brand-dark: #c73315;
  --ink: #2b2b3a;
  --ink-soft: #6b6b7d;
  --bg: #f6f6f9;
  --card: #ffffff;
  --line: #e6e6ee;
  --good: #2e9e5b;
  --bad: #d64545;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.tr-wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.tr-top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.tr-topbar { display: flex; align-items: center; gap: 18px; height: 58px; flex-wrap: wrap; }
.tr-brand { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.tr-brand b { font-size: 21px; font-weight: 800; letter-spacing: 0.5px; }
.tr-brand b::first-letter { color: var(--brand); }
.tr-brand em { font-style: normal; font-weight: 400; color: var(--ink-soft); font-size: 15px; }
.tr-brand:hover { text-decoration: none; }
.tr-nav { display: flex; gap: 14px; flex: 1; }
.tr-nav a { color: var(--ink); font-weight: 500; font-size: 14.5px; }
.tr-nav a.tr-muted { color: var(--ink-soft); font-weight: 400; }
/* language pulldown (native <details>) */
.tr-langdd { position: relative; }
.tr-langdd summary {
  list-style: none; display: flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: 12.5px; font-weight: 700; color: var(--ink); user-select: none; background: var(--card);
}
.tr-langdd summary::-webkit-details-marker { display: none; }
.tr-langdd summary i { font-style: normal; color: var(--ink-soft); font-size: 10px; }
.tr-langdd[open] summary { border-color: var(--brand); }
.tr-langdd-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(30,30,50,.12); padding: 6px; min-width: 170px;
}
.tr-langdd-list a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; color: var(--ink); font-size: 14px;
}
.tr-langdd-list a:hover { background: var(--bg); text-decoration: none; }

/* paywall */
.tr-paywall { border: 1.5px solid var(--brand); background: #fff7f5; text-align: center; }
.tr-paywall h2 { font-size: 20px; }
.tr-paywall p { color: var(--ink-soft); max-width: 520px; margin: 8px auto 18px; }

/* sticky second header row: test progress + timer, always visible while playing */
.tr-headbar { border-top: 1px solid var(--line); background: var(--card); }
.tr-headbar .tr-wrap { padding-top: 9px; padding-bottom: 9px; }
.tr-headbar .tr-progressbar { margin-bottom: 8px; }
.tr-headbar .tr-timer { font-size: 17px; }

main.tr-wrap { padding-top: 26px; padding-bottom: 60px; }

h1 { font-size: 26px; letter-spacing: -0.5px; margin: 0 0 4px; }
.tr-sub { color: var(--ink-soft); margin: 0 0 24px; }

/* cards */
.tr-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.tr-card h2 { margin: 0 0 14px; font-size: 17px; }

/* buttons */
.tr-btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.tr-btn:hover { background: var(--brand-dark); text-decoration: none; }
.tr-btn:active { transform: scale(.98); }
.tr-btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.tr-btn.ghost:hover { background: #fdece8; }

/* new-test form */
.tr-choices { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tr-choice { position: relative; }
.tr-choice input { position: absolute; opacity: 0; }
.tr-choice label {
  display: inline-block;
  padding: 9px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  background: var(--card);
  user-select: none;
}
.tr-choice input:checked + label { border-color: var(--brand); background: #fdece8; color: var(--brand-dark); font-weight: 600; }

/* test list */
.tr-testlist { width: 100%; border-collapse: collapse; font-size: 14px; }
.tr-testlist td { padding: 9px 6px; border-top: 1px solid var(--line); }
.tr-badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--ink-soft);
}
.tr-badge.timed { background: #fff1d6; color: #9a6b00; }

/* player */
.tr-progressbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
.tr-progressbar div { height: 100%; background: var(--brand); width: 0%; transition: width .3s; }
.tr-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 20px; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.tr-timerbar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.tr-timerbar div { height: 100%; background: var(--good); width: 100%; }
.tr-timer.warn .tr-timerbar div { background: var(--bad); }
.tr-timer.warn { color: var(--bad); }

.tr-q { display: none; }
.tr-q.active { display: block; }
.tr-q-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--ink-soft); font-size: 13.5px; margin-bottom: 6px; }
.tr-prompt { font-size: 17px; font-weight: 600; margin: 4px 0 18px; }

.tr-seq {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
  margin-bottom: 22px;
}
.tr-seq span { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.tr-seq .q { color: var(--brand); }

.tr-panels { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.tr-panels .panel { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.tr-panels .qmark { font-size: 40px; font-weight: 800; color: var(--brand); padding: 0 18px; }

.tr-premises { background: var(--bg); border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 16px; margin-bottom: 22px; font-size: 16px; }
.tr-premises p { margin: 4px 0; }

.tr-analogy { font-size: 20px; font-weight: 600; margin-bottom: 22px; }
.tr-analogy b { color: var(--brand); }

.tr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tr-option {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 14px; font-size: 17px; font-weight: 600; cursor: pointer; text-align: center;
  transition: border-color .12s, background .12s;
}
.tr-option:hover { border-color: var(--brand); }
.tr-option.selected { border-color: var(--brand); background: #fdece8; }
.tr-option svg { display: block; margin: 0 auto; }

.tr-player-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }

/* results */
.tr-scorehero { text-align: center; padding: 10px 0 4px; }
.tr-scorehero .big { font-size: 56px; font-weight: 800; letter-spacing: -2px; }
.tr-scorehero .big small { font-size: 26px; color: var(--ink-soft); font-weight: 600; }
.tr-statrow { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 16px 0 4px; }
.tr-stat { background: var(--bg); border-radius: 10px; padding: 10px 18px; text-align: center; min-width: 110px; }
.tr-stat .n { font-size: 21px; font-weight: 700; }
.tr-stat .l { font-size: 12px; color: var(--ink-soft); }
.tr-stat.good .n { color: var(--good); }
.tr-stat.bad .n { color: var(--bad); }

.tr-review-item { border-top: 1px solid var(--line); padding: 14px 0; }
.tr-review-item .verdict { font-weight: 700; }
.tr-review-item .verdict.good { color: var(--good); }
.tr-review-item .verdict.bad { color: var(--bad); }
.tr-review-item .meta { color: var(--ink-soft); font-size: 13.5px; }
.tr-review-flex { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* charts */
.tr-chart { width: 100%; height: auto; }
.tr-chart text { font-family: inherit; }

.tr-hint { background: #fff8e8; border: 1px solid #f2e2b3; color: #7a5c00; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 18px; }

.tr-foot { border-top: 1px solid var(--line); padding: 18px 0; color: var(--ink-soft); font-size: 13px; margin-top: 40px; }

@media (max-width: 640px) {
  .tr-topbar { height: auto; padding: 10px 16px; }
  .tr-nav { order: 3; width: 100%; }
  h1 { font-size: 22px; }
  .tr-seq { font-size: 19px; }
  .tr-options { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}
