:root {
  --bg: #0b0d12;
  --panel: #14171d;
  --panel-2: #1a1e26;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.16);
  --text: #f5f7fb;
  --muted: #aab2c0;
  --accent: #4c8dff;
  --success: #22c55e;
  --warning: #f59e0b;
  --workspace: #0f1319;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

#appRoot {
  width: 100%;
  height: 100%;
}

.tool-btn,
.list-row button {
  border: 1px solid var(--line);
  background: #11131a;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
}

a.tool-btn,
.view-link-card {
  text-decoration: none;
}

.tool-btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: white;
}

.tool-btn.success {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.3);
  color: #dcfce7;
}

.tool-btn.warn {
  background: rgba(245,158,11,0.14);
  border-color: rgba(245,158,11,0.3);
  color: #fde68a;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f1015;
  color: var(--text);
  padding: 8px 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tool-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tiny-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  white-space: nowrap;
}

.session-chip span {
  color: var(--text);
  font-weight: 600;
}

.view-link-list,
.scorekeeper-view-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
}

.view-link-card:hover {
  border-color: rgba(76, 141, 255, 0.4);
  background: rgba(76, 141, 255, 0.08);
}

.view-link-label {
  font-size: 12px;
  color: var(--muted);
}

.view-link-url {
  font-size: 12px;
  word-break: break-all;
}

.overlay-root {
  position: relative;
  width: 1920px;
  height: 1080px;
  background: transparent;
}

.overlay-widget {
  position: absolute;
  display: flex;
  align-items: center;
  overflow: hidden;
  user-select: none;
}

.overlay-widget-text {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.overlay-widget.is-interactive {
  cursor: move;
}

.overlay-widget.is-selected {
  outline: 3px solid rgba(76, 141, 255, 0.85);
  outline-offset: 2px;
}

.overlay-widget-label {
  position: absolute;
  top: -22px;
  left: 0;
  font-size: 11px;
  color: #dbeafe;
  background: rgba(11, 17, 34, 0.88);
  border: 1px solid rgba(76,141,255,0.35);
  border-radius: 6px;
  padding: 2px 6px;
  display: none;
  pointer-events: none;
}

.overlay-widget.is-selected .overlay-widget-label {
  display: inline-flex;
}

.debug-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 720px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(8, 10, 16, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  z-index: 5000;
}

.debug-panel.is-hidden {
  display: none;
}

.debug-panel__title {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-panel__toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.debug-panel__button {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: #eef4ff;
  font: inherit;
  font-size: 11px;
  padding: 7px 10px;
  cursor: pointer;
}

.debug-panel__body {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: calc(70vh - 96px);
  color: #d7e2ff;
  font-size: 11px;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.debug-panel__section + .debug-panel__section {
  margin-top: 12px;
}

.debug-panel__section-title {
  margin-bottom: 6px;
  color: #9fb4e8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.debug-panel__code {
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-panel__log {
  display: grid;
  gap: 8px;
}

.debug-panel__log-entry {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
}

.debug-panel__log-meta {
  margin-bottom: 4px;
  color: #9fb4e8;
  font-size: 10px;
  text-transform: uppercase;
}

.debug-panel__empty {
  color: #8ea0c8;
}
