:root {
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #1a1a18;
  --sub: #6b6a64;
  --muted: #94938c;
  --border: #e3e1d9;
  --accent: #0c447c;
  --accentbg: #e6f1fb;
  --danger: #791f1f;
  --dangerbg: #fcebeb;
  --dangerborder: #e24b4a;
  --success: #17623a;
  --successbg: #e7f6ed;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --card: #232326;
    --text: #f0efe9;
    --sub: #b4b2a9;
    --muted: #7a7972;
    --border: #3a3a3d;
    --accent: #85b7eb;
    --accentbg: #0c447c;
    --danger: #f7c1c1;
    --dangerbg: #501313;
    --dangerborder: #a32d2d;
    --success: #b9ebcc;
    --successbg: #17462a;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--card);
}
textarea { min-height: 70px; resize: vertical; }
button { cursor: pointer; }
.hidden { display: none !important; }
.wrap { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(90px + env(safe-area-inset-bottom, 0px)); }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.small { color: var(--muted); font-size: 11px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--sub);
  background: var(--card);
  font-size: 12px;
}
.tab.active { border-color: var(--accent); color: var(--accent); background: var(--accentbg); }
.card { margin-bottom: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.card.flag { border-color: var(--dangerborder); color: var(--danger); background: var(--dangerbg); }
.card.flag * { color: var(--danger) !important; }
.datehead { margin: 14px 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.plat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); }
.plat:first-of-type { border-top: 0; }
.plat a, .plat span:first-child { min-width: 0; overflow-wrap: anywhere; color: inherit; text-decoration: none; font-size: 14px; }
.num { flex: 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn { min-height: 42px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--card); font-weight: 600; }
.btn-primary { border: 0; color: var(--bg); background: var(--text); }
.btn-ghost { border-style: dashed; background: none; }
.iconbtn { padding: 6px; border: 0; color: var(--sub); background: none; font-size: 16px; }
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  color: var(--bg);
  background: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  font-size: 26px;
}
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .5); }
.sheet { width: 100%; max-height: 90vh; overflow-y: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px 0 0; background: var(--bg); }
.field { margin-bottom: 11px; }
.label { display: block; margin-bottom: 4px; color: var(--sub); font-size: 12px; }
.platblock { position: relative; margin-bottom: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.remove-platform { position: absolute; top: 4px; right: 4px; }
.center { padding: 42px 20px; color: var(--sub); text-align: center; font-size: 14px; }
.loading { min-height: 50vh; display: grid; place-items: center; }
.notice { max-width: 560px; margin: 10px auto 0; padding: 10px 14px; border: 1px solid var(--dangerborder); border-radius: var(--radius); color: var(--danger); background: var(--dangerbg); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 50; transform: translateX(-50%); width: min(90vw, 420px); padding: 11px 14px; border-radius: 10px; color: var(--success); background: var(--successbg); box-shadow: 0 2px 12px rgba(0,0,0,.25); font-size: 13px; text-align: center; }
.toolbar { display: flex; gap: 4px; }
.admin-box { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.user-row { padding: 8px 0; border-top: 1px solid var(--border); }
.user-row:first-child { border-top: 0; }
.rank { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.rank.inactive { opacity: .6; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

@media (min-width: 700px) {
  .overlay { align-items: center; justify-content: center; padding: 24px; }
  .sheet { max-width: 600px; border-radius: 16px; }
}
