/* EHV Academy learner app — phone first, comfortable on a laptop. Big tap targets, readable lessons,
   a bottom tab bar on phones and a side rail on wide screens. */
:root {
  --bg: #0f0e0e; --panel: #181616; --panel-2: #221f1e; --line: #34302d;
  --text: #f4ead8; --muted: #b8ad9a; --gold: #e6a63c; --gold-2: #f4c869; --gold-ink: #1b1306;
  --ok: #8fd1a6; --bad: #ff8f84; --warn: #f1c16b; --teal: #7cc8bd;
  --f-display: "Oswald", "Arial Narrow", sans-serif; --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --fs: 17px;
  color-scheme: dark;
}
:root.light { --bg: #f7f2e9; --panel: #fffaf1; --panel-2: #f1e8d8; --line: #ddd0bb; --text: #221c15; --muted: #6d6152; --gold: #b8761a; --gold-2: #9a5f0d; --gold-ink: #fff8ea; --ok: #2d7a4c; --bad: #b3402f; color-scheme: light; }
:root.big { --fs: 19.5px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs)/1.6 var(--f-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; letter-spacing: .03em; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; text-transform: uppercase; }
h2 { font-size: 1.25rem; text-transform: uppercase; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .9em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* layout */
.app { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar img { width: 64px; }
.bar h1 { font-size: 1.02rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; flex: none; font-size: 1.05rem; }
.page { width: 100%; max-width: 980px; margin: 0 auto; padding: 18px 16px 110px; }
.page--lesson { max-width: 1240px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: grid; justify-items: center; gap: 2px; padding: 9px 2px 8px; color: var(--muted); text-decoration: none; font-size: .72rem; }
.nav a b { font-size: 1.25rem; line-height: 1; font-weight: 400; }
.nav a[aria-current="page"] { color: var(--gold-2); }
@media (min-width: 900px) {
  .app { grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 0; height: 100vh; grid-template-columns: 1fr; align-content: start; gap: 4px; padding: 22px 12px; border-top: 0; border-right: 1px solid var(--line); }
  .nav::before { content: ""; display: block; height: 96px; margin: 0 8px 14px; background: url(../assets/logo.png) center/contain no-repeat; }
  .nav a { grid-template-columns: 28px 1fr; justify-items: start; align-items: center; padding: 11px 12px; border-radius: 10px; font-size: .95rem; }
  .nav a[aria-current="page"] { background: var(--panel-2); }
  .bar img { display: none; }
  .page { padding-bottom: 60px; }
}

/* buttons, chips, cards */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--gold); }
.btn--gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink); border-color: transparent; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--end { justify-content: flex-end; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.card--gold { border-color: color-mix(in srgb, var(--gold) 60%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 12%, var(--panel)), var(--panel)); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.tag--gold { color: var(--gold-2); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.tag--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.tag--bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 22px 10px; }
.label { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }

/* progress */
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: inherit; transition: width .4s; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--panel-2) 0); display: grid; place-items: center; flex: none; }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-size: .85rem; font-weight: 700; }

/* home */
.hello { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.hello h1 { font-size: 1.5rem; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.kpi strong { display: block; font: 400 1.6rem/1.1 var(--f-display); color: var(--gold-2); }
.kpi span { font-size: .78rem; color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 10px; }
.days i { aspect-ratio: 1; border-radius: 4px; background: var(--panel-2); }
.days i.on { background: var(--gold); }
.mycourse { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; text-decoration: none; color: inherit; }
.mycourse h3 { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.badge b { font-size: 1.4rem; }
.board { list-style: none; padding: 0; margin: 0; }
.board li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.board li.me { color: var(--gold-2); font-weight: 700; }

/* catalogue */
.ccard { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.ccard h3 { margin: 0; font-size: 1.1rem; }
.ccard p { color: var(--muted); margin: 0; font-size: .95rem; }
.price strong { font: 400 1.35rem var(--f-display); color: var(--gold-2); }
.price s { color: var(--muted); font-size: .85rem; margin-left: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .9rem; }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

/* course */
.lessons { list-style: none; padding: 0; margin: 0; }
.lessons a { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.lessons a.locked { opacity: .55; }
.lessons .k { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-size: .85rem; }
.lessons .done .k { background: var(--ok); color: #0e2a19; border-color: var(--ok); }
.stars { display: flex; gap: 4px; }
.stars button { background: none; border: 0; font-size: 1.7rem; cursor: pointer; color: var(--line); padding: 0 2px; }
.stars button.on { color: var(--gold-2); }

/* lesson player */
.player { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1100px) { .player { grid-template-columns: minmax(0, 1fr) 360px; } .side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; } }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { font-size: calc(var(--fs) * 1.02); line-height: 1.75; }
.prose h2 { font-size: 1.15rem; margin-top: 1.4em; color: var(--gold-2); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }
.task { white-space: pre-line; }
.q { margin-bottom: 18px; }
.q p { font-weight: 600; margin-bottom: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: var(--panel-2); }
.opt input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--gold); }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--panel-2)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--panel-2)); }
.score { display: flex; gap: 14px; align-items: center; }
.navrow { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
textarea, input, select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; min-height: 20px; margin-top: 3px; }

/* tutor and discussion */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; margin-bottom: 10px; }
.msg { padding: 10px 12px; border-radius: 14px; max-width: 92%; white-space: pre-wrap; font-size: .95rem; }
.msg--me { align-self: flex-end; background: color-mix(in srgb, var(--gold) 20%, var(--panel-2)); }
.msg--ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.post { padding: 10px 0; border-bottom: 1px solid var(--line); }
.post .who { font-size: .82rem; color: var(--muted); }
.post--lect .who b { color: var(--gold-2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .9rem; }
.tabs button[aria-selected="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

/* live */
.liveitem { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.liveitem .d { text-align: center; border-right: 1px solid var(--line); padding-right: 10px; }
.liveitem .d strong { display: block; font: 400 1.7rem/1 var(--f-display); color: var(--gold-2); }
.liveitem .d span { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ff5b5b; margin-right: 6px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(440px, 100%); }
.login img { width: 200px; display: block; margin: 0 auto 12px; }
.switch { display: flex; background: var(--panel-2); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.switch button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.switch button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.err { color: var(--bad); font-size: .92rem; }
.ok { color: var(--ok); font-size: .92rem; }

/* sheet and toast */
dialog#sheet { width: min(560px, 94vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--panel); color: var(--text); }
dialog#sheet::backdrop { background: rgba(0,0,0,.65); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: 92vw; text-align: center; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* certificate (screen and print) */
.cert { position: relative; aspect-ratio: 1.414; width: 100%; max-width: 900px; margin: 0 auto; background: #fbf6ec; color: #2a2118; border-radius: 6px; padding: 5% 7%; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between; box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden; font-family: var(--f-body); }
.cert::before { content: ""; position: absolute; inset: 2.2%; border: 2px solid #c8963b; border-radius: 4px; pointer-events: none; }
.cert::after { content: ""; position: absolute; inset: 3.4%; border: 1px solid rgba(200,150,59,.5); pointer-events: none; }
.cert img { width: 22%; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.cert .t { font: 400 clamp(14px, 2.3vw, 22px) var(--f-display); letter-spacing: .3em; text-transform: uppercase; color: #9a6a1b; }
.cert .n { font: 500 clamp(22px, 4.6vw, 46px)/1.1 var(--f-display); letter-spacing: .04em; }
.cert .c { font: 600 clamp(14px, 2.6vw, 26px)/1.25 var(--f-body); }
.cert .s { font-size: clamp(9px, 1.35vw, 13px); color: #5e5141; max-width: 80%; }
.cert .meta { display: flex; justify-content: space-between; width: 100%; font-size: clamp(9px, 1.3vw, 13px); color: #5e5141; }
@media print {
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: fixed; inset: 0; margin: 0; width: 100%; max-width: none; box-shadow: none; border-radius: 0; }
  @page { size: A4 landscape; margin: 0; }
}
