/* GrindScale — Community UI. Reuses the app's design tokens from styles.css. */

/* when login is disabled these containers stay empty — don't render their chrome */
.saved-bar:empty { display: none; }
.account:empty { display: none; }

/* ---- bottom-bar: in-focus best badge + save best ---- */
.transport-best-badge {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 3px;
  font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: -.01em;
  color: var(--accent-ink);
}
.transport-best-badge::before { content: '★'; font-size: 10px; }
.transport-best-badge[hidden] { display: none; }
.transport-best {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px;
  color: var(--accent-ink); background: var(--accent-weak); border: 1px solid var(--line-2);
  border-radius: 11px; padding: 9px 14px; white-space: nowrap; margin-left: 4px;
  transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.transport-best:hover { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px var(--accent-ring); }
.transport-best:active { transform: translateY(.5px); }
.transport-best[hidden] { display: none; }

.gs-toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 12px);
  background: var(--text); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 90;
  max-width: 80vw; text-align: center;
}
.gs-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- account area (top-right of the topbar) ---- */
.account { margin: 2px 0 4px; }
.topbar-acct { margin: 0; align-self: flex-start; flex: 0 0 auto; }
.topbar-acct .acct-signin { width: auto; padding: 9px 14px; }
.topbar-acct .acct-chip { min-width: 150px; }
.topbar-acct .acct-msg { max-width: 220px; text-align: right; }
.toggles { margin-bottom: 14px; }
.acct-msg { font-size: 11px; color: var(--muted-2); line-height: 1.4; }
.acct-signin {
  width: 100%; appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px;
  color: #fff; background: var(--grad); border: none; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 18px -8px var(--accent-ring);
}
.acct-signin:hover { filter: brightness(1.04); }
.acct-chip {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 8px 10px; box-shadow: var(--shadow-sm);
}
.acct-chip:hover { border-color: var(--accent); }
.acct-ava {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--grad); letter-spacing: 0;
}
.acct-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.acct-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-pts { font-size: 10.5px; color: var(--accent-ink); font-weight: 600; }
.acct-out {
  margin-left: auto; appearance: none; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); width: 26px; height: 26px; border-radius: 8px; font-size: 13px;
}
.acct-out:hover { color: var(--text); border-color: var(--accent); }

/* ---- community sheet ---- */
#communitySheet { padding: 22px 24px 18px; }
.cm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cm-head h2 { font-family: var(--font-display); font-size: 28px; font-weight: 500; letter-spacing: -.01em; margin: 0; line-height: 1.05; }
.cm-head .cm-btn { margin-left: auto; }
.cm-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); font-weight: 600; margin: 26px 0 12px; }
.cm-record h3, .cm-card h3 { font-family: var(--font-display); font-weight: 500; }
.cm-desc { color: var(--muted); margin: 0 0 16px; font-size: 15px; }

.cm-btn {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px;
  color: #fff; background: var(--grad); border: none; border-radius: 11px; padding: 10px 16px;
  box-shadow: 0 8px 18px -8px var(--accent-ring); transition: filter .12s, transform .06s;
}
.cm-btn:hover { filter: brightness(1.05); }
.cm-btn:active { transform: translateY(.5px); }
.cm-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.cm-btn.cm-ghost { background: var(--panel); color: var(--accent-ink); border: 1px solid var(--line); box-shadow: none; }
.cm-link { appearance: none; background: none; border: none; cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 13px; padding: 4px 0; }
.cm-link:hover { text-decoration: underline; }

.cm-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.cm-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cm-field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-2); font-weight: 600; }
.cm-input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.cm-input:focus { outline: none; border-color: var(--accent); }
.cm-input.cm-sm { flex: 0 0 90px; }
.cm-details { margin: 4px 0 12px; }
.cm-details summary { cursor: pointer; font-size: 12px; color: var(--accent-ink); font-weight: 600; margin-bottom: 8px; }
.cm-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.cm-kv span { color: var(--muted); }
.cm-status { font-size: 12.5px; color: var(--muted); min-height: 1em; }
.cm-empty { color: var(--muted); font-size: 14px; padding: 18px 4px; line-height: 1.5; }
.cm-empty code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: 12px; }

.cm-list { display: flex; flex-direction: column; gap: 10px; }
.cm-comp {
  appearance: none; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; box-shadow: var(--shadow-sm);
}
.cm-comp:hover { border-color: var(--accent); transform: translateY(-1px); }
.cm-comp-title { font-size: 15px; font-weight: 650; }
.cm-comp-sub { font-size: 12px; color: var(--muted); }

.cm-record h3 { margin: 0 0 4px; font-size: 15px; }
.cm-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.cm-audio { width: 100%; margin-top: 10px; height: 38px; }

.cm-sub { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; }
.cm-rank { font-family: 'Geist Mono', monospace; font-weight: 700; font-size: 16px; color: var(--muted-2); min-width: 22px; text-align: center; }
.cm-sub-main { flex: 1; min-width: 0; }
.cm-sub-who { font-size: 13px; font-weight: 600; }
.cm-you { font-size: 10px; color: var(--accent-ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; margin-left: 6px; }
.cm-vote {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 46px; transition: all .12s;
}
.cm-vote:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.cm-vote:disabled { opacity: .5; cursor: default; }
.cm-vote.voted { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -8px var(--accent-ring); }
.cm-vc { font-size: 12px; }

.cm-lb-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.cm-lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.cm-lb-pts { font-family: 'Geist Mono', monospace; font-weight: 700; color: var(--accent-ink); }

/* progress view */
.cm-signin-prompt { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.cm-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cm-stat { flex: 1 1 120px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.cm-stat span { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-family: 'Geist Mono', monospace; }
.cm-stat label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 600; }
.cm-prog-meta { font-family: 'Geist Mono', monospace; font-size: 13px; color: var(--muted); }

/* ---- save / load bar inside the builders ---- */
.saved-bar { margin-top: 16px; border-top: 1px dashed var(--line-2); padding-top: 14px; }
.saved-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.saved-name {
  flex: 1; min-width: 140px; font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
}
.saved-name:focus { outline: none; border-color: var(--accent); }
.saved-save {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 13px; color: #fff;
  background: var(--grad); border: none; border-radius: 10px; padding: 8px 16px;
}
.saved-save:hover { filter: brightness(1.05); }
.saved-hint { font-size: 12.5px; color: var(--muted); }
.saved-link { appearance: none; background: none; border: none; cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.saved-link:hover { text-decoration: underline; }
.saved-status { font-size: 12px; color: var(--muted); }
.saved-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.saved-empty { font-size: 12.5px; color: var(--muted-2); }
.saved-item { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.saved-load {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 550; color: var(--text);
  background: none; border: none; padding: 7px 11px;
}
.saved-load:hover { color: var(--accent-ink); }
.saved-del {
  appearance: none; cursor: pointer; color: var(--muted-2); background: none; border: none;
  border-left: 1px solid var(--line); padding: 0 9px; font-size: 14px;
}
.saved-del:hover { color: var(--warn); }
