@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap');

:root {
    --ink: #172035;
    --muted: #667085;
    --cream: #f8f6ef;
    --paper: #fff;
    --line: #dfe3e8;
    --lime: #d7f25c;
    --lime-dark: #a9ca19;
    --blue: #3157d5;
    --cyan: #aeeff2;
    --coral: #ff765f;
    --shadow: 0 18px 50px rgba(30, 42, 72, .10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 90% 10%, rgba(174, 239, 242, .45), transparent 28rem),
        linear-gradient(180deg, #fbfaf6, var(--cream));
    font-family: "IBM Plex Sans Thai", Tahoma, sans-serif;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

.topbar {
    height: 76px;
    display: flex;
    align-items: center;
    gap: 48px;
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(23, 32, 53, .09);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 600 13px/1 "Space Grotesk", sans-serif;
    letter-spacing: .05em;
}

.logo b {
    display: block;
    color: var(--blue);
}

.logo-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 30px;
    border: 2px solid var(--ink);
    border-radius: 15px;
    background: var(--lime);
    font-size: 12px;
}

.nav-links {
    align-self: stretch;
    display: flex;
    align-items: stretch;
    gap: 30px;
}

.nav-links a {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--ink);
    border-color: var(--lime-dark);
}

.player-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.player-menu > a {
    color: var(--muted);
    margin-left: 8px;
}

.player-avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    font: 700 14px "Space Grotesk", sans-serif;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 58px 0 80px;
}

.page-shell.narrow {
    width: min(980px, calc(100% - 40px));
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--blue);
    font: 700 12px "Space Grotesk", sans-serif;
    letter-spacing: .16em;
}

.hero {
    display: grid;
    grid-template-columns: 1.4fr .8fr;
    align-items: center;
    min-height: 280px;
}

.hero h1,
.page-heading h1 {
    margin: 0;
    font-size: clamp(42px, 6vw, 74px);
    line-height: 1.05;
    letter-spacing: -.04em;
}

.hero h1 span {
    color: var(--blue);
}

.hero-copy {
    max-width: 690px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.hero-flow {
    justify-self: end;
    width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: rotate(7deg);
}

.hero-flow i {
    height: 34px;
    border-left: 3px solid var(--ink);
    position: relative;
}

.hero-flow i::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: -6px;
    border: 5px solid transparent;
    border-top-color: var(--ink);
}

.flow-node {
    display: grid;
    place-items: center;
    width: 130px;
    height: 58px;
    border: 3px solid var(--ink);
    background: #fff;
    font: 700 13px "Space Grotesk", sans-serif;
    box-shadow: 7px 7px 0 var(--ink);
}

.node-start {
    border-radius: 40px;
    background: var(--lime);
}

.node-process {
    background: var(--cyan);
}

.node-decision {
    width: 78px;
    height: 78px;
    transform: rotate(45deg);
    background: #fff;
    font-size: 24px;
}

.node-decision::first-letter {
    transform: rotate(-45deg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 10px 0 26px;
}

.stat-card {
    padding: 20px 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .75);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.stat-card.accent {
    background: var(--lime);
    border-color: var(--lime-dark);
}

.stat-card span {
    color: var(--muted);
    font-weight: 600;
}

.stat-card strong {
    grid-row: span 2;
    font: 700 32px "Space Grotesk", sans-serif;
}

.stat-card small {
    color: var(--muted);
    font: 600 10px "Space Grotesk", sans-serif;
    letter-spacing: .12em;
}

.game-card {
    min-height: 430px;
    padding: clamp(26px, 5vw, 56px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.game-intro {
    min-height: 320px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-content: center;
    gap: 30px;
    position: relative;
    overflow: hidden;
}

.game-intro::after {
    content: "01";
    position: absolute;
    right: 3%;
    top: -25%;
    color: rgba(49, 87, 213, .055);
    font: 700 310px "Space Grotesk", sans-serif;
    pointer-events: none;
}

.game-intro h2,
.question-copy h2,
.result-screen h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.25;
}

.game-intro p:not(.eyebrow) {
    max-width: 650px;
    color: var(--muted);
    font-size: 17px;
}

.rules {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.rules span {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafa;
    color: var(--muted);
}

.rules b {
    color: var(--ink);
    font: 700 18px "Space Grotesk", sans-serif;
}

.level-select {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    position: relative;
    z-index: 1;
}

.level-card {
    padding: 20px;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(30, 42, 72, .06);
}

.level-card.featured {
    border-color: var(--ink);
    background:
        radial-gradient(circle at 100% 0, rgba(215, 242, 92, .45), transparent 150px),
        #fff;
    box-shadow: 6px 6px 0 var(--ink);
}

.level-card.featured-blue {
    border-color: var(--blue);
    background:
        radial-gradient(circle at 100% 0, rgba(174, 239, 242, .65), transparent 150px),
        #fff;
    box-shadow: 6px 6px 0 var(--blue);
}

.level-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--cyan);
    color: var(--ink);
    font: 700 11px "Space Grotesk", sans-serif;
    letter-spacing: .1em;
}

.level-card.featured .level-badge {
    background: var(--lime);
}

.level-card.featured-blue .level-badge {
    background: var(--cyan);
}

.level-card h3 {
    margin: 14px 0 6px;
    font-size: 22px;
}

.level-card p {
    min-height: 52px;
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.55;
}

.game-intro .button {
    align-self: center;
    z-index: 1;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    padding: 0 24px;
    border: 2px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 700;
    transition: transform .18s, box-shadow .18s, background .18s;
}

.button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.button-primary {
    border-color: var(--ink);
    background: var(--lime);
    color: var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
}

.button-primary:hover:not(:disabled) {
    box-shadow: 7px 7px 0 var(--ink);
}

.button-dark {
    background: var(--ink);
    color: #fff;
}

.button-outline {
    border-color: var(--ink);
    background: #fff;
}

.button-danger {
    border-color: #b42318;
    background: #fff1ee;
    color: #b42318;
}

.button-full {
    width: 100%;
}

.game-status {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 24px;
    align-items: center;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}

.game-status > div:first-child {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
}

#question-counter {
    font-weight: 700;
    white-space: nowrap;
}

.progress-track {
    height: 7px;
    width: min(360px, 30vw);
    overflow: hidden;
    border-radius: 20px;
    background: #eceff2;
}

.progress-track span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--blue);
    transition: width .35s ease;
}

.live-stat {
    min-width: 76px;
    text-align: right;
}

.live-stat small {
    display: block;
    color: var(--muted);
    font: 600 10px "Space Grotesk", sans-serif;
    letter-spacing: .12em;
}

.live-stat strong {
    font: 700 22px "Space Grotesk", sans-serif;
}

.live-stat.combo strong {
    color: var(--blue);
}

.live-stat.timer strong {
    color: var(--coral);
}

.live-stat.timer strong.timer-hot {
    color: #1f9d55;
}

.live-stat.timer strong.timer-warm {
    color: #c47a00;
}

.question-copy {
    padding: 38px 0 28px;
    text-align: center;
}

.question-copy h2 {
    max-width: 820px;
    margin: auto;
    font-size: clamp(25px, 3.6vw, 38px);
}

.flow-context {
    width: fit-content;
    max-width: 100%;
    margin: 24px auto 0;
    padding: 12px 18px;
    border-radius: 9px;
    background: #f2f4f7;
    color: #465066;
    font-family: Consolas, monospace;
    overflow-wrap: anywhere;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.answer-card {
    min-width: 0;
    min-height: 175px;
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: 15px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    position: relative;
    animation: rise .35s both;
    animation-delay: var(--delay);
    transition: border .18s, transform .18s, box-shadow .18s, background .18s;
}

.answer-card:hover:not(:disabled) {
    transform: translateY(-4px);
    border-color: var(--blue);
    box-shadow: 0 10px 24px rgba(49, 87, 213, .12);
}

.answer-card.selected {
    border-color: var(--blue);
}

.answer-card.correct {
    border-color: #4ca869;
    background: #effaf2;
}

.answer-card.wrong {
    border-color: var(--coral);
    background: #fff1ee;
}

.answer-key {
    position: absolute;
    top: 10px;
    left: 10px;
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 6px;
    background: #eef1f4;
    color: var(--muted);
    font: 700 11px "Space Grotesk", sans-serif;
}

.shape-wrap {
    min-height: 88px;
    display: grid;
    place-items: center;
}

.quiz-shape {
    display: grid;
    place-items: center;
    width: 108px;
    height: 54px;
    border: 2px solid var(--ink);
    background: var(--cyan);
    font: 700 11px "Space Grotesk", sans-serif;
}

.shape-terminator {
    border-radius: 40px;
    background: var(--lime);
}

.shape-input {
    transform: skew(-12deg);
    background: #ffdf9f;
}

.shape-input::first-line {
    transform: skew(12deg);
}

.shape-decision {
    width: 67px;
    height: 67px;
    transform: rotate(45deg);
    background: #f8c9e4;
    font-size: 20px;
}

.shape-flowline {
    border: 0;
    background: none;
    font-size: 54px;
}

.shape-sequence {
    width: 130px;
    border-style: dashed;
    background: #fff;
    font-size: 10px;
}

.answer-copy {
    display: block;
}

.answer-copy strong,
.answer-copy small {
    display: block;
}

.answer-copy strong {
    font-size: 15px;
}

.answer-copy small {
    margin-top: 3px;
    color: var(--muted);
    font: 500 11px "Space Grotesk", sans-serif;
}

.feedback {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-top: 22px;
    padding: 17px 20px;
    border-radius: 13px;
}

.feedback.success {
    background: #e9f8ed;
    color: #236b39;
}

.feedback.error {
    background: #fff0ed;
    color: #9d3526;
}

.feedback p {
    margin: 3px 0 0;
}

.feedback-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.feedback-points span {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .68);
    color: currentColor;
    font-size: 13px;
    font-weight: 700;
}

.result-screen {
    min-height: 430px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.result-badge {
    display: grid;
    place-items: center;
    width: 100px;
    height: 100px;
    margin-bottom: 22px;
    border: 3px solid var(--ink);
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 7px 7px 0 var(--ink);
    font: 700 50px "Space Grotesk", sans-serif;
}

.result-screen > p:not(.eyebrow) {
    color: var(--muted);
}

.result-score {
    margin: 24px 0;
}

.result-score span {
    display: block;
    color: var(--muted);
}

.result-score strong {
    font: 700 58px "Space Grotesk", sans-serif;
    color: var(--blue);
}

.result-actions {
    display: flex;
    gap: 14px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 30px;
    margin-bottom: 32px;
}

.page-heading h1 {
    font-size: clamp(38px, 5vw, 60px);
}

.page-heading p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--muted);
}

.table-card,
.empty-state {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 17px 22px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

th {
    background: #f6f7f8;
    color: var(--muted);
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr.current-player {
    background: #f8fce9;
}

.rank {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eef0f3;
    font: 700 13px "Space Grotesk", sans-serif;
}

.rank-1 {
    background: #ffd969;
}

.rank-2 {
    background: #dce2e8;
}

.rank-3 {
    background: #f0b583;
}

.table-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-player small {
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--lime);
}

.score-cell {
    color: var(--blue);
    font: 700 18px "Space Grotesk", sans-serif;
}

.history-grid {
    display: grid;
    gap: 12px;
}

.history-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.history-index {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--cyan);
    font: 700 14px "Space Grotesk", sans-serif;
}

.history-card small,
.history-card strong,
.history-card span {
    display: block;
}

.history-card small {
    color: var(--blue);
    font: 700 10px "Space Grotesk", sans-serif;
    letter-spacing: .1em;
}

.history-card strong {
    font-size: 20px;
}

.history-card span,
.history-card time {
    color: var(--muted);
    font-size: 14px;
}

.empty-state {
    padding: 70px 30px;
    text-align: center;
}

.empty-state h2 {
    margin: 0;
}

.empty-state p {
    color: var(--muted);
}

.alert {
    margin-bottom: 24px;
    padding: 14px 18px;
    border-radius: 10px;
}

.alert-error {
    background: #fff0ed;
    color: #913528;
    border: 1px solid #ffc7bd;
}

.alert-success {
    background: #e9f8ed;
    color: #236b39;
    border: 1px solid #b7e4c2;
}

.lesson-card,
.symbol-card,
.admin-user-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.lesson-card {
    padding: clamp(24px, 4vw, 38px);
    margin-bottom: 18px;
}

.lesson-card h2 {
    margin: 0 0 10px;
    font-size: clamp(26px, 4vw, 38px);
}

.lesson-card p {
    color: var(--muted);
    line-height: 1.8;
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.symbol-card {
    padding: 24px;
}

.symbol-card .quiz-shape {
    margin-bottom: 16px;
}

.symbol-card h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.symbol-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.lesson-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
}

.lesson-flow span {
    padding: 10px 14px;
    border: 2px solid var(--ink);
    border-radius: 12px;
    background: var(--lime);
    font-weight: 700;
}

.lesson-flow i {
    color: var(--blue);
    font-style: normal;
    font-weight: 700;
}

.admin-shell {
    width: min(1180px, calc(100% - 40px));
}

.admin-search {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    margin-bottom: 18px;
}

.admin-search input,
.admin-user-card input,
.admin-user-card select {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    border: 1px solid #cfd5dc;
    border-radius: 9px;
    outline: none;
}

.admin-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-user-card {
    padding: 20px;
}

.admin-user-card form {
    display: grid;
    gap: 9px;
}

.admin-user-card label {
    font-weight: 700;
}

.admin-user-card label small {
    color: var(--muted);
    font-weight: 500;
}

.admin-user-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.admin-user-head strong,
.admin-user-head small {
    display: block;
}

.admin-user-head small {
    color: var(--muted);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check-row input {
    width: auto;
    height: auto;
}

.admin-actions,
.delete-user-form {
    margin-top: 10px;
}

.level-access-card {
    overflow-x: auto;
}

.level-access-card th,
.level-access-card td {
    text-align: center;
}

.level-access-card th:first-child,
.level-access-card td:first-child {
    text-align: left;
}

.toggle-switch {
    display: inline-flex;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-switch span {
    width: 52px;
    height: 28px;
    border-radius: 999px;
    background: #d0d5dd;
    position: relative;
    transition: background .18s ease;
}

.toggle-switch span::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    transition: transform .18s ease;
}

.toggle-switch input:checked + span {
    background: var(--blue);
}

.toggle-switch input:checked + span::after {
    transform: translateX(24px);
}

.admin-savebar {
    padding: 18px 22px;
    text-align: right;
    background: #f6f7f8;
}

.admin-report-table {
    margin-top: 18px;
}

.admin-report-table h2 {
    margin: 0;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.report-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.report-tabs a {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(30, 42, 72, .06);
}

.report-tabs a.active {
    border-color: var(--ink);
    background: var(--lime);
    box-shadow: 5px 5px 0 var(--ink);
}

.report-tabs span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 30px;
    background:
        linear-gradient(115deg, rgba(23, 32, 53, .98) 0 52%, transparent 52%),
        var(--cream);
}

.auth-shell {
    width: min(1050px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 70px;
    align-items: center;
}

.brand-panel {
    color: #fff;
}

.brand-panel h1 {
    margin: 20px 0;
    font: 700 clamp(52px, 7vw, 82px)/.95 "Space Grotesk", sans-serif;
    letter-spacing: -.06em;
}

.brand-panel h1 span {
    color: var(--lime);
}

.brand-panel > p:not(.eyebrow) {
    max-width: 520px;
    color: #c9cfda;
    font-size: 18px;
    line-height: 1.7;
}

.brand-mark {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mini-shape {
    display: grid;
    place-items: center;
    width: 84px;
    height: 40px;
    border: 2px solid #fff;
    font: 700 10px "Space Grotesk", sans-serif;
}

.mini-start {
    border-radius: 30px;
    background: var(--lime);
    color: var(--ink);
}

.mini-decision {
    width: 48px;
    height: 48px;
    transform: rotate(45deg);
    background: var(--cyan);
    color: var(--ink);
}

.mini-arrow {
    font-size: 28px;
    transform: rotate(-90deg);
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 30px;
}

.feature-pills span {
    padding: 8px 12px;
    border: 1px solid #4b556a;
    border-radius: 20px;
    color: #d9deea;
    font-size: 13px;
}

.auth-card {
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    margin: 0;
    font-size: 30px;
}

.muted {
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 9px;
    margin-top: 25px;
}

.auth-form label {
    margin-top: 6px;
    font-weight: 600;
}

.auth-form input,
.auth-form select {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1px solid #cfd5dc;
    border-radius: 9px;
    outline: none;
}

.auth-form select {
    appearance: none;
    padding-right: 48px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.select-field {
    position: relative;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .96)),
        #fff;
}

.select-field::before {
    content: "ชั้น";
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--lime);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
}

.select-field::after {
    content: "";
    position: absolute;
    right: 17px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--blue);
    border-bottom: 2px solid var(--blue);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
    transition: transform .18s ease;
}

.select-field:focus-within::after {
    transform: translateY(-35%) rotate(225deg);
}

.select-field:focus-within select {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(49, 87, 213, .1);
}

.select-field:hover select {
    border-color: #9ba9bd;
}

.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(49, 87, 213, .1);
}

.auth-form .button {
    margin-top: 14px;
}

.auth-switch {
    margin: 24px 0 0;
    text-align: center;
    color: var(--muted);
}

.auth-switch a {
    color: var(--blue);
    font-weight: 700;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

@media (max-width: 820px) {
    .topbar {
        height: auto;
        min-height: 68px;
        gap: 18px;
        padding: 12px 20px;
        flex-wrap: wrap;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        height: 42px;
    }

    .player-menu > span:not(.player-avatar) {
        display: none;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-flow {
        display: none;
    }

    .stats-grid,
    .answer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-intro {
        grid-template-columns: 1fr;
    }

    .game-intro .button {
        justify-self: start;
    }

    .auth-page {
        background: var(--cream);
    }

    .auth-shell {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .brand-panel {
        color: var(--ink);
    }

    .brand-panel h1 {
        font-size: 50px;
    }

    .brand-panel > p:not(.eyebrow),
    .feature-pills,
    .brand-mark {
        display: none;
    }

    .brand-panel h1 span {
        color: var(--blue);
    }
}

@media (max-width: 560px) {
    .page-shell,
    .page-shell.narrow {
        width: min(100% - 24px, 1180px);
        padding-top: 36px;
    }

    .hero {
        min-height: 230px;
    }

    .hero h1 {
        font-size: 42px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 14px 18px;
    }

    .game-card {
        padding: 22px 16px;
        border-radius: 17px;
    }

    .rules {
        display: grid;
    }

    .level-select {
        grid-template-columns: 1fr;
    }

    .level-card p {
        min-height: 0;
    }

    .game-status {
        grid-template-columns: 1fr auto auto auto;
        gap: 10px;
    }

    .game-status > div:first-child {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .progress-track {
        width: 100%;
    }

    .answer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .answer-card {
        min-height: 155px;
        padding: 10px;
    }

    .quiz-shape {
        transform: scale(.85);
    }

    .shape-input {
        transform: skew(-12deg) scale(.85);
    }

    .shape-decision {
        transform: rotate(45deg) scale(.8);
    }

    .feedback {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading {
        align-items: start;
        flex-direction: column;
    }

    th,
    td {
        padding: 12px 10px;
    }

    th:nth-child(4),
    td:nth-child(4) {
        display: none;
    }

    .history-card {
        grid-template-columns: auto 1fr;
    }

    .history-card time {
        grid-column: 2;
    }

    .auth-page {
        padding: 20px 14px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .symbol-grid,
    .admin-list,
    .admin-search {
        grid-template-columns: 1fr;
    }
}
