/* =========================
   Utilities Section
   Extracted from main.css
   ========================= */

/* ---- Utilities Section ---- */
.utilities-toggle-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: var(--space-sm);
}

.utilities-toggle-btn.is-open {
  border-color: #f3c26b;
  background: rgba(243, 194, 107, 0.24);
  color: #ffe3b3;
  box-shadow: inset 0 0 0 1px rgba(243, 194, 107, 0.5);
}

.utilities-section {
  display: none;
  margin-top: 0;
  border: 2px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-sm);
}

.utilities-section.open {
  display: block;
}

.utilities-section[hidden] {
  display: none !important;
}

.utilities-grid {
  display: grid;
  gap: var(--space-sm);
  align-items: stretch;
}

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

.utilities-row .btn,
.utilities-row .theme-toggle {
  white-space: nowrap;
}

.utilities-control {
  max-width: 100%;
}

.handicap-mode-control {
  flex: 1 1 620px;
  gap: 12px;
}

.hcp-mode-btn-group {
  display: flex;
  gap: 6px;
  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;
}
.font-size-control {
  gap: var(--space-xs);
}

.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: 8px;
}

.cloud-control-compact .cloud-row {
  gap: 6px;
}

.cloud-control-compact .cloud-row-share .btn {
  flex: 1 1 220px;
}

.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;
  padding: 4px 8px;
}

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

#cloudSnapshotSelect {
  min-width: 240px;
  max-width: 100%;
  padding: 8px;
  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: #a7f3c8;
  background: rgba(28, 118, 67, 0.28);
  border-color: rgba(104, 211, 145, 0.55);
}

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

.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 !important;
}

.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;
}

.cloud-code-badge-btn-share {
  gap: 4px;
}

.cloud-code-badge-btn-share .badge-text {
  display: inline;
}

.cloud-code-badge-btn-share .badge-icon {
  display: inline-block;
  font-size: 0.85em;
  opacity: 0.8;
  transition: opacity 0.2s, transform 0.2s;
}

.cloud-code-badge-btn-share:hover:not(:disabled) .badge-icon {
  opacity: 1;
  transform: scale(1.1);
}
.archived-tools-title {
  width: 100%;
  margin-bottom: 4px;
  color: var(--muted);
}

/* Firebase emulator SDK injects .firebase-emulator-warning at the bottom by default.
   Reposition it as a compact strip at the very top so it never covers game controls. */
.firebase-emulator-warning {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  width: 100% !important;
  padding: 2px 10px !important;
  font-size: 10px !important;
  line-height: 1.4 !important;
  text-align: center !important;
  z-index: 99999 !important;
  box-sizing: border-box !important;
}

.firebase-emulator-warning > * {
  display: inline !important;
}

/* =========================================================================
   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 */
:root[data-theme="light"] .cloud-status-badge[data-live="true"] {
  color: #0f5b35;
  background: #d7f8e6;
  border-color: #45a46f;
}

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

: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;
}

:root[data-theme="light"] #utilitiesToggle.is-open,
:root[data-theme="light"] #utilitiesToggle.is-open:hover {
  background: #0b74d1;
  border-color: #095ba3;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px var(--hi-medium);
}

:root[data-theme="light"] #cloudStatus[data-live="true"] {
  color: #0f5b35;
  background: #d7f8e6;
  border-color: #45a46f;
}

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