/* บ้านพี่ส่าย — โทนโลโก้กวดวิชาพี่ส่าย (แดง · ทอง · ดำ) แบบพรีเมียม */
@font-face { font-family: 'BoonJot'; src: url('/fonts/BoonJot-Italic.woff2') format('woff2'); font-display: swap; }

:root {
  --red: #E3151B; --crimson: #C4000F; --wine: #7A0710; --gold: #F7BA00; --gold-l: #FFE08A; --gold-d: #B07A00;
  --ink: #1C1210; --ink-2: #2B1A16; --paper: #FFFBF3; --cream: #F6EEDD; --line: #E7DAC0; --muted: #8B7A6B;
  --green: #06C755; --ok: #1E9E62;
  --foil: linear-gradient(100deg, #B07A00 0%, #F7BA00 22%, #FFE9A8 45%, #F7BA00 62%, #C98F00 100%);
  --r: 18px; --shadow: 0 10px 30px -12px rgba(60, 20, 10, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'BoonJot', 'Sarabun', system-ui, sans-serif; font-size: 18px; line-height: 1.55; color: var(--ink);
  background: var(--paper) radial-gradient(1200px 500px at 100% -10%, #FCE9C4 0%, transparent 60%) no-repeat; min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.bare { padding: 0; }
a { color: var(--crimson); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 18px; }
h1, h2 { line-height: 1.25; margin: .2em 0 .4em; }
.muted { color: var(--muted); }

/* ส่วนหัว */
.top { position: sticky; top: 0; z-index: 10; background: var(--ink); border-bottom: 2px solid transparent;
  border-image: var(--foil) 1; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 64px; height: auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font-size: 22px; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand i { font-style: normal; font-size: 11px; letter-spacing: .22em; color: #D9C9A8; }
.me { display: flex; align-items: center; gap: 8px; color: #F4E7CF; text-decoration: none; font-size: 16px; }
.me img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }

main.wrap { padding-top: 22px; }
.hello { font-size: 22px; margin: 4px 0 14px; }
.sec { font-size: 20px; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.sec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* บัตรสมาชิก */
.card { position: relative; overflow: hidden; border-radius: 22px; padding: 20px 22px; color: #FFF5E0; max-width: 520px;
  background: radial-gradient(120% 140% at 0% 0%, #3A120E 0%, var(--ink) 55%), var(--ink);
  box-shadow: 0 22px 40px -18px rgba(122, 7, 16, .7), inset 0 0 0 1px rgba(247, 186, 0, .35); }
.card::before { content: ''; position: absolute; inset: auto -30% -60% auto; width: 80%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(227,21,27,.55), transparent 65%); }
.card::after { content: ''; position: absolute; inset: 10px; border-radius: 16px; border: 1px solid rgba(247,186,0,.25); pointer-events: none; }
.card-shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,233,168,.16) 48%, transparent 60%);
  animation: shine 6s ease-in-out infinite; }
@keyframes shine { 0%, 60% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
@media (prefers-reduced-motion: reduce) { .card-shine { animation: none; } }
.card-top, .card-mid, .card-bot { position: relative; z-index: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-brand { font-size: 15px; color: #E9D7B5; }
.card-tier { font-size: 11px; letter-spacing: .2em; padding: 4px 10px; border-radius: 999px; color: var(--ink); background: var(--foil); }
.card-mid { display: flex; align-items: center; gap: 14px; margin: 18px 0 16px; }
.card-pic { width: 64px; height: 64px; border-radius: 50%; padding: 3px; background: var(--foil); flex: none; }
.card-pic img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: var(--ink-2); }
.card-name { font-size: 30px; line-height: 1.1; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card-full { font-size: 15px; color: #D9C9A8; }
.card-bot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.card-bot > div { display: flex; flex-direction: column; }
.card-bot .r { text-align: right; }
.card-lbl { font-size: 11px; letter-spacing: .15em; color: #B9A685; }
.card-code { font-size: 26px; letter-spacing: .06em; color: #FFF; }
.card-course, .card-since { font-size: 14px; color: #E9D7B5; }

/* ปุ่มลัด */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--r); text-decoration: none; color: var(--ink);
  background: #FFF; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(122,7,16,.45); }
.tile::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 4px; background: linear-gradient(var(--red), var(--gold)); }
.tile-ic { font-size: 30px; }
.tile-t { font-size: 20px; }
.tile-d { font-size: 15px; color: var(--muted); }
.badge { position: absolute; top: 14px; right: 14px; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--cream); color: var(--gold-d); border: 1px solid #EBD9A9; }

/* กล่องเนื้อหา + ฟอร์ม */
.panel { background: #FFF; border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); margin: 0 auto 18px; max-width: 620px; }
.panel.center { text-align: center; }
.panel-head p { margin: 0 0 8px; color: var(--muted); }
.step { display: inline-block; font-size: 13px; letter-spacing: .08em; color: var(--gold-d); background: var(--cream); padding: 2px 10px; border-radius: 999px; }
.big { font-size: 52px; }
.form { display: grid; gap: 14px; margin-top: 10px; }
.form label { display: flex; flex-wrap: wrap; gap: 6px 4px; font-size: 17px; }
.form label > input, .form label > select { flex-basis: 100%; }
.form label b { color: var(--crimson); }
input, select { font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(247,186,0,.22); }
.btn-gold, .btn-ghost, .btn-line { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 14px; padding: 13px 22px;
  font-size: 19px; text-decoration: none; cursor: pointer; border: 0; }
.btn-gold { background: var(--foil); color: var(--ink); box-shadow: 0 8px 20px -10px rgba(176,122,0,.9), inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.link { font: inherit; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; margin-top: 14px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.alert { background: #FFF0EE; border: 1px solid #F3C2BC; color: var(--wine); padding: 10px 14px; border-radius: 12px; }
.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; text-align: left; margin: 16px auto; max-width: 420px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.prose h2 { font-size: 20px; margin-top: 1.2em; }

/* แอดมิน */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stats div { background: var(--cream); border-radius: 14px; padding: 12px; text-align: center; }
.stats b { display: block; font-size: 28px; color: var(--crimson); }
.stats span { font-size: 13px; color: var(--muted); }
.list { display: grid; gap: 8px; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.li img, .li .ph { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--cream); flex: none; }
.tag { font-size: 13px; padding: 1px 8px; border-radius: 999px; background: var(--cream); }
.st-pending { background: #FFF3CC; color: var(--gold-d); } .st-active { background: #E2F6EA; color: var(--ok); }
.st-suspended, .st-rejected { background: #FDE5E3; color: var(--wine); }

/* ปุ่มเล็ก · รหัส */
.panel.wide { max-width: 860px; }
.li-main { flex: 1; min-width: 0; }
.btn-sm { font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 10px; border: 0; cursor: pointer; background: var(--foil); color: var(--ink); white-space: nowrap; }
.btn-sm.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.st-admin { background: var(--ink); color: var(--gold); }
.alert.ok { background: #EEF9F2; border-color: #BFE6CF; color: #146B43; }
.small { font-size: 14px; }
.code-form { max-width: 360px; margin: 14px auto 0; }
.code-in { text-align: center; font-size: 24px; letter-spacing: .12em; text-transform: uppercase; }

/* แถบล่าง */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(28,18,16,.96); backdrop-filter: blur(8px); border-top: 1px solid rgba(247,186,0,.35); }
.tabs a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; font-size: 13px; color: #CDBB9A; text-decoration: none; padding: 4px 0; border-radius: 12px; }
.tabs a .ic { font-size: 22px; filter: grayscale(.6); }
.tabs a.on { color: var(--gold); background: rgba(247,186,0,.1); }
.tabs a.on .ic { filter: none; }
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 30px 0 10px; }
.foot a { color: var(--muted); }

/* หน้าเข้าสู่ระบบ */
.gate { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 18px;
  background: radial-gradient(900px 600px at 50% 0%, #5A0A10 0%, transparent 70%), radial-gradient(700px 500px at 100% 100%, #3D0A0B 0%, transparent 70%), var(--ink); color: #F6E9D0; }
.gate-card { position: relative; width: 100%; max-width: 420px; text-align: center; padding: 30px 24px 26px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(247,186,0,.35), 0 30px 60px -20px rgba(0,0,0,.7); }
.gate-logo { width: 78%; height: auto; filter: drop-shadow(0 12px 22px rgba(0,0,0,.45)); }
.pill { display: inline-block; margin-top: 16px; font-size: 12px; letter-spacing: .25em; padding: 5px 14px; border-radius: 999px; color: var(--ink); background: var(--foil); }
.foil { font-size: 46px; margin: 10px 0 4px; background: var(--foil); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin: 0 0 20px; color: #D9C9A8; font-size: 17px; }
.btn-line { width: 100%; background: var(--green); color: #FFF; font-size: 21px; box-shadow: 0 12px 24px -10px rgba(6,199,85,.7); }
.btn-line:active, .btn-gold:active { transform: translateY(1px); }
.hint { font-size: 14px; color: #B9A685; margin: 14px 0 0; }
.gate .alert { background: rgba(227,21,27,.15); border-color: rgba(227,21,27,.5); color: #FFD9D4; }
.gate-foot { font-size: 13px; margin-top: 18px; }
.gate-foot a { color: #B9A685; }

@media (max-width: 560px) {
  body { font-size: 17px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px 12px 14px 16px; }
  .tile-t { font-size: 18px; }
  .tile-d { font-size: 13px; }
  .badge { position: static; align-self: flex-start; margin-top: 6px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand b { font-size: 19px; }
  .card-name { font-size: 26px; }
}
