/* Khmer Cultural Kbach Login Portal (student.html & classroom.html) */
.kh-portal-wrap {
  max-width: 490px;
  margin: 10px auto 28px;
  padding: 12px;
  border-radius: 26px;
  background: linear-gradient(145deg, #f3dc97, #e6be5c 48%, #d49c24);
  box-shadow: 0 18px 44px rgba(130, 88, 12, .18);
}

.kh-portal {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 36px 28px 34px;
  background: linear-gradient(180deg, #fffef9 0%, #fcf6e4 55%, #f9eed0 100%);
  border: 2px solid rgba(196, 141, 24, .55);
  box-shadow: inset 0 0 0 5px #fffef8, inset 0 0 0 6.5px rgba(196, 141, 24, .34);
  color: #1f1a10;
  text-align: center;
}

[data-theme="dark"] .kh-portal-wrap {
  background: linear-gradient(145deg, #7c5812, #a8791d 48%, #5e410d);
}
[data-theme="dark"] .kh-portal {
  background: linear-gradient(180deg, #1b1533 0%, #151029 100%);
  color: #f6efe0;
  box-shadow: inset 0 0 0 5px #1a1430, inset 0 0 0 6.5px rgba(246, 200, 76, .35);
}

/* Angkor Wat silhouette watermark at the bottom */
.kh-portal::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 112px;
  background: #b8861c;
  opacity: .065;
  -webkit-mask: var(--k-angkor) center bottom/contain no-repeat;
  mask: var(--k-angkor) center bottom/contain no-repeat;
  pointer-events: none;
}

/* Top & bottom woven Kbach fringe band inside the frame */
.kh-p-band {
  position: relative;
  height: 16px;
  margin: -14px auto 14px;
  max-width: 82%;
  background: linear-gradient(90deg, transparent, #c78d18 18%, #e4b542 50%, #c78d18 82%, transparent);
  opacity: .72;
  -webkit-mask: var(--k-band) center/40px 16px repeat-x;
  mask: var(--k-band) center/40px 16px repeat-x;
  pointer-events: none;
}
.kh-p-band.bot {
  margin: 18px auto -12px;
  transform: scaleY(-1);
}

/* Four golden Kbach floral corners */
.kh-p-cr {
  position: absolute;
  width: 66px;
  height: 66px;
  background: linear-gradient(135deg, #c98c14, #e5b743);
  opacity: .78;
  -webkit-mask: var(--k-corner) center/contain no-repeat;
  mask: var(--k-corner) center/contain no-repeat;
  pointer-events: none;
}
.kh-p-cr.tl { top: 10px; left: 10px; transform: scaleY(-1); }
.kh-p-cr.tr { top: 10px; right: 10px; transform: scale(-1, -1); }
.kh-p-cr.bl { bottom: 10px; left: 10px; }
.kh-p-cr.br { bottom: 10px; right: 10px; transform: scaleX(-1); }

/* Center Lotus Crest Divider */
.kh-p-lotus-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px auto 12px;
  color: #b88114;
}
.kh-p-lotus-row i {
  height: 1.5px;
  width: 54px;
  background: linear-gradient(90deg, transparent, #c98f18);
  display: block;
}
.kh-p-lotus-row i:last-child {
  background: linear-gradient(90deg, #c98f18, transparent);
}
.kh-p-lotus {
  width: 28px;
  height: 24px;
  background: linear-gradient(180deg, #e0ac34, #a8710c);
  -webkit-mask: var(--k-lotus) center/contain no-repeat;
  mask: var(--k-lotus) center/contain no-repeat;
  display: inline-block;
}

/* Shield Crest Emblem */
.kh-p-emblem {
  width: 72px;
  height: 76px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  position: relative;
  filter: drop-shadow(0 6px 14px rgba(176, 121, 14, .22));
}
.kh-p-emblem svg { width: 100%; height: 100%; }

/* 3-Role Switcher Bar */
.kh-p-roles {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr) minmax(0, .85fr);
  gap: 4px;
  padding: 4px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: rgba(212, 175, 86, .16);
  border: 1.5px solid rgba(196, 141, 24, .35);
}
.kh-p-role {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 9px 4px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: .15s;
}
.kh-p-role:hover { background: rgba(212, 175, 86, .2); }
.kh-p-role.on {
  background: linear-gradient(180deg, #f3e1ab, #e6ca7d);
  color: #362603;
  box-shadow: 0 2px 8px rgba(140, 96, 10, .18), inset 0 0 0 1px rgba(180, 125, 16, .35);
}

/* Headings & Gold Diamond Ornament Divider */
.kh-portal h2 {
  margin: 0 0 3px;
  font-family: 'Khmer OS Muol Light', 'FM Muol', 'Kantumruy Pro', serif;
  font-size: 20px;
  font-weight: 400;
  color: #211909;
  line-height: 1.55;
}
[data-theme="dark"] .kh-portal h2 { color: #fef3c7; }
.kh-p-sub {
  margin: 0;
  font-size: 13.5px;
  color: #84621e;
  font-weight: 600;
}
[data-theme="dark"] .kh-p-sub { color: #fcd34d; }

.kh-p-div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px auto 16px;
  color: #c28816;
}
.kh-p-div i {
  flex: 1;
  max-width: 96px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #c78d18);
  display: block;
}
.kh-p-div i:last-child { background: linear-gradient(90deg, #c78d18, transparent); }
.kh-p-div span { font-size: 13px; letter-spacing: 2px; }

/* Fields & Buttons inside Khmer Portal */
.kh-portal form { text-align: left; position: relative; z-index: 1; }
.kh-p-lbl {
  display: block;
  margin: 0 0 12px;
}
.kh-p-lbl span {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #6b4e16;
  margin-bottom: 4px;
}
[data-theme="dark"] .kh-p-lbl span { color: #fde68a; }
.kh-p-inp {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(190, 144, 42, .42);
  background: rgba(238, 232, 214, .75);
  color: #1f1a10;
  font: inherit;
  font-size: 15.5px;
  transition: .15s;
}
.kh-p-inp:focus {
  outline: 0;
  background: #fff;
  border-color: #c88d15;
  box-shadow: 0 0 0 3px rgba(217, 162, 27, .22);
}
[data-theme="dark"] .kh-p-inp {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-color: rgba(250, 204, 21, .35);
}

.kh-p-submit {
  width: 100%;
  margin-top: 6px;
  padding: 12px 18px;
  border-radius: 13px;
  border: 1.5px solid #b88214;
  background: linear-gradient(180deg, #f3e2af, #e2c16a);
  color: #1e1604;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(154, 108, 12, .22);
  transition: .15s;
}
.kh-p-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(154, 108, 12, .28);
}

.kh-p-msg {
  margin: 10px 0 0;
  font-size: 13.5px;
  color: #7c5d1d;
  text-align: center;
  min-height: 18px;
}
[data-theme="dark"] .kh-p-msg { color: #fde68a; }

.kh-p-choices {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
}
.kh-p-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(190, 144, 42, .45);
  background: #fff;
  color: #1f1a10;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.kh-p-choice:hover { background: #fff9e6; border-color: #c88d15; }
.kh-p-note-free {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #6b5628;
  text-align: center;
  line-height: 1.6;
}
[data-theme="dark"] .kh-p-note-free { color: #e5d8b2; }
@media (max-width: 480px) {
  .kh-portal { padding: 30px 16px 26px; }
  .kh-p-cr { width: 50px; height: 50px; }
  .kh-p-role { font-size: 12px; padding: 8px 3px; }
}
