
.handicap-mode-control {
  flex: 1 1 620px;
  gap: var(--space-md);
}

.hcp-mode-btn-group {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.hcp-mode-btn {
  flex: 1 1 auto;
  min-height: var(--touch-min);
  font-size: var(--text-sm);
  background: var(--panel-alt);
  border: 2px solid var(--line);
  color: var(--muted);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.hcp-mode-btn[data-active="true"] {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.7);
  color: #4a9eff;
  font-weight: 600;
}
.cloud-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-sm);
  width: 100%;
}

.cloud-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.cloud-control-compact {
  margin-top: 2px;
  padding: 8px 10px;
  gap: var(--space-sm);
}

.cloud-control-compact .cloud-row {
  gap: 6px;
}
.cloud-snapshots-panel {
  margin: 2px 0 0;
}

.cloud-control-compact .btn {
  padding: 8px 12px;
  min-height: 38px;
}

.cloud-control-compact #cloudJoinCode,
.cloud-control-compact #cloudSnapshotSelect {
  min-width: 180px;
  padding: 7px 10px;
}

.cloud-control-compact #cloudStatus {
  padding: 4px 8px;
}

#cloudJoinCode {
  min-width: 220px;
  flex: 1 1 240px;
}

#cloudSnapshotSelect {
  min-width: 240px;
  max-width: 100%;
  padding: var(--space-sm);
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 4px;
  flex: 1 1 280px;
}

#cloudStatus,
#cloudCodes,
#cloudSnapshotStatus {
  margin: 0;
}

#cloudStatus {
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px solid transparent;
  font-weight: 700;
}

#cloudStatus[data-live="true"] {
  color: #d9ffe9;
  background: rgba(28, 118, 67, 0.35);
  border-color: rgba(104, 211, 145, 0.7);
}

#cloudStatus[data-live="false"] {
  color: #ffd9d9;
  background: rgba(128, 28, 28, 0.35);
  border-color: rgba(255, 107, 107, 0.75);
}

/* Create Live Session button — solid green */
#cloudCreateBtn {
  background: #1f9d55;
  border-color: #1a8a49;
  color: #fff;
}

#cloudCreateBtn:hover {
  background: #22b360;
  border-color: #1f9d55;
}
/* Compact cloud status badge in header (next to Add Player) */
.cloud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 2px solid var(--line);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--panel);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.cloud-status-badge[data-live="true"] {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-color: var(--ok-line);
}

.cloud-status-badge[data-live="false"] {
  color: var(--muted);
  background: var(--panel);
  border-color: var(--line);
}

/* Reconnecting during a live round: an amber badge so a network blip is
   visible on the always-on header (the session stays "live", so without this
   the badge would stay green while edits are actually queued offline). Two
   attributes ([data-conn][data-live]) lift specificity above the various
   single-attribute [data-live="true"] green rules across stylesheets so this
   wins regardless of source order. */
.cloud-status-badge[data-conn="reconnecting"][data-live] {
  color: var(--warn);
  background: var(--warn-soft-bg);
  border-color: var(--warn-line);
}

/* [release-readiness #8] Real sync failure (permission denied / retries
   exhausted) during a live round — a red badge, distinct from the amber
   "reconnecting" state above. Previously a push failure only ever reached
   the hidden #cloudStatus detail line (buried in the account menu) while
   this always-visible badge stayed green "Live". Same two-attribute
   specificity trick as the reconnecting rule above so it wins regardless
   of source order. */
.cloud-status-badge[data-conn="error"][data-live] {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.cloud-code-badge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 99px;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  min-height: 24px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.cloud-code-badge-btn[hidden] {
  display: none;
}

.cloud-code-badge-btn:hover:not(:disabled) {
  border-color: rgba(104, 211, 145, 0.7);
  background: rgba(104, 211, 145, 0.15);
}

.cloud-code-badge-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.archived-tools-title {
  width: 100%;
  margin-bottom: 4px;
  color: var(--muted);
}
/* =========================================================================
   Light theme overrides — moved from light-theme-overrides.css
   ========================================================================= */

:root[data-theme="light"] .hcp-mode-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

:root[data-theme="light"] .hcp-mode-btn[data-active="true"] {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.6);
  color: #1d4ed8;
  font-weight: 600;
}

:root[data-theme="light"] #cloudCreateBtn {
  background: #1f9d55;
  border-color: #1a8a49;
  color: #fff;
}

:root[data-theme="light"] #cloudCreateBtn:hover {
  background: #22b360;
}

/* Light theme overrides for badge */
/* Kept (not collapsible): main.css's :root[data-theme="light"]
   .cloud-status-badge chrome rule (0,3,0) outranks the tokenized dark rule
   above (0,2,0) in light, so this (0,4,0) guard must stay to preserve the
   green live tint. Values re-pointed at the dictionary tokens (no-op). */
:root[data-theme="light"] .cloud-status-badge[data-live="true"] {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-color: var(--ok-line);
}

:root[data-theme="light"] .cloud-status-badge[data-live="false"] {
  color: #666e78;
  background: #f3f5f8;
  border-color: #cfd3d8;
}

/* Light-theme amber override for the reconnecting badge — the light green
   rule above is (0,3,0), so this two-attribute selector ((0,4,0)) must win. */
:root[data-theme="light"] .cloud-status-badge[data-conn="reconnecting"][data-live] {
  color: var(--warn);
  background: var(--warn-soft-bg);
  border-color: var(--warn-line);
}

/* [release-readiness #8] Light-theme red override for the sync-error badge —
   same specificity reasoning as the reconnecting override above. */
:root[data-theme="light"] .cloud-status-badge[data-conn="error"][data-live] {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

:root[data-theme="light"] .cloud-code-badge-btn {
  color: #334155;
  background: #f3f5f8;
  border-color: #cfd3d8;
}

:root[data-theme="light"] .cloud-code-badge-btn:hover:not(:disabled) {
  color: #0f5b35;
  border-color: #45a46f;
  background: #dff7ea;
}

/* Kept (not collapsible from here): the dark .is-open fill is owned by
   game-options-ui.css (.game-options-toggle.is-open — #utilitiesToggle
   carries that class), not this file. Re-pointed at the dictionary tokens. */
:root[data-theme="light"] #utilitiesToggle.is-open,
:root[data-theme="light"] #utilitiesToggle.is-open:hover {
  background: var(--accent-press);
  border-color: var(--accent-press-line);
  color: var(--on-accent);
  box-shadow: inset 0 0 0 1px var(--hi-medium);
}

/* Kept (not collapsible): the dark #cloudStatus[data-live="true"] literals
   above (#d9ffe9 / .35 / .7) are deliberately stronger than the --ok-* dark
   values, so the dark rule can't be tokenized. Light values re-pointed at
   the dictionary tokens (no-op). */
:root[data-theme="light"] #cloudStatus[data-live="true"] {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-color: var(--ok-line);
}

:root[data-theme="light"] #cloudStatus[data-live="false"] {
  color: #8b1f1f;
  background: #ffe2e2;
  border-color: #d95c5c;
}

/* =========================
   Sync Diagnostics modal
   Read-only panel surfaced from the Utilities accordion. Reuses
   .game-options-modal-backdrop for the dim layer.
   ========================= */
.sync-diagnostics-panel {
  position: fixed;
  inset: 0;
  /* Honor Android nav-bar inset via --safe-bottom-inset; env() resolves
     to 0 in Android WebView so a raw env() margin lets the panel slide
     under the nav bar. */
  margin: max(16px, var(--safe-top-inset, env(safe-area-inset-top, 0px))) 12px max(16px, var(--safe-bottom-inset, env(safe-area-inset-bottom, 0px)));
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel, #132639);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.45);
  z-index: 10052;
  overflow: hidden;
}

.sync-diagnostics-panel[hidden] {
  display: none;
}

.sync-diagnostics-header {
  flex: 0 0 auto;
  padding: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: inherit;
  z-index: 2;
}

.sync-diagnostics-subtitle {
  color: var(--muted);
  margin-top: 2px;
}

.sync-diagnostics-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 10px 12px 16px;
}

.sync-diagnostics-text {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.sync-diagnostics-backdrop {
  z-index: 10051;
}

:root[data-theme="light"] .sync-diagnostics-panel {
  background: #f7fafd;
}
