:root {
    --bg: #0e1220;
    --bg2: #151b30;
    --card: #1a2140;
    --line: #2a3360;
    --text: #e8ecff;
    --muted: #9aa4d0;
    --accent: #5b8cff;
    --accent2: #7c5cff;
    --ok: #4ade80;
    --err: #ff6b6b;
    --student: #55ff55;
    --code: #55ffff;
    --radius: 14px;
    color-scheme: dark;
}
@media (prefers-color-scheme: light) {
    :root {
        --bg: #eef1fb;
        --bg2: #e3e8f8;
        --card: #ffffff;
        --line: #d5dbf0;
        --text: #1b2140;
        --muted: #5d678f;
        --accent: #3f6df0;
        --accent2: #6a4cf0;
        --ok: #178a45;
        --err: #c93a3a;
        --student: #0a8a0a;
        --code: #0a7f95;
        color-scheme: light;
    }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(1200px 600px at 10% -10%, var(--bg2), transparent), var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 32px 16px 48px; }
.brand { text-align: center; margin-bottom: 20px; }
.brand h1 { margin: 4px 0 0; font-size: 2rem; letter-spacing: .5px; }
.logo { font-size: 2rem; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.steps li { flex: 1 1 150px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.steps span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; font-size: .8rem; }
.field { display: block; font-weight: 600; margin: 14px 0 6px; padding: 0; }
fieldset { border: 0; padding: 0; margin: 8px 0 0; min-width: 0; }
input[type="text"] {
    width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--bg); color: var(--text); font-size: 1rem; outline: none;
}
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: 360px; overflow: auto; padding: 2px; }
.country { position: relative; cursor: pointer; display: block; }
.country input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.chip {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--bg); transition: border-color .15s, transform .1s, background .15s;
}
.country:hover .chip { border-color: var(--accent); }
.country input:focus-visible + .chip { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.country input:checked + .chip { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.flag { font-size: 1.4rem; width: 1.8rem; text-align: center; }
.cname { flex: 1; font-weight: 500; }
.ccode { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.previewbox { margin: 18px 0; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.preview { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin: 4px 0 0; word-break: break-word; }
.preview.big { font-size: 1.25rem; margin: 14px 0; }
.t-student { color: var(--student); }
.t-code { color: var(--code); }
.btn {
    display: inline-block; width: 100%; padding: 13px 18px; border: 0; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 700; font-size: 1rem; text-align: center; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); width: auto; margin-top: 8px; }
.alert { background: color-mix(in srgb, var(--err) 14%, var(--card)); border: 1px solid var(--err); color: var(--text); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.alert ul { margin: 0; padding-left: 18px; }
.success h2 { margin-top: 0; color: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
footer { text-align: center; margin-top: 24px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin select, .admin input[type="text"], .admin input[type="password"] { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.admin input[type="password"] { width: 100%; padding: 12px 14px; font-size: 1rem; }
.admin .btn { width: auto; padding: 6px 12px; font-size: .85rem; }
.admin .btn.danger { background: var(--err); }
.admin form.inline { display: inline; }
.admin .bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
