* { box-sizing: border-box; }
html, body { margin: 0; font-family: system-ui, "Segoe UI", Arial, sans-serif; font-size: 14px; color: #1f2430; background: #f4f5f7; }
a { color: #2b6cb0; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h1:focus { outline: none; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.muted { color: #6b7280; }
.error { color: #c0392b; }
.ok { color: #1e8449; }
.pad { padding: 1rem; }

.page { display: flex; min-height: 100vh; }
.sidebar { width: 200px; flex: 0 0 200px; background: #1f2430; color: #cbd3e1; padding: 0.5rem 0; }
.sidebar .brand { font-weight: 700; color: #fff; padding: 0.75rem 1rem; font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }
.sidebar .nav-group { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; color: #7b8494; padding: 0.75rem 1rem 0.25rem; }
.sidebar .nav-link { display: block; padding: 0.4rem 1rem; color: #cbd3e1; }
.sidebar .nav-link:hover { background: #2a3040; text-decoration: none; }
.sidebar .nav-link.active { background: #2b6cb0; color: #fff; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top-row { display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; background: #fff; border-bottom: 1px solid #e5e7eb; }
.top-row form { margin: 0; }
.content { padding: 1rem 1.25rem; min-width: 0; }
.title-row { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 0.75rem; }
.title-row h1 { margin: 0; }

.linklike { background: none; border: none; color: #2b6cb0; cursor: pointer; padding: 0; font: inherit; }

input, select, textarea { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; max-width: 100%; }
button { font: inherit; padding: 0.4rem 0.8rem; border: 1px solid #2b6cb0; background: #2b6cb0; color: #fff; border-radius: 4px; cursor: pointer; }
button.secondary { background: #fff; color: #2b6cb0; }
button.danger { background: #c0392b; border-color: #c0392b; color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }
/* QuickGrid's sortable headers are <button class="col-title">: keep the header text visible */
button.col-title { color: inherit; font: inherit; padding: 0.1rem 0.4rem; border-radius: 0; }
.toolbar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
.picker { display: inline-flex; gap: 0.4rem; align-items: center; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 0.75rem; max-width: 820px; }
.tabs a { padding: 0.4rem 0.9rem; color: #4b5563; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: #2b6cb0; border-bottom-color: #2b6cb0; font-weight: 600; }
.tab-bar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }

.btn-sm { display: inline-flex; align-items: center; gap: 0.3rem; font: inherit; font-size: 0.8rem; padding: 0.2rem 0.5rem; border: 1px solid #2b6cb0; border-radius: 4px; cursor: pointer; }
a.btn-sm { background: #fff; color: #2b6cb0; text-decoration: none; }
a.btn-sm:hover { background: #eef4fb; text-decoration: none; }
td.actions { white-space: nowrap; }
td.actions > * + * { margin-left: 0.35rem; }
td form { margin: 0; }

.grid-wrap { overflow-x: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; }
table.qg { border-collapse: collapse; width: 100%; }
table.qg th, table.qg td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #eef0f3; text-align: left; white-space: nowrap; }
table.qg th { background: #f8fafc; position: sticky; top: 0; }
table.qg tbody tr:not(:has(td:not(:empty))) { display: none; }
.clip { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 10px; font-size: 0.75rem; }
.badge.on { background: #d5f5e3; color: #1e8449; }
.badge.off { background: #fdecea; color: #c0392b; }
.level.error { color: #c0392b; font-weight: 600; }
.level.warn { color: #b7791f; }
.level.event { color: #4b5563; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.chip { background: #eef2f7; border-radius: 10px; padding: 0.1rem 0.5rem; font-size: 0.8rem; }

/* stat labels, icons and the meters against Auto Limit's limits */
.stat-label { display: inline-flex; align-items: center; gap: 0.3rem; }
.stat-icon { width: 1.05em; height: 1.05em; flex: none; color: #4b5563; }
.meters { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
.meters > .meter { flex: 1 1 170px; max-width: 280px; }
.meters.compact { display: grid; grid-template-columns: repeat(3, minmax(9.5rem, 1fr)); gap: 0.35rem 0.9rem; font-size: 0.8rem; }
.meters.compact .win { color: #6b7280; }
.meter { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.meter-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.meter .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter .track { height: 5px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.meter .fill { height: 100%; border-radius: 3px; background: #2e9b4f; transition: width 0.3s; }
.meter.warn .fill { background: #c98a12; }
.meter.full .fill { background: #d2463f; }
.meter.full .num { color: #d2463f; }
/* the cooldown's Local and Anywhere pills, the player facts (stardust, time zone) */
.badge.idle { background: #eef0f3; color: #6b7280; }
.cooldown .badge { font-variant-numeric: tabular-nums; }
.fact { display: inline-flex; flex-direction: column; gap: 0.1rem; font-variant-numeric: tabular-nums; }
.fact .muted { font-size: 0.8rem; }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #1f2430; padding: 1rem; }
.login-box { background: #fff; padding: 2rem; border-radius: 8px; width: 340px; max-width: 100%; display: flex; flex-direction: column; gap: 0.4rem; }
.login-box h1 { text-align: center; }
.login-box input { width: 100%; }
.login-box button { margin-top: 0.75rem; }
.login-box .links { text-align: center; font-size: 0.85rem; margin: 0.75rem 0 0; }

.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.card h2 { margin-top: 0; font-size: 1rem; }
.card.stat .big { font-size: 1.6rem; }
.field { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.6rem; max-width: 360px; }
.field label { font-size: 0.8rem; color: #4b5563; }
.result { white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Consolas, monospace; background: #0f1117; color: #d6e2f0; padding: 0.6rem; border-radius: 4px; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.checks { display: inline-flex; gap: 0.25rem; align-items: center; }
.linkcell { color: #2b6cb0; cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,17,23,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 8px; padding: 1.25rem; width: min(680px, 92vw); max-height: 85vh; overflow: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
.modal h2 { margin-top: 0; font-size: 1.05rem; }
.modal-body { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, monospace; background: #f6f8fa; border: 1px solid #e5e7eb; border-radius: 4px; padding: 0.6rem; max-height: 55vh; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }

.passkey-add { display: flex; gap: 0.5rem; align-items: center; max-width: 720px; flex-wrap: wrap; }
.passkey-add input { flex: 1 1 200px; }

/* the module settings editor, laid out as the in-game settings screen: cards of rows, a section header above each */
.set-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 0.9rem; max-width: 820px; }
.set-section { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; margin: 1.1rem 0 0.4rem 0.25rem; }
.set-row { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1rem; position: relative; }
/* a row (or module) that differs from its defaults, as the in-game screen marks it */
.set-row.set-changed::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: #2b6cb0; }
.set-row mark { background: #fde68a; color: inherit; border-radius: 2px; }
.set-search { flex: 0 1 260px; }
button.btn-sm.on { background: #2b6cb0; color: #fff; }
.set-row + .set-row { border-top: 1px solid #eef0f3; }
.set-row.set-wide { flex-wrap: wrap; }
.set-row.set-wide .set-control { flex: 1 1 100%; justify-content: flex-start; }
.set-row.set-locked { opacity: 0.55; }
.set-row.set-tip { color: #6b7280; font-size: 0.85rem; display: block; }
a.set-text { color: inherit; }
a.set-text:hover { text-decoration: none; }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.set-label { font-weight: 500; }
.mini-egg { width: 1em; height: 1em; vertical-align: -0.125em; margin-right: 0.35rem; color: #ddd; }
.egg-2km { color: #8fb843; }
.egg-5km { color: #e5933d; }
.egg-7km { color: #c442e0; }
.egg-10km { color: #5258c7; }
.egg-12km { color: #e55a5e; }
.set-title { font-size: 1.15rem; font-weight: 600; }
.set-desc { color: #6b7280; font-size: 0.85rem; }
.set-control { display: flex; align-items: center; gap: 0.5rem; flex: none; justify-content: flex-end; }
.set-control input[type=range] { width: 180px; }
.set-value { font-variant-numeric: tabular-nums; min-width: 3.5rem; text-align: center; font-weight: 500; }
.set-bound { color: #6b7280; font-size: 0.75rem; }
.set-note { font-size: 0.75rem; }
.set-chevron { font-size: 1.4rem; line-height: 1; color: #9ca3af; padding: 0 0.25rem; }
.set-chevron:hover { text-decoration: none; color: #2b6cb0; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 11px; transition: background 0.15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + span { background: #2e9b4f; }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { cursor: default; }
.seg { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.copy-pick { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.copy-list { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-bottom: 0.5rem; }
.seg button { background: #eef2f7; border: 1px solid transparent; color: #1f2430; border-radius: 14px; padding: 0.25rem 0.75rem; font-size: 0.85rem; }
.seg button.on { background: #2b6cb0; color: #fff; }
.seg button img { height: 1.3em; width: auto; vertical-align: middle; margin: -0.15em 0.3rem -0.1em -0.2rem; }
.set-pairs { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.set-pair { display: inline-flex; align-items: center; gap: 0.35rem; }
.set-pair > img { height: 1.5em; width: auto; }
.set-pair .seg button { padding: 0.15rem 0.6rem; }
.set-icon { height: 1.3em; width: auto; vertical-align: middle; margin: -0.15em 0.35rem -0.1em 0; }
.set-list { flex-wrap: wrap; gap: 0.35rem; }
.set-entry { display: inline-flex; align-items: center; gap: 0.3rem; background: #eef2f7; border-radius: 14px; padding: 0.15rem 0.6rem; font-size: 0.85rem; }
.set-entry img { height: 1.4em; width: auto; }
.set-entry input[type=number] { width: 5rem; }
.set-entry .linklike { font-size: 1rem; line-height: 1; color: #6b7280; }
.set-picker { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.25rem; }
.set-picker input[type=search] { flex: 1 1 220px; max-width: 360px; }
.set-picker input[type=number] { width: 5rem; }
.set-results { flex: 1 1 100%; }

/* phone width: the sidebar becomes a wrapping bar above the content */
@media (max-width: 760px) {
    .page { flex-direction: column; }
    .sidebar { width: 100%; flex: none; display: flex; flex-wrap: wrap; align-items: center; padding: 0.25rem 0.5rem; }
    .sidebar .brand { padding: 0.4rem 0.6rem; }
    .sidebar .nav-group { display: none; }
    .sidebar .nav-link { padding: 0.35rem 0.6rem; }
    .content { padding: 0.75rem; }
    .top-row { justify-content: space-between; }
    .clip { max-width: 200px; }
    .set-row { flex-wrap: wrap; }
    .set-control { flex: 1 1 100%; justify-content: flex-start; flex-wrap: wrap; }
    .set-control input[type=range] { flex: 1 1 120px; width: auto; }
}
