/* Trang học viên và trang gia sư: khung ứng dụng hẹp cho điện thoại.
   Màu, nút (.btn), form (.field, .choice, .slot-grid) lấy từ styles.css và form.css; file này chỉ có phần riêng của 2 trang. */
body::before, body::after { content: ""; position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; }
body::before { top: -96px; right: -120px; width: 300px; height: 300px; background: rgba(232, 163, 61, .35); }
body::after { bottom: 110px; left: -130px; width: 240px; height: 240px; background: rgba(15, 92, 88, .14); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hand { font-family: var(--hand); font-size: 17px; line-height: 1; }

.app { max-width: 480px; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; padding: 0 16px 24px; }
.p-top { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.link-btn { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.link-btn.more { min-height: 0; padding: 2px 0; color: var(--teal); font-weight: 700; text-decoration: underline; }

/* Đăng nhập bằng mã */
.p-center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-bottom: 10vh; }
.p-center h1 { font-size: 30px; line-height: 1.15; }
.p-login { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.p-login label { font-size: 14px; font-weight: 700; }
.code-input { width: 100%; min-height: 56px; padding: 0 16px; border: 2px solid var(--pencil); border-radius: var(--r-box); background: var(--paper); color: var(--ink); font: 700 20px/1 "Be Vietnam Pro", system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.code-input:focus { outline: none; box-shadow: 4px 4px 0 var(--amber); }
.p-error { min-height: 1.5em; color: var(--red); font-size: 14px; }

/* Tab: dính ở đầu màn hình khi cuộn */
.tabs { position: sticky; top: 0; z-index: 6; display: flex; gap: 6px; margin: 0 -16px 18px; padding: 8px 16px; background: var(--bg); border-bottom: 1.5px dashed rgba(29, 42, 45, .25); }
.tabs button { flex: 1; min-height: 44px; padding: 0 6px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 2px 3px 0 var(--pencil); }

.page { display: flex; flex-direction: column; gap: 14px; }
.page h1 { font-size: 26px; line-height: 1.2; }
.sec-title { margin-top: 8px; font-size: 22px; }
.panel { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: var(--r-box); background: var(--paper); box-shadow: 3px 4px 0 var(--pencil); }
.panel h2 { font-size: 20px; }
.btn.small-btn { align-self: flex-start; min-height: 44px; padding: 0 18px; font-size: 14px; }
.btn-row { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.btn-row .btn.small-btn { align-self: stretch; }
.help { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding-top: 16px; border-top: 1.5px dashed rgba(29, 42, 45, .25); font-size: 14px; color: var(--muted); }
.help .btn-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; }
.help .btn-row .btn.small-btn { align-self: auto; }
.msg { font-size: 14px; font-weight: 700; color: var(--teal); }
.msg.err { color: var(--red); }
.p-form { display: flex; flex-direction: column; gap: 22px; padding: 22px 18px; border-radius: var(--r-card); background: var(--paper); box-shadow: 4px 5px 0 var(--pencil); }

.hello { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.hello p { font-size: 13px; color: var(--muted); }
.hello h1 { font-size: 28px; }

/* Các bước tiến trình */
.track { display: flex; flex-direction: column; }
.track li { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.track li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: 2px; border-left: 2px dashed rgba(29, 42, 45, .35); }
.track .dot { flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-round); background: var(--paper); }
.track .dot .ic { width: 16px; height: 16px; stroke-width: 3; }
.track .done .dot { background: var(--teal); color: #fff; }
.track .now .dot { background: var(--amber); box-shadow: 2px 2px 0 var(--pencil); }
.track .todo { opacity: .62; }
.track li > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding-top: 4px; }
.track b { font-size: 16px; line-height: 1.35; }
.track p { font-size: 14px; line-height: 1.5; color: var(--muted); }

/* Thẻ lớp học */
.panel.next { gap: 10px; background: var(--amber-soft); }
.panel.next .when { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; }
.panel.next .meta { font-size: 14px; color: var(--muted); }
.panel.next .btn.small-btn { align-self: stretch; }

.klass { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--r-card); background: var(--paper); box-shadow: 4px 5px 0 var(--pencil); }
.klass-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.klass-head h3 { font-size: 20px; }
.klass-status { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--teal); }
.klass dl { margin: 0; font-size: 14px; }
.klass dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1.5px dashed rgba(29, 42, 45, .2); }
.klass dt { color: var(--muted); }
.klass dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.klass .btn.small-btn { align-self: stretch; }

/* Nhãn nhỏ */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1.5px solid var(--pencil); border-radius: var(--r-pill); background: var(--paper); font-size: 12px; font-weight: 700; }
.chip:nth-child(even) { border-radius: var(--r-pill2); }
.chip .ic { width: 14px; height: 14px; }
.chip.fill { padding: 3px 12px; background: var(--tint, var(--teal)); color: #fff; font-size: 13px; }

/* ---------- Thẻ gia sư (cùng thẻ phụ huynh thấy khi quẹt) ---------- */
.tcard { position: absolute; inset: 0 6px 14px 0; border-radius: var(--r-card); background: var(--paper); box-shadow: 6px 7px 0 var(--pencil); touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .3s ease; will-change: transform; }
.tcard::after { border-width: 2.5px; z-index: 2; }
.tcard::before { content: ""; position: absolute; inset: 2px -2px -1px 1px; z-index: 2; border: 1.2px solid rgba(29, 42, 45, .4); border-radius: inherit; transform: rotate(-.5deg); pointer-events: none; }
.tcard.next { transform: rotate(3deg) scale(.97) translateY(8px); pointer-events: none; }
.tcard.static { position: relative; inset: auto; margin: 0 6px 14px 0; touch-action: auto; user-select: text; -webkit-user-select: text; }
.tcard.static .tcard-clip { position: relative; }
.tcard .stamp { display: none; }
.stack .tcard .stamp { display: block; }
.tcard-clip { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; border-radius: inherit; scrollbar-width: thin; }
.tcard-hero { position: relative; flex-shrink: 0; height: 96px; padding: 14px 16px; background-color: var(--tint); background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .1) 0 10px, transparent 10px 20px); }
.tcard-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 350 10' preserveAspectRatio='none'%3E%3Cpath d='M0 5C60 2 120 8 175 5S290 2 350 5' fill='none' stroke='%231D2A2D' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.fee { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: center; padding: 7px 12px 4px; border-radius: 14px 8px 12px 6px / 8px 12px 6px 14px; background: var(--amber); box-shadow: 3px 3px 0 var(--pencil); transform: rotate(5deg); font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.1; }
.fee::before { content: ""; position: absolute; top: -9px; left: 50%; width: 42px; height: 14px; margin-left: -21px; background: rgba(255, 255, 255, .65); transform: rotate(-8deg); }
.fee small { font-family: var(--hand); font-size: 15px; font-weight: 400; line-height: 1.2; }
.tcard-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: -36px; padding: 0 16px 18px; text-align: center; }
.avatar { flex-shrink: 0; display: grid; place-items: center; width: 72px; height: 72px; border-radius: var(--r-round); background: var(--paper); color: var(--tint); box-shadow: 3px 3px 0 var(--pencil); font-family: var(--serif); font-size: 36px; font-weight: 600; }
.avatar::after { border-width: 2.5px; }
.avatar.photo { width: 96px; height: 96px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.sm { width: 48px; height: 48px; background: var(--tint); color: #fff; box-shadow: 2px 2px 0 var(--pencil); font-size: 22px; }
.who { display: flex; flex-direction: column; align-items: center; }
.who h2 { margin: 0; padding-bottom: 8px; font-size: 30px; line-height: 1.1; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 10'%3E%3Cpath d='M2 6C14 2 28 9 42 5S70 2 82 6' fill='none' stroke='%23E8A33D' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E") center bottom / 84px 10px no-repeat; }
.school { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.school .ic, .exp .ic, .match .ic { width: 16px; height: 16px; stroke-width: 2; }
.match { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1.5px solid var(--pencil); border-radius: var(--r-pill2); background: var(--amber-soft); font-size: 13px; font-weight: 700; }
.match.none { background: var(--paper); color: var(--muted); font-weight: 600; }
.tsec { align-self: stretch; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.tsec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tlabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--label); }
.ruler { display: flex; gap: 10px; }
.tier { display: flex; flex-direction: column; gap: 4px; }
.tier.thcs { flex: 4 1 0; }
.tier.thpt { flex: 3 1 0; }
.cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.cell { display: grid; place-items: center; height: 28px; border: 1.5px solid var(--pencil); border-radius: var(--r-box); background: var(--tint); color: #fff; font-size: 13px; font-weight: 800; }
.cell:nth-child(even) { border-radius: var(--r-box2); }
.cell.you { background: var(--amber); color: var(--ink); box-shadow: 2px 2px 0 var(--pencil); }
.cell.off { border-style: dashed; border-color: var(--faint); background: transparent; color: var(--faint); font-weight: 700; }
.bracket { display: flex; align-items: center; gap: 6px; margin: 0 4px; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.bracket::before, .bracket::after { content: ""; flex: 1; height: 5px; border: 1.5px solid var(--pencil); border-top: 0; }
.bracket::before { border-right: 0; border-radius: 0 0 0 6px; }
.bracket::after { border-left: 0; border-radius: 0 0 6px 0; }
.tier.dim .bracket { color: var(--faint); }
.tier.dim .bracket::before, .tier.dim .bracket::after { border-color: #B9B19F; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; border: 1.5px solid var(--pencil); border-radius: var(--r-box); font-size: 11px; font-weight: 800; }
.day:nth-child(even) { border-radius: var(--r-box2); }
.day.hit { background: var(--amber-soft); }
.slot { width: 24px; height: 14px; border-radius: 4px; background: var(--tint); color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
.slot.hit { background: var(--amber); color: var(--ink); font-weight: 800; }
.slot.off { border: 1.5px dashed #B9B19F; background: transparent; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; background: var(--tint); vertical-align: -1px; }
.legend i.amber { background: var(--amber); }
.quote { margin: 2px 0 0; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 17px; line-height: 1.4; white-space: pre-line; }
.exp { display: inline-flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: left; }
.exp .ic { margin-top: 3px; }
.stamp { position: absolute; top: 28px; z-index: 3; padding: 2px 12px; border: 3px solid currentColor; border-radius: var(--r-box); background: rgba(255, 255, 255, .92); font-family: var(--hand); font-size: 26px; letter-spacing: .04em; opacity: 0; pointer-events: none; }
.stamp.like { left: 18px; color: var(--teal); transform: rotate(-12deg); }
.stamp.nope { right: 18px; color: var(--red); transform: rotate(12deg); }

/* ---------- Bộ thẻ quẹt ---------- */
.deck-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.deck-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.nav-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--paper); color: var(--ink); box-shadow: 3px 4px 0 var(--pencil); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); font-size: 12px; font-weight: 800; }
/* Thẻ thấp vừa màn hình điện thoại nhỏ; phần còn lại của hồ sơ cuộn trong thẻ hoặc bấm vào thẻ để xem hết. */
.stack { position: relative; height: clamp(340px, calc(100dvh - 300px), 600px); }
/* Nút Thích/Bỏ qua luôn nằm trong màn hình, kể cả khi trang dài hơn màn hình (trình duyệt trong Zalo). */
.deck-actions { position: sticky; bottom: 0; z-index: 4; display: flex; justify-content: center; align-items: center; gap: 24px; padding: 12px 0 6px; background: linear-gradient(rgba(244, 236, 221, 0), var(--bg) 40%); }
.round { display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: var(--r-round); background: var(--paper); color: var(--red); box-shadow: 4px 4px 0 var(--pencil); cursor: pointer; transition: transform .1s, box-shadow .1s; }
.round.like { width: 72px; height: 72px; border-radius: 48% 53% 47% 52% / 53% 47% 52% 48%; background: var(--amber); color: var(--ink); }
.round.undo { width: 48px; height: 48px; color: var(--muted); }
.round:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--pencil); }
.round svg { width: 26px; height: 26px; filter: url(#pencil); }
.round.like svg { width: 32px; height: 32px; }
.round.undo svg { width: 22px; height: 22px; }
.swipe-hint { margin: 4px 0 0; text-align: center; font-family: var(--hand); font-size: 16px; color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 22px; border-radius: var(--r-card); background: var(--paper); box-shadow: 6px 7px 0 var(--pencil); text-align: center; }
.empty h1 { font-size: 24px; }

/* Danh sách gia sư */
.list { display: flex; flex-direction: column; gap: 18px; margin-top: 6px; padding-bottom: 8px; }
.item { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; border-radius: var(--r-card); background: var(--paper); box-shadow: 4px 5px 0 var(--pencil); }
.item:nth-child(even) { border-radius: var(--r-card2); }
.item-head { display: flex; align-items: center; gap: 12px; }
.item-head h2 { font-size: 22px; line-height: 1.2; }
.item > .btn-row { align-self: stretch; }
.chosen { align-self: flex-start; padding: 6px 12px; border: 1.5px solid var(--pencil); border-radius: var(--r-pill); background: var(--amber-soft); color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
span.chosen { cursor: default; }
.chosen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.chosen-row .chosen { padding: 3px 10px; font-size: 13px; }

/* Đã chọn xong */
.done-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 6vh 0 10vh; text-align: center; }
.done-view h1 { font-size: 28px; }
.done-ic { display: grid; place-items: center; width: 76px; height: 76px; border-radius: var(--r-round); background: var(--amber); box-shadow: 4px 4px 0 var(--pencil); }
.done-ic svg { width: 36px; height: 36px; fill: none; stroke: var(--ink); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; filter: url(#pencil); }

.toast { position: fixed; left: 50%; bottom: 20px; z-index: 10; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--r-box); background: var(--ink); color: #fff; font-size: 14px; transform: translateX(-50%); }
