/* หน้าตรวจสอบผลการเรียน (สาธารณะ) — การ์ดกระจกฝ้ากลางจอ บนพื้นไล่สีพาสเทล */
:root {
  --ck-navy: #12296b;
  --ck-blue: #1d64e8;
  --ck-blue-2: #0b4fd1;
  --ck-ink: #1f2a44;
  --ck-muted: #6b7690;
  --ck-line: #dde4ef;
}
/* พื้นหลังโทนเทาฟ้าหม่น ความสว่างต่ำกว่าขาว ไม่แสบตา (ไม่ใช้ขาวล้วน/สีอิ่มจัด) */
.page-check { font-family: 'Sarabun', system-ui, sans-serif; background: #dde9fb; }
.page-check .content-plain { max-width: none; padding: 0; }
.page-check .content-plain > .alert { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 20; min-width: 300px; }

.ck-stage { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; overflow: hidden; }
/* แสงสีพาสเทลด้านหลัง (ให้กระจกฝ้ามีอะไรให้เบลอ) */
.ck-blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .32; pointer-events: none; }
.ck-blob.b1 { width: 520px; height: 520px; left: calc(50% - 560px); top: -120px; background: #9db5d6; }
.ck-blob.b2 { width: 460px; height: 460px; left: calc(50% + 120px); top: 40%; background: #a9c9bd; }
.ck-blob.b3 { width: 380px; height: 380px; left: calc(50% - 420px); bottom: -140px; background: #d6c3a8; opacity: .25; }

/* การ์ดกระจกฝ้า */
.ck-glass { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 30px 30px 24px; border-radius: 26px;
  background: rgba(248,250,253,.72); border: 1px solid rgba(255,255,255,.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 24px 50px -24px rgba(18,41,107,.35), inset 0 1px 0 rgba(255,255,255,.9);
  animation: ckIn .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ckIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ck-badge { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #fff 0%, #eef4ff 70%); border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 10px 24px -10px rgba(29,100,232,.45), 0 0 0 6px rgba(255,255,255,.45); }
.ck-lock { width: 52px; height: 52px; filter: drop-shadow(0 4px 5px rgba(20,73,216,.3));
  transform-origin: 50% 20%; animation: ckWiggle 3.2s ease-in-out 1s infinite; }
/* กุญแจดุกดิก: ส่ายซ้ายขวาสั้น ๆ แล้วนิ่งพัก วนทุก 3.2 วิ */
@keyframes ckWiggle {
  0%, 60%, 100% { transform: rotate(0) translateY(0); }
  8%  { transform: rotate(-12deg) translateY(-2px); }
  16% { transform: rotate(10deg)  translateY(-2px); }
  24% { transform: rotate(-7deg); }
  32% { transform: rotate(5deg); }
  40% { transform: rotate(-2deg); }
  48% { transform: rotate(0); }
}
.ck-badge:hover .ck-lock { animation-duration: 1.2s; }@media (prefers-reduced-motion: reduce) { .ck-lock { animation: none; } }
.ck-badge i { font-size: 2.5rem; line-height: 1; background: linear-gradient(180deg, #4d8dff, #1450e0); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 3px rgba(11,63,179,.25)); }
.ck-title { font-family: inherit; font-weight: 700; font-size: 1.65rem; color: var(--ck-blue); text-align: center; margin: .85rem 0 0; line-height: 1.25; white-space: nowrap; }   /* Sarabun เดียวกับชื่อโรงเรียนด้านล่าง */
.ck-sub { text-align: center; color: var(--ck-navy); font-weight: 500; font-size: .95rem; margin: .25rem 0 1.25rem; }

/* ช่องกรอก: ไอคอนอยู่ในกล่องสีฟ้าอ่อนด้านซ้าย */
.ck-field { position: relative; margin-bottom: .8rem; }
.ck-tile { position: absolute; left: 6px; top: 6px; bottom: 6px; width: 38px; border-radius: 10px; display: grid; place-items: center;
  background: #e6efff; color: var(--ck-blue); font-size: 1.1rem; pointer-events: none; transition: background .15s, color .15s; }
.ck-input { width: 100%; height: 50px; padding: 0 .9rem 0 3.6rem; border: 1px solid var(--ck-line); border-radius: 14px; background: rgba(255,255,255,.92);
  font-size: .98rem; color: var(--ck-ink); box-shadow: 0 2px 6px -4px rgba(18,41,107,.2); transition: border-color .15s, box-shadow .15s; }
.ck-input::placeholder { color: #9aa4ba; }
.ck-input:focus { outline: none; border-color: var(--ck-blue); box-shadow: 0 0 0 3px rgba(29,100,232,.14); }
.ck-field:focus-within .ck-tile { background: var(--ck-blue); color: #fff; }

/* ปฏิทินเลือกวันเกิดแบบ พ.ศ. (ช่อง type="date" ของเบราว์เซอร์แสดงได้แค่ ค.ศ.) */
.ck-field .ck-input.has-cal { padding-right: 3rem; }
.ck-cal-btn { position: absolute; right: 6px; top: 6px; bottom: 6px; width: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--ck-ink); font-size: 1.05rem; }
.ck-cal-btn:hover { background: #eef3fb; }
.ck-cal { position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: 300px; padding: .7rem; background: #fff; border: 1px solid var(--ck-line);
  border-radius: 14px; box-shadow: 0 16px 34px -14px rgba(18,41,107,.45); font-size: .9rem; color: var(--ck-ink); }
.ck-cal[hidden] { display: none; }
.ck-cal-head { display: flex; align-items: center; gap: .3rem; margin-bottom: .5rem; }
.ck-cal-head select { border: 1px solid var(--ck-line); border-radius: 8px; padding: .2rem .3rem; font-weight: 600; color: var(--ck-ink); background: #fff; }
.ck-cal-head .ck-cal-nav { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 8px; color: var(--ck-ink); }
.ck-cal-head .ck-cal-nav:hover { background: #eef3fb; }
.ck-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.ck-cal-grid .dow { font-weight: 600; font-size: .8rem; padding: .2rem 0; }
.ck-cal-grid button { border: 0; background: transparent; border-radius: 8px; height: 32px; color: var(--ck-ink); }
.ck-cal-grid button:hover { background: #eef3fb; }
.ck-cal-grid button.out { color: #a5aec2; }
.ck-cal-grid button.today { color: var(--ck-blue); font-weight: 700; }
.ck-cal-grid button.sel { background: var(--ck-blue); color: #fff; font-weight: 700; }
.ck-cal-foot { display: flex; justify-content: space-between; margin-top: .4rem; }
.ck-cal-foot button { border: 0; background: transparent; color: var(--ck-blue); font-size: .85rem; padding: .2rem .4rem; }

.ck-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .15rem 0 1rem; font-size: .88rem; }
.ck-check { display: inline-flex; align-items: center; gap: .5rem; color: var(--ck-ink); cursor: pointer; user-select: none; margin: 0; }
.ck-check input { width: 18px; height: 18px; accent-color: var(--ck-blue); cursor: pointer; }
.ck-link { color: var(--ck-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.ck-link:hover { color: var(--ck-blue-2); }

.ck-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; height: 52px; border: 0; border-radius: 14px;
  color: #fff; font-family: 'Prompt', 'Sarabun', sans-serif; font-weight: 500; font-size: 1.1rem;
  background: linear-gradient(180deg, #3b86ff 0%, #1458e0 100%);
  box-shadow: 0 10px 22px -10px rgba(20,88,224,.85), inset 0 1px 0 rgba(255,255,255,.3); transition: filter .15s, box-shadow .15s, transform .15s; }
.ck-btn:hover { filter: brightness(1.05); box-shadow: 0 14px 26px -12px rgba(20,88,224,.9); }
.ck-btn:active { transform: translateY(1px); }
.ck-btn i { font-size: 1.1rem; }

.ck-alert { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .75rem; margin-bottom: .9rem; border-radius: 12px;
  background: rgba(255,241,242,.95); border: 1px solid #fbd0d0; color: #b42323; font-size: .86rem; line-height: 1.45; animation: ckShake .4s ease; }
.ck-alert i { margin-top: 2px; }
.ck-alert-muted { background: rgba(241,244,250,.95); border-color: var(--ck-line); color: var(--ck-muted); animation: none; }
@keyframes ckShake { 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

.ck-divider { display: flex; align-items: center; gap: .75rem; margin: 1.3rem 0 .8rem; color: var(--ck-muted); font-size: .82rem; }
.ck-divider::before, .ck-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #c9d3e3, transparent); }
.ck-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.ck-feat { display: flex; align-items: center; justify-content: center; gap: .4rem; height: 42px; border-radius: 12px; font-size: .84rem; font-weight: 500; color: var(--ck-ink);
  background: rgba(255,255,255,.85); border: 1px solid rgba(221,228,239,.9); box-shadow: 0 2px 6px -4px rgba(18,41,107,.2); }
.ck-feat i { font-size: 1rem; color: var(--ck-blue); }
.ck-feat:nth-child(2) i { color: #f59f00; } .ck-feat:nth-child(3) i { color: #12a150; }

/* ผลการเรียน */
.ck-result { position: relative; width: 100%; max-width: 640px; animation: ckIn .45s cubic-bezier(.2,.8,.2,1) both; }
/* หน้าผลการเรียน: เริ่มจากด้านบน (ตารางยาว) ไม่จัดกึ่งกลางแนวตั้ง */
.ck-stage.is-result { justify-content: flex-start; padding-top: 32px; }
.ck-result .card { border: 1px solid #e6ebf3; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 20px 40px -24px rgba(18,41,107,.28); overflow: hidden; }
.ck-student { display: flex; align-items: center; gap: .85rem; padding: .95rem 1.2rem; color: #fff;
  background: #28a745; }
.ck-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 1.15rem; flex: none;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); }
.ck-student .name { font-family: 'Prompt', 'Sarabun', sans-serif; font-weight: 500; font-size: 1.05rem; line-height: 1.25; }
.ck-student .meta { font-size: .82rem; opacity: .85; }
.ck-emblem { width: 48px; height: 56px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
span.ck-emblem { filter: none; }
/* แสงเกรเดียนขาวพาดผ่านหัวการ์ดเป็นระยะ (วิ่ง ~3 วิ ทุก 10 วิ เหมือนแบนเนอร์หน้าหลัก) */
.ck-student { position: relative; overflow: hidden; }
.ck-student::after { content: ''; position: absolute; top: -30%; bottom: -30%; left: 0; width: 22%; pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,0) 20%, rgba(255,255,255,.38) 50%, rgba(255,255,255,0) 80%, transparent 100%);
  transform: translateX(-150%) skewX(-18deg); animation: ckShine 10s ease-in-out 1.5s infinite; }
@keyframes ckShine {
  0%   { transform: translateX(-150%) skewX(-18deg); }
  30%  { transform: translateX(560%) skewX(-18deg); }
  100% { transform: translateX(560%) skewX(-18deg); }
}
@media (prefers-reduced-motion: reduce), print { .ck-student::after { display: none; } }
/* ตราดุกดิก: นิ่งสักพัก แล้วเด้งขึ้น + ส่ายซ้ายขวาแบบกระดิ่ง (รอบละ 3.2 วิ) */
img.ck-emblem { transform-origin: 50% 90%; animation: ckEmblem 3.2s ease-in-out 1s infinite; }
img.ck-emblem:hover { animation-duration: 1.2s; }
@keyframes ckEmblem {
  0%, 60%, 100% { transform: none; }
  66% { transform: translateY(-3px) rotate(-10deg) scale(1.06); }
  74% { transform: translateY(0) rotate(8deg); }
  82% { transform: rotate(-5deg); }
  90% { transform: rotate(2deg); }
}
@media (prefers-reduced-motion: reduce), print { img.ck-emblem { animation: none; } }
.ck-student .ck-head { flex: 1; min-width: 0; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.45); }   /* เงาดำช่วยให้ตัวขาวบนพื้นเขียวอ่านชัด */
.ck-sep { display: inline-block; width: 1px; height: 1em; margin: 0 .6rem; vertical-align: -.12em; background: currentColor; opacity: .35; }   /* เส้นตั้งคั่นข้อมูลในแถบภาคเรียน */
.ck-student .ck-head .name { font-family: inherit; font-weight: 600; font-size: 1.25rem; }   /* ใช้ฟอนต์เดียวกับเนื้อหาตาราง (ไม่ใช่ Prompt) */   /* ชื่อโรงเรียน/หัวระเบียน อยู่กึ่งกลางระหว่างวงกลมกับ GPAX */
.ck-gpa { margin-left: auto; text-align: center; }
.ck-gpa .v { font-family: 'Prompt', 'Sarabun', sans-serif; font-weight: 600; font-size: 1.5rem; line-height: 1; }
.ck-gpa .l { font-size: .72rem; opacity: .85; }
.ck-term { background: #f6f8fc; color: var(--ck-navy); font-weight: 600; font-size: .9rem; padding: .6rem 1.1rem; border-bottom: 1px solid #edf1f7; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem; }
.ck-term { align-items: center; }
.ck-term .ck-dl { vertical-align: baseline; line-height: 1.4; padding: .2rem .6rem; margin: .1rem 0; font-size: .82rem; white-space: nowrap; }   /* ดาวน์โหลด ปพ.6 (PDF) */
@media print { .ck-dl { display: none !important; } }
.ck-result .table { margin: 0; }
.ck-result .table th { background: #28a745; color: #fff; font-weight: 600; font-size: .88rem; border-color: #3cb35a; }
.ck-result .table td { vertical-align: middle; }
/* เส้นคอลัมน์: ไม่มีกรอบนอกซ้าย/ขวา (ชนขอบการ์ดพอดี) */
.ck-tbl { border-color: #e3e9f5; }
.ck-tbl > :not(caption) > * > :first-child { border-left: 0; }
.ck-tbl > :not(caption) > * > :last-child { border-right: 0; }
.ck-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .7rem 1rem; background: #fff; border-top: 1px solid #e3e9f5; }

@media (max-width: 575.98px) {
  .ck-stage { padding: 28px 14px; }
  .ck-stage.is-result { padding: 8px 6px 28px; }   /* มือถือ: การ์ดผลการเรียนเกือบเต็มความกว้างจอ */
  /* หัวการ์ดจอแคบ: "ระเบียนผลการเรียน ภาคเรียน… ปีการศึกษา…" อยู่บรรทัดเดียว (ตัวอักษรย่อตามความกว้างจอ) */
  .ck-student { padding: .8rem .75rem; gap: .5rem; }
  .ck-student .meta { white-space: nowrap; font-size: clamp(.58rem, 3vw, .82rem); }
  .ck-emblem { width: 40px; height: 48px; }   /* มือถือ: ลดช่องว่างเหนือการ์ดผลการเรียน */
  .ck-glass { padding: 24px 18px 20px; border-radius: 22px; }
  .ck-title { font-size: 1.4rem; }
  .ck-row { flex-wrap: wrap; }
  .ck-feat { font-size: .78rem; gap: .3rem; }
}
@media (max-width: 399.98px) { span.ck-emblem { display: none; } }   /* จอเล็กมาก: เอาตัวถ่วงขวาออก ให้หัวการ์ดมีที่พอสำหรับบรรทัดเดียว */
@media (prefers-reduced-motion: reduce) { .ck-glass, .ck-result, .ck-alert { animation: none; } }
@media print {
  .ck-glass, .ck-blob, .ck-actions { display: none !important; }
  .ck-stage { padding: 0; min-height: 0; } .page-check { background: #fff; }
  .ck-result { max-width: none; margin: 0; } .ck-result .card { box-shadow: none; border: 1px solid #ccc; }
  .ck-student { background: #28a745 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
