:root {
  --blue: #2563eb; --cyan: #06b6d4; --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --bg: #f8fafc; --card: #ffffff; --ok: #059669; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb;
  --bad: #dc2626; --bad-bg: #fef2f2; --soft: #eff6ff;
  --grad: linear-gradient(135deg, var(--blue), var(--cyan));
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
  background: var(--bg); line-height: 1.55; font-size: 16px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .3rem 0 .8rem; }
img { max-width: 100%; height: auto; }

.topbar { background: var(--grad); color: #fff; }
.topbar .in { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: .9rem; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: rgba(255,255,255,.9); padding: 6px 10px; border-radius: 8px; font-size: .92rem; font-weight: 600; }
.topbar nav a:hover, .topbar nav a.on { background: rgba(255,255,255,.18); color: #fff; text-decoration: none; }
.topbar .who { font-size: .85rem; display: flex; gap: 10px; align-items: center; }
.topbar .who a, .topbar .who button { color: #fff; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.narrow { max-width: 460px; margin: 40px auto; }
.mid { max-width: 760px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.two { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; }
@media (max-width: 820px) { .two { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.link { display: block; color: inherit; transition: transform .15s, box-shadow .15s; }
.card.link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(37,99,235,.08); }
.card h2 { margin-bottom: .6rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--muted); font-size: .85rem; }

.bar { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--blue); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.grey { background: #f1f5f9; color: var(--muted); }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; word-break: break-word; }
.flash.ok { background: var(--ok-bg); color: #065f46; }
.flash.error { background: var(--bad-bg); color: #991b1b; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 6px 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37,99,235,.35); border-color: var(--blue); }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--grad); color: #fff; text-align: center; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #fecaca; }
.btn.sm { padding: 6px 11px; font-size: .85rem; }
.btn.block { width: 100%; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
th a { color: inherit; }
.scroll { overflow-x: auto; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
ul.clean li:last-child { border-bottom: 0; }

.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.4rem; font-weight: 800; letter-spacing: .15em; background: var(--soft);
  color: var(--blue); padding: 6px 12px; border-radius: 10px; display: inline-block; }
.prose { font-size: 1.02rem; }
.prose img { border-radius: 10px; }
.prose pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 10px; overflow-x: auto; }
.video { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; margin: 12px 0; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.question { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.question .opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; margin: 4px 0; cursor: pointer; font-weight: 500; }
.question .opt:hover { background: var(--soft); }
.question.right { border-color: #a7f3d0; background: #f0fdf4; }
.question.wrong { border-color: #fecaca; background: #fff7f7; }
.log { border-left: 3px solid var(--cyan); padding: 4px 0 4px 14px; margin: 14px 0; }
.log .photo { max-width: 320px; border-radius: 10px; margin-top: 6px; }
.comment { background: var(--soft); border-radius: 10px; padding: 8px 12px; margin-top: 8px; font-size: .92rem; }
.empty { color: var(--muted); padding: 10px 0; }
details > summary { cursor: pointer; font-weight: 600; }
.split { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.hide { display: none !important; }

/* certificate */
.cert-page { background: #e2e8f0; min-height: 100vh; padding: 24px 12px; }
.cert { max-width: 980px; margin: 0 auto; aspect-ratio: 1.414 / 1; background: #fff; border-radius: 6px; position: relative; padding: 6% 8%;
  display: flex; flex-direction: column; justify-content: center; text-align: center; box-shadow: 0 20px 60px rgba(15,23,42,.15); }
.cert::before { content: ""; position: absolute; inset: 18px; border: 3px solid transparent; border-radius: 4px;
  background: var(--grad) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.cert .k { letter-spacing: .3em; text-transform: uppercase; color: var(--muted); font-size: .85rem; font-weight: 700; }
.cert .name { font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 800; margin: .3em 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cert .course { font-size: clamp(1.1rem, 2.6vw, 1.6rem); font-weight: 700; }
.cert .foot { display: flex; justify-content: space-between; margin-top: 7%; font-size: .85rem; color: var(--muted); gap: 12px; flex-wrap: wrap; }
.cert-tools { max-width: 980px; margin: 0 auto 14px; display: flex; gap: 8px; justify-content: flex-end; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  .cert-page { background: #fff; padding: 0; }
  .cert { box-shadow: none; max-width: none; width: 297mm; height: 210mm; aspect-ratio: auto; border-radius: 0; }
  .cert-tools, .topbar { display: none; }
}
