/* rtime 游戏厅 — 雷达大厅样式（自包含，跟大厅同一套配色） */
*, *::before, *::after { box-sizing: border-box; }
/* 这一层全部别名到 shared/css/rg-tokens.css。原先是一份写死的浅色表——
 * 从大厅暗色进雷达页会闪瞎。别名之后整页 49 处 var() 自动跟随主题，
 * 浅色下的取值跟原来逐字相同（两边本来就是从同一套配色抄的），视觉零变化。 */
:root {
  --panel: var(--rg-surface); --panel-2: var(--rg-surface-2);
  --text: var(--rg-text); --muted: var(--rg-text-dim); --line: var(--rg-border);
  --accent: var(--rg-accent); --accent-2: #8f7bff; --on-accent: var(--rg-on-accent);
  --near: #2fb98a; --far: #8f7bff; --danger: #e76a6a;
  --shadow: rgba(90, 70, 180, .16);
  --r-lg: var(--rg-r-lg); --r-md: var(--rg-r-md); --r-sm: var(--rg-r-sm);
  font-family: ui-rounded, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system,
               "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 令牌表里没有对应项的几个语义色，暗色下单独给：浅色那几个在深底上对比度不够。 */
/* 规范 §4：弹层遮罩在暗色下压「中性深」，不许沿用浅紫。 */
html[data-color-mode="dark"] .overlay { background: rgba(6, 8, 14, .62); }

html[data-color-mode="dark"] {
  --accent-2: var(--rg-night-accent-2);
  --near: #4fd6a6; --far: #a99cff; --danger: #ff8a8a;
  --shadow: rgba(0, 0, 0, .5);
}
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text); min-height: 100dvh; overflow-x: hidden;
  background: var(--rg-bg);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------ chrome */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px calc(14px + env(safe-area-inset-top, 0px));
  max-width: 760px; margin: 0 auto;
}
.back { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 700; font-size: .95rem; }
.back__ico { font-size: 1.3rem; line-height: 1; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; }
.brand__name { background: linear-gradient(100deg, #6c63ff, #c44be0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.whoami { color: var(--muted); font-size: .88rem; font-weight: 700; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { max-width: 760px; margin: 0 auto; padding: 4px 18px calc(40px + env(safe-area-inset-bottom, 0px)); }

.gate { display: grid; place-items: center; padding: 12vh 22px; }
.gate__card { background: var(--panel); border-radius: var(--r-lg); padding: 30px 26px; text-align: center; box-shadow: 0 12px 34px var(--shadow); max-width: 380px; }
.gate__emoji { font-size: 2.4rem; }
.gate__title { font-weight: 800; font-size: 1.15rem; margin: 8px 0 6px; }
.gate__sub { color: var(--muted); margin: 0 0 16px; font-size: .95rem; line-height: 1.6; }
.gate__link { color: var(--accent); font-weight: 700; }

/* ------------------------------------------------------------------- radar */
.scope { padding: 6px 0 4px; }
.scope__stage { position: relative; width: 100%; max-width: 460px; margin: 0 auto; aspect-ratio: 1 / 1; }
.scope__canvas { width: 100%; height: 100%; display: block; touch-action: manipulation; }
.scope__me {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: .82rem; color: var(--on-accent); pointer-events: none;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 16px rgba(108, 99, 255, .45);
}
.scope__legend { display: flex; justify-content: center; gap: 18px; margin-top: 6px; font-size: .86rem; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend--near i { background: var(--near); }
.legend--far i { background: var(--far); }
.legend b { color: var(--text); }
.scope__hint { text-align: center; color: var(--muted); font-size: .86rem; margin: 8px 0 0; }

/* ------------------------------------------------------------------ me bar */
.mecard { background: var(--panel); border-radius: var(--r-md); padding: 14px 16px; margin: 16px 0; box-shadow: 0 6px 20px var(--shadow); }
.mecard__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mecard__name { font-weight: 800; }
.mecard__toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .86rem; cursor: pointer; margin-left: auto; }
.mecard__toggle input { width: 17px; height: 17px; accent-color: var(--accent); }
.mecard__tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mecard__tagsLabel { color: var(--muted); font-size: .86rem; font-weight: 700; }
.tags { display: flex; gap: 7px; flex-wrap: wrap; }
.tag {
  padding: 6px 12px; border-radius: 999px; font-size: .86rem; font-weight: 700;
  background: var(--panel-2); color: var(--muted); transition: transform .12s;
}
.tag.is-on { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.tag:active { transform: scale(.94); }
.mini { padding: 5px 10px; border-radius: var(--r-sm); background: var(--panel-2); font-size: .82rem; font-weight: 700; color: var(--muted); }

/* ------------------------------------------------------------------ people */
.people__h { font-size: 1rem; margin: 0 0 10px; }
.people__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.person {
  display: flex; align-items: center; gap: 11px; background: var(--panel);
  border-radius: var(--r-md); padding: 11px 13px; box-shadow: 0 4px 14px var(--shadow);
  width: 100%; text-align: left;
}
.person.is-busy { opacity: .62; }
.person__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--far); }
.person.is-near .person__dot { background: var(--near); }
.person__tx { min-width: 0; flex: 1; }
.person__name { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.person__badge { font-size: .68rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.person__sub { color: var(--muted); font-size: .8rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person__act { flex: none; padding: 7px 13px; border-radius: 999px; font-size: .84rem; font-weight: 800; background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.person__act.is-watch { background: var(--panel-2); color: var(--muted); }
.person__act[disabled] { background: var(--panel-2); color: var(--muted); cursor: default; }
.people__empty { color: var(--muted); font-size: .92rem; line-height: 1.7; text-align: center; padding: 18px 6px; }
.people__empty a { color: var(--accent); font-weight: 700; }

/* ----------------------------------------------------------------- sheets */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center;
  background: rgba(30, 24, 60, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  padding: 16px;
}
.sheet {
  width: 100%; max-width: 460px; max-height: min(88vh, 780px); overflow-y: auto; background: var(--panel); border-radius: var(--r-lg);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 40px rgba(40, 30, 90, .3); animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet__title { margin: 0 0 4px; font-size: 1.12rem; }
.sheet__sub { margin: 0 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.sheet__actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.sheet__timer { margin-top: 10px; text-align: center; color: var(--muted); font-size: .8rem; }
.sheet__block { display: block; margin: 12px auto 0; color: var(--muted); font-size: .8rem; text-decoration: underline; }
.sheet__spin {
  width: 34px; height: 34px; margin: 2px auto 12px; border-radius: 50%;
  border: 3px solid var(--panel-2); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn { flex: 1 1 auto; padding: 11px 14px; border-radius: var(--r-md); background: var(--panel-2); font-weight: 800; color: var(--text); }
.btn--primary { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }

/* 一项一行、同项的选项挤同一行（折行最难看），说明降级成按钮里的小字。 */
.field { min-width: 0; }
.field__label { display: block; color: var(--muted); font-size: .82rem; font-weight: 700; margin-bottom: 6px; }
.seg { display: grid; gap: 6px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; padding: 7px 8px; border-radius: var(--r-sm); background: var(--panel-2);
  font-size: .87rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.25;
}
.seg__hint {
  display: block; font-size: .68rem; font-weight: 600; opacity: .78;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.seg__btn > :not(.seg__hint), .seg__btn { white-space: nowrap; }
.seg__btn.is-on { background: linear-gradient(160deg, var(--accent-2), var(--accent)); color: var(--on-accent); }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.setup .field--wide { grid-column: 1 / -1; }
.terms { display: grid; gap: 5px; background: var(--panel-2); border-radius: var(--r-md); padding: 11px 13px; font-size: .88rem; }
.terms__row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.terms__k { color: var(--muted); flex: none; }
.terms__v { font-weight: 700; text-align: right; }
.terms__h { color: var(--muted); font-weight: 600; font-size: .8rem; margin-left: .35em; }

@media (max-width: 380px) {
  .setup { grid-template-columns: 1fr; }
}
.readyrow { display: flex; gap: 9px; margin-top: 14px; }
.ready {
  flex: 1; display: flex; align-items: center; gap: 7px; padding: 9px 11px;
  border-radius: var(--r-sm); background: var(--panel-2); font-size: .86rem; font-weight: 700;
}
.ready.is-on { background: rgba(47, 185, 138, .15); color: #1c7f5f; }
html[data-color-mode="dark"] .ready.is-on { color: #4fd6a6; }
.ready__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.ready.is-on .ready__dot { background: var(--near); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 60; max-width: 84vw; text-align: center;
  background: rgba(22, 20, 32, .94); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: .9rem; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet__spin { animation: none; }
}

/* 雷达上没人 / 不认识人时的两条备选路径 */
.alt { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.alt[hidden] { display: none !important; }
.alt__btn {
  padding: 8px 14px; border-radius: 999px; background: var(--panel);
  color: var(--text); font-size: .86rem; font-weight: 700;
  box-shadow: 0 2px 10px var(--shadow); border: 1px solid var(--line);
}
.alt__btn:active { transform: scale(.96); }

.queuing {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 10px; font-size: .88rem; font-weight: 700; color: var(--muted);
}
.queuing[hidden] { display: none !important; }
.queuing__spin {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--panel-2); border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .queuing__spin { animation: none; } }

.input {
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit;
}
.input:focus-visible { outline: 3px solid rgba(108, 99, 255, .34); outline-offset: 1px; }
