/* XVelo admin. Sign-in on obsidian like the app; signed in, an obsidian side menu and light pages for office work.
   Brand C7 Glacier – Glacier marks only the page you're on and a player's own result. */
:root {
  --obsidian: #0B0C0E; --basalt: #17191C; --iron: #3E434A; --gunmetal: #6F7680; --frost: #ECEFF2; --platinum: #D4D8DE; --muted-dark: #9AA0A8;
  --page: #F4F5F7; --card: #FFFFFF; --line: #E1E4E8; --ink: #111214; --muted: #5B6169; --soft: #EEF0F3;
  --glacier: #6FDDFF; --glacier-ink: #0A6E8F; --danger: #FF8A80; --danger-ink: #B3261E; --ok-ink: #1F7A3D;
  --display: 'Michroma', 'Arial', sans-serif; --body: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--obsidian); color: var(--frost); font-family: var(--body); font-size: 14px; line-height: 20px; -webkit-text-size-adjust: 100%; }
body.signed-in { background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }

/* ---------- sign in, create login, login ready ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-left, 0px)); }
.card { width: 100%; max-width: 420px; background: var(--basalt); border: 1px solid #26292E; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.mark { display: flex; align-items: center; gap: 10px; }
.mark b { font-family: var(--display); font-weight: 400; letter-spacing: .16em; font-size: 15px; }
.mark small { margin-left: auto; color: var(--gunmetal); font-size: 13px; font-weight: 600; }
.gate h1 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 32px; margin: 6px 0 0; }
.gate h2 { font-size: 15px; font-weight: 600; margin: 6px 0 -6px; color: var(--frost); }
.gate p { margin: 0; color: var(--muted-dark); font-size: 15px; line-height: 22px; }
.gate p b { color: var(--frost); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted-dark); }
.gate .field input { height: 48px; border-radius: 10px; border: 1px solid var(--iron); background: var(--obsidian); color: var(--frost); font: 500 16px var(--body); padding: 0 14px; }
.gate .field input:focus { outline: 2px solid var(--glacier); outline-offset: 1px; border-color: transparent; }
.err { color: var(--danger); font-weight: 600; font-size: 14px; min-height: 20px; }
.good { color: var(--frost); font-weight: 600; font-size: 14px; }
.go { height: 50px; border: 0; border-radius: 12px; background: var(--frost); color: var(--ink); font: 700 16px var(--body); cursor: pointer; }
.go:disabled { opacity: .6; cursor: default; }
.ghost { height: 44px; border: 1px solid var(--iron); border-radius: 10px; background: transparent; color: var(--frost); font-weight: 600; cursor: pointer; padding: 0 14px; }
.switch { appearance: none; border: 0; background: none; color: var(--frost); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
.back { color: var(--muted-dark); text-align: center; font-weight: 600; text-decoration: none; padding: 6px; }
.back:hover { color: var(--frost); }
.go:focus-visible, .ghost:focus-visible, .back:focus-visible, .switch:focus-visible { outline: 2px solid var(--glacier); outline-offset: 3px; }
.hint-pw { margin: -8px 0 0 !important; font-size: 13px !important; }
.row2 { display: flex; gap: 10px; } .row2 .field { flex: 1; }
.mydevices { display: flex; flex-direction: column; gap: 8px; }
.mydevices div { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--obsidian); border: 1px solid #26292E; border-radius: 10px; padding: 10px 12px; }
.mydevices span { color: var(--muted-dark); font-size: 13px; display: block; }
.loading { min-height: 100%; display: grid; place-items: center; color: var(--muted-dark); }

/* ---------- signed in: menu ---------- */
.app { display: flex; min-height: 100%; }
.side { width: 236px; flex: none; background: var(--obsidian); color: var(--frost); padding-block: 22px; padding-inline: 14px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.side .mark { padding: 0 10px 14px; }
.group { color: var(--gunmetal); font-size: 12px; font-weight: 600; padding: 14px 12px 4px; }
.nav { display: flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 8px; color: var(--muted-dark); font-weight: 500; position: relative; text-decoration: none; }
.nav:hover { color: var(--frost); }
.nav.on { background: var(--basalt); color: var(--frost); font-weight: 600; }
.nav.on::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--glacier); }
.nav:focus-visible { outline: 2px solid var(--glacier); outline-offset: 2px; }
.me { margin-top: auto; border-top: 1px solid #26292E; padding: 14px 12px 0; display: flex; flex-direction: column; gap: 6px; }
.me b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .lvl { align-self: flex-start; }
.me .ghost { margin-top: 6px; height: 38px; }

/* ---------- signed in: pages ---------- */
.main { flex: 1; min-width: 0; padding-block: 26px 48px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.app h1 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 32px; letter-spacing: .04em; margin: 0; }
.app h2 { font-family: var(--display); font-weight: 400; font-size: 16px; line-height: 24px; letter-spacing: .03em; margin: 8px 0 0; }
.sub { color: var(--muted); margin: 4px 0 0; max-width: 64ch; }
.body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel > h3 { margin: 0; font-size: 15px; font-weight: 700; }
.note { color: var(--muted); font-size: 13px; margin: 0; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 14px var(--body); min-height: 38px; padding: 0 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.pri { background: var(--ink); color: var(--frost); border-color: var(--ink); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--danger-ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .main input:focus-visible, .main select:focus-visible, .main textarea:focus-visible { outline: 2px solid var(--glacier-ink); outline-offset: 2px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.form .wide { grid-column: 1 / -1; }
.main .field { color: var(--muted); }
.main .field input, .main .field select, .main .field textarea, .main td input, .main td select { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: 500 14px var(--body); padding: 0 10px; min-width: 0; width: 100%; }
.main .field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
.main input[type=color] { padding: 2px; height: 38px; width: 100%; }
.main input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tablewrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
th { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .who { display: block; font-weight: 600; }
td .sm { display: block; color: var(--muted); font-size: 13px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; letter-spacing: .02em; white-space: nowrap; }
.lvl { display: inline-block; border-radius: 8px; padding: 3px 9px; background: var(--soft); color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; }
.lvl.top { background: var(--ink); color: var(--frost); }
.side .lvl { background: var(--basalt); color: var(--frost); }
.side .lvl.top { background: var(--frost); color: var(--ink); }
.tag { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.ok { color: var(--ok-ink); } .tag.bad { color: var(--danger-ink); } .tag.ink { background: var(--ink); color: var(--frost); }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 16px; padding: 22px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile .lab { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .big { font-family: var(--display); font-size: 30px; line-height: 38px; font-variant-numeric: tabular-nums; }
.tile .sm { color: var(--muted); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--frost); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--danger-ink); }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--glacier-ink); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.phone { width: 180px; height: 330px; border-radius: 26px; border: 6px solid #2A2D31; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: none; }
.phone .pc { border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.phone b { font-family: var(--display); font-weight: 400; font-size: 20px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.photos figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--soft); }
.photos figcaption { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
svg.outline { width: 100%; max-width: 260px; height: auto; }

@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: auto; height: auto; position: sticky; top: 0; z-index: 5; flex-direction: row; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); padding-block: 10px; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side .mark { padding: 0 6px 0 0; } .side .mark b, .side .mark small { display: none; }
  .group { display: none; }
  .nav { white-space: nowrap; min-height: 40px; }
  .me { margin: 0 0 0 8px; border: 0; padding: 0; flex-direction: row; align-items: center; } .me b, .me .lvl { display: none; } .me .ghost { margin: 0; white-space: nowrap; }
  .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-top: 18px; }
}
@media (max-width: 640px) {
  .tablewrap { background: none; border: 0; overflow: visible; }
  .tablewrap table, .tablewrap tbody, .tablewrap tr, .tablewrap td { display: block; width: 100%; }
  .tablewrap thead { display: none; }
  .tablewrap tr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; }
  .tablewrap td { border: 0; padding: 6px 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: center; }
  .tablewrap td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; }
  .tablewrap td.num { text-align: left; }
  .tablewrap td .tag, .tablewrap td .lvl { white-space: normal; }
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .tile .big { font-size: 24px; }
  .card { padding: 22px; }
  .row2 { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
