/* ============================================================
   KYAMCH Club — Thorax Olympiad
   Design tokens
   Palette: clinical-paper background, surgical teal, amber gold
   (podium/prizes), coral pulse (signature EKG line), deep ink navy.
   Type: Fraunces (display) + Inter (body) + IBM Plex Mono (data/timer)
   Signature: an animated EKG line that runs through the hero and
   reappears as the countdown/timer heartbeat.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root{
  --paper: #F5FAF9;
  --paper-2: #EAF3F1;
  --ink: #16232B;
  --ink-soft: #3E535C;
  --teal: #0F6E67;
  --teal-deep: #0A4D48;
  --amber: #F2A93B;
  --amber-deep: #C97F12;
  --coral: #E85C4A;
  --silver: #9AA7B0;
  --bronze: #B8763E;
  --line: #D3E4E1;
  --radius: 14px;
  --shadow: 0 10px 30px -12px rgba(15,110,103,0.25);
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:'Inter',system-ui,sans-serif;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.display{
  font-family:'Fraunces',serif;
  font-weight:600;
  letter-spacing:-0.01em;
  color:var(--ink);
  margin:0 0 .4em;
}
.mono{font-family:'IBM Plex Mono',monospace;}
a{color:var(--teal-deep);}
p{margin:0 0 1em;}
.container{max-width:1080px;margin:0 auto;padding:0 24px;}
.wrap-narrow{max-width:720px;margin:0 auto;padding:0 24px;}

/* ---------- Nav ---------- */
.topbar{
  position:sticky;top:0;z-index:50;
  background:rgba(245,250,249,0.88);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.topbar-inner{
  max-width:1080px;margin:0 auto;padding:14px 24px;
  display:flex;align-items:center;justify-content:space-between;gap:16px;
}
.brand{display:flex;align-items:center;gap:10px;font-family:'Fraunces',serif;font-weight:700;font-size:1.05rem;text-decoration:none;color:var(--ink);}
.brand-mark{width:28px;height:28px;flex:none;}
.nav-links{display:flex;gap:22px;align-items:center;font-size:.92rem;font-weight:500;}
.nav-links a{color:var(--ink-soft);text-decoration:none;}
.nav-links a:hover{color:var(--teal-deep);}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 22px;border-radius:999px;font-weight:600;font-size:.95rem;
  text-decoration:none;border:1px solid transparent;cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active{transform:scale(.97);}
.btn-primary{background:var(--teal);color:#fff;box-shadow:var(--shadow);}
.btn-primary:hover{background:var(--teal-deep);}
.btn-amber{background:var(--amber);color:#3A2600;}
.btn-amber:hover{background:var(--amber-deep);color:#fff;}
.btn-outline{background:transparent;border-color:var(--teal);color:var(--teal-deep);}
.btn-outline:hover{background:var(--paper-2);}
.btn-danger{background:var(--coral);color:#fff;}
.btn-block{width:100%;}
.btn[disabled]{opacity:.5;cursor:not-allowed;}

/* ---------- Hero / EKG signature ---------- */
.hero{position:relative;overflow:hidden;padding:64px 0 40px;}
.ekg-line{width:100%;height:64px;display:block;margin:18px 0 8px;}
.ekg-path{
  fill:none;stroke:var(--coral);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:1400;stroke-dashoffset:1400;
  animation:ekg-draw 3.2s ease-out forwards, ekg-pulse 2.4s ease-in-out 3.2s infinite;
}
@keyframes ekg-draw{to{stroke-dashoffset:0;}}
@keyframes ekg-pulse{
  0%,100%{opacity:1;} 50%{opacity:.55;}
}
.eyebrow{
  display:inline-flex;align-items:center;gap:8px;
  background:var(--paper-2);border:1px solid var(--line);color:var(--teal-deep);
  font-size:.78rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;
  padding:6px 14px;border-radius:999px;margin-bottom:18px;
}
.hero h1{font-size:clamp(2rem,5vw,3.1rem);max-width:820px;}
.hero .lede{font-size:1.1rem;color:var(--ink-soft);max-width:620px;}
.hero-cta{display:flex;gap:14px;flex-wrap:wrap;margin-top:26px;}

/* ---------- Countdown ---------- */
.countdown{
  display:flex;gap:14px;flex-wrap:wrap;margin-top:34px;
}
.count-box{
  background:#fff;border:1px solid var(--line);border-radius:var(--radius);
  padding:14px 20px;min-width:88px;text-align:center;box-shadow:var(--shadow);
}
.count-box .num{font-family:'IBM Plex Mono',monospace;font-size:1.7rem;font-weight:600;color:var(--teal-deep);}
.count-box .lbl{font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft);}

/* ---------- Cards / sections ---------- */
section{padding:46px 0;}
.section-title{display:flex;align-items:baseline;gap:12px;margin-bottom:22px;}
.section-title .idx{font-family:'IBM Plex Mono',monospace;color:var(--amber-deep);font-size:.85rem;}
.rib-divider{
  height:14px;width:100%;
  background-image:repeating-linear-gradient(90deg, transparent 0 26px, var(--line) 26px 27px);
  border-radius:0 0 40px 40px / 0 0 14px 14px;
  margin:36px 0;opacity:.7;
}
.grid{display:grid;gap:18px;}
.grid-3{grid-template-columns:repeat(3,1fr);}
.grid-2{grid-template-columns:repeat(2,1fr);}
@media (max-width:820px){.grid-3{grid-template-columns:1fr;}.grid-2{grid-template-columns:1fr;}}

.card{
  background:#fff;border:1px solid var(--line);border-radius:var(--radius);
  padding:24px;box-shadow:0 1px 2px rgba(15,35,43,.04);
}
.card h3{font-size:1.05rem;}
.card .icon{width:34px;height:34px;color:var(--teal);margin-bottom:12px;}

/* ---------- Podium / prizes ---------- */
.podium{display:flex;align-items:flex-end;gap:16px;margin-top:10px;}
.podium .place{
  flex:1;border-radius:var(--radius) var(--radius) 0 0;text-align:center;
  padding:22px 14px;color:#fff;position:relative;
}
.podium .place .rank{font-family:'IBM Plex Mono',monospace;font-size:1.6rem;font-weight:600;}
.podium .place .gift{font-size:.85rem;opacity:.95;}
.place-1{background:linear-gradient(160deg,var(--amber),var(--amber-deep));height:190px;order:2;}
.place-2{background:linear-gradient(160deg,#C7D0D4,var(--silver));height:150px;order:1;color:#22303a;}
.place-3{background:linear-gradient(160deg,#D79A63,var(--bronze));height:130px;order:3;}

/* ---------- Forms ---------- */
.form-card{
  background:#fff;border:1px solid var(--line);border-radius:var(--radius);
  padding:32px;box-shadow:var(--shadow);max-width:520px;margin:0 auto;
}
label{display:block;font-weight:600;font-size:.85rem;margin:16px 0 6px;color:var(--ink-soft);}
label:first-of-type{margin-top:0;}
input[type=text],input[type=email],input[type=password],input[type=tel],select,textarea{
  width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:10px;
  font-family:inherit;font-size:.96rem;background:var(--paper);color:var(--ink);
}
input:focus,select:focus,textarea:focus{
  outline:2px solid var(--teal);outline-offset:1px;background:#fff;
}
.help{font-size:.8rem;color:var(--ink-soft);margin-top:4px;}
.alert{
  padding:12px 16px;border-radius:10px;font-size:.9rem;margin-bottom:18px;
}
.alert-error{background:#FDECEA;color:#9B2C1F;border:1px solid #F3B9B0;}
.alert-success{background:#E7F5EE;color:#0F6E42;border:1px solid #B4E1C6;}
.alert-info{background:var(--paper-2);color:var(--teal-deep);border:1px solid var(--line);}

/* ---------- Tables ---------- */
table{width:100%;border-collapse:collapse;font-size:.92rem;}
th,td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--line);}
th{font-size:.75rem;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-soft);}
tr.me{background:#FDF4E3;}
.badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:.72rem;font-weight:600;}
.badge-gold{background:var(--amber);color:#3A2600;}
.badge-silver{background:var(--silver);color:#1c2a31;}
.badge-bronze{background:var(--bronze);color:#fff;}
.badge-ok{background:#E7F5EE;color:#0F6E42;}
.badge-pending{background:#FDF1DE;color:#9A5B00;}
.badge-no{background:#FDECEA;color:#9B2C1F;}

/* ---------- Exam room ---------- */
.exam-shell{min-height:100vh;background:var(--paper-2);user-select:none;-webkit-user-select:none;}
.exam-top{
  position:sticky;top:0;z-index:20;background:var(--ink);color:#fff;
  padding:12px 0;
}
.exam-top-inner{max-width:900px;margin:0 auto;padding:0 20px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;}
.timer{
  font-family:'IBM Plex Mono',monospace;font-size:1.3rem;font-weight:600;
  background:rgba(255,255,255,.08);padding:6px 16px;border-radius:10px;
  display:flex;align-items:center;gap:8px;
}
.timer.low{color:var(--coral);animation:ekg-pulse 1s infinite;}
.progress-track{height:6px;background:var(--line);border-radius:99px;overflow:hidden;max-width:900px;margin:0 auto;}
.progress-fill{height:100%;background:var(--teal);transition:width .3s ease;}
.exam-body{max-width:900px;margin:0 auto;padding:28px 20px 100px;}
.q-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:26px;margin-bottom:0;}
.q-meta{display:flex;justify-content:space-between;color:var(--ink-soft);font-size:.82rem;margin-bottom:10px;}
.q-text{font-size:1.12rem;font-weight:600;margin-bottom:20px;}
.option{
  display:flex;align-items:flex-start;gap:12px;border:1px solid var(--line);
  border-radius:10px;padding:13px 16px;margin-bottom:10px;cursor:pointer;
  transition:border-color .15s, background .15s;
}
.option:hover{border-color:var(--teal);}
.option.selected{border-color:var(--teal);background:#EAF6F4;}
.option input{margin-top:3px;}
.exam-nav{display:flex;justify-content:space-between;margin-top:20px;gap:10px;flex-wrap:wrap;}
.qgrid{display:grid;grid-template-columns:repeat(10,1fr);gap:6px;margin-top:18px;}
.qgrid button{
  aspect-ratio:1;border-radius:8px;border:1px solid var(--line);background:#fff;
  font-family:'IBM Plex Mono',monospace;font-size:.78rem;cursor:pointer;
}
.qgrid button.answered{background:var(--teal);color:#fff;border-color:var(--teal);}
.qgrid button.current{outline:2px solid var(--amber-deep);}
.warn-overlay{
  position:fixed;inset:0;background:rgba(22,35,43,.92);color:#fff;z-index:200;
  display:flex;align-items:center;justify-content:center;text-align:center;padding:30px;
}
.warn-overlay .box{max-width:420px;}
.no-select{user-select:none;-webkit-user-select:none;}

footer{padding:36px 0;color:var(--ink-soft);font-size:.85rem;border-top:1px solid var(--line);margin-top:40px;}

.certificate{
  background:#fff;border:2px solid var(--amber);border-radius:18px;
  padding:44px;text-align:center;max-width:720px;margin:0 auto;
}
.certificate .rank-word{font-family:'Fraunces',serif;font-size:2.4rem;color:var(--amber-deep);}
@media print{
  .topbar,footer,.no-print{display:none;}
  body{background:#fff;}
}

@media (prefers-reduced-motion: reduce){
  .ekg-path{animation:none;stroke-dashoffset:0;}
}
