:root {
  --bg: #333333;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --panel-strong: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --point-color: #2563eb;
  --pending-point-color: #f59e0b;
  --primary-soft: #dbeafe;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #ea580c;
  --warning-soft: #ffedd5;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --radius: 18px;
  --point-size: 12px;
  --label-radius: 14px;
  --label-font-size: 15px;
  --label-scale: 1;
  --label-scale-small-factor: 1;
  --label-scale-auto-factor: 1;
  --label-bg: #ffffff;
  --label-text: #0f172a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 24%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.10), transparent 22%),
    #333333;
}

body {
  padding: 18px;
}

button,
input,
textarea,
select,
output {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
}

input[type="color"] {
  inline-size: 100%;
  block-size: 42px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.compact-inline-color {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.compact-inline-color > span {
  min-width: 0;
}

.compact-color-picker {
  inline-size: 78px !important;
  min-inline-size: 78px;
  block-size: 34px !important;
  padding: 3px !important;
  border-radius: 10px !important;
  justify-self: end;
}
.compact-inline-setting {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px !important;
}

.compact-inline-setting > span {
  min-width: 0;
}

.compact-inline-control {
  justify-self: end;
  min-width: 0;
  gap: 8px;
}

.compact-inline-short .compact-inline-control {
  width: 132px;
}

.compact-inline-score .compact-inline-control {
  width: 110px;
}

.compact-inline-setting .inline-field input {
  min-width: 0;
}


.app-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar,
.panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px;
}

.topbar h1,
.panel-heading h2,
.sidebar-section h2 {
  margin: 0;
  line-height: 1.1;
}

.topbar-copy {
  min-width: 0;
}

.subtitle,
.panel-heading p,
.sidebar-section p,
.label-zone-header p,
.status-text,
.point-coords,
.meta-list dt {
  color: var(--muted);
}

.subtitle {
  margin: 10px 0 0;
  max-width: 72ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #cbd5e1;
  color: var(--text);
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.button-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-danger {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.button-small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.file-button {
  cursor: pointer;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-preview {
  min-width: 0;
  overflow: clip;
}

.game-preview {
  min-width: 0;
  max-width: 100%;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.status-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.badge,
.remaining-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
}

.badge {
  background: var(--primary-soft);
  color: var(--primary);
}

.remaining-badge {
  background: #f1f5f9;
  color: var(--text);
  white-space: nowrap;
}

.game-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  border: 1px solid #dbe4ef;
  border-radius: 22px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

#previewCard {
  overflow: clip;
}

.validate-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
}

.validate-center-btn {
  min-width: 180px;
  min-height: 52px;
  font-size: 1.05rem;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.22);
}

.game-over-overlay {
  background: rgba(15, 23, 42, 0.62);
}

.overlay-card {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 22px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}

.overlay-kicker {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.overlay-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.overlay-copy {
  margin: 0;
  color: var(--muted);
}

.inline-reset-btn {
  margin-top: 12px;
  align-self: flex-start;
}

.game-header,
.result-zone {
  border-radius: 18px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid #e2e8f0;
}

.game-header {
  background: #333333;
  border-color: #333333;
}

.editable {
  outline: none;
  border: 1px dashed transparent;
  border-radius: 10px;
  padding: 6px 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.editable:hover,
.editable:focus {
  border-color: #93c5fd;
  background: #eff6ff;
}

.game-header .editable:hover,
.game-header .editable:focus {
  border-color: #f5d06f;
  background: rgba(255, 255, 255, 0.1);
}

.game-header h2 {
  font-size: clamp(1.5rem, 2vw, 2rem);
  margin: 0;
  color: #f5d06f;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px 14px;
}

.game-header-main {
  min-width: 0;
}

.game-header-meta {
  display: flex;
  justify-content: flex-end;
  align-self: start;
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.timer-chip-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-chip strong {
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-chip.is-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, #fffbeb, #fef3c7);
  color: #92400e;
}

.timer-chip.is-danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(180deg, #fff1f2, #ffe4e6);
  color: #9f1239;
}

.instructions,
.result-message {
  margin: 8px 0 0;
}

.game-header .instructions {
  color: #ffffff;
}

.game-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 248px);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.side-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  align-content: start;
}

.image-zone,
.label-zone,
.result-zone {
  min-height: 0;
  border-radius: 18px;
  border: 1px solid #d9e2ec;
}

.image-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
}

.label-zone {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  padding: 12px;
}

.label-zone-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  min-width: 0;
}

.label-zone-header > div {
  min-width: 0;
}

.label-zone-header h3 {
  margin: 0;
}

.label-zone-header p {
  margin: 6px 0 0;
}

.stage-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.image-stage {
  position: relative;
  width: min(100%, 900px);
  user-select: none;
}

.image-stage img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.image-stage.is-validated img {
  filter: brightness(0.72) saturate(0.9);
}

.image-source-credit {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 24px);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.image-source-field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.image-source-field input {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 0 12px;
  background: #fff;
}

.image-source-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.point-layer {
  position: absolute;
  inset: 0;
  touch-action: none;
}

.point {
  position: absolute;
  display: block;
  width: var(--point-size);
  height: var(--point-size);
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--point-color);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--label-bg);
  background-clip: padding-box;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.94),
    0 8px 18px rgba(15, 23, 42, 0.16);
  cursor: grab;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  z-index: 4;
  touch-action: none;
}

.point::before {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--label-bg);
  opacity: 0;
  transform: scale(0.2);
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.16s ease;
}

.point::after {
  content: "";
  position: absolute;
  inset: calc(var(--point-size) * -1.12);
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--point-color) 42%, transparent);
  opacity: 0;
  transform: scale(0.8);
}

.point:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.point.pending {
  background: #ffffff;
  border-color: var(--pending-point-color);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.96),
    0 0 0 8px color-mix(in srgb, var(--pending-point-color) 22%, transparent),
    0 10px 22px rgba(15, 23, 42, 0.2);
}

.point.pending.point-pulse {
  animation: pointRingBreath 1.45s ease-in-out infinite;
}

.point.pending.point-pulse::after {
  border-color: color-mix(in srgb, var(--pending-point-color) 42%, transparent);
  opacity: 1;
  animation: pointPulse 1.55s ease-out infinite;
}

.point.has-label {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--label-bg) 92%, #ffffff 8%),
    color-mix(in srgb, var(--label-bg) 78%, #ffffff 22%)
  );
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.94),
    0 10px 20px rgba(37, 99, 235, 0.18);
}

.point.has-label::before {
  opacity: 1;
  transform: scale(1);
}

.point.has-label::after,
.point.has-label.pending,
.point.has-label.point-pulse {
  animation: none !important;
}

.point.has-label::after {
  opacity: 0 !important;
}

.point.dragging-point,
.point.snap-candidate {
  border-color: var(--warning);
  box-shadow:
    0 0 0 7px rgba(251, 191, 36, 0.18),
    0 12px 28px rgba(234, 88, 12, 0.25);
}

.point.dragging-point::before,
.point.snap-candidate::before {
  opacity: 1;
  transform: scale(0.92);
  background: var(--warning);
}

@keyframes pointRingBreath {
  0%,
  100% {
    box-shadow:
      0 0 0 3px rgba(255, 255, 255, 0.96),
      0 0 0 0 color-mix(in srgb, var(--pending-point-color) 0%, transparent),
      0 8px 18px rgba(15, 23, 42, 0.16);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.98),
      0 0 0 12px color-mix(in srgb, var(--pending-point-color) 20%, transparent),
      0 12px 26px rgba(15, 23, 42, 0.2);
  }
}

@keyframes pointPulse {
  0% {
    transform: scale(0.72);
    opacity: 0.96;
  }
  70% {
    transform: scale(1.7);
    opacity: 0;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.label-pool {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
}

.label-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  min-height: calc(42px * var(--label-scale) * var(--label-scale-small-factor));
  min-width: 0;
  max-width: calc(220px * var(--label-scale) * var(--label-scale-small-factor));
  inline-size: fit-content;
  padding: calc(10px * var(--label-scale) * var(--label-scale-small-factor)) calc(14px * var(--label-scale) * var(--label-scale-small-factor));
  border-radius: var(--label-radius);
  border: 1px solid #cbd5e1;
  background: var(--label-bg);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  color: var(--label-text);
  font-weight: 700;
  font-size: var(--label-font-size);
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  appearance: none;
  -webkit-appearance: none;
  cursor: grab;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  touch-action: none;
}

.label-chip:not(.placed-label):hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.12);
}

.label-chip.placed-label {
  position: absolute;
  z-index: 5;
  transform: none !important;
}

.label-chip.placed-label.anchor-tl::after,
.label-chip.placed-label.anchor-tr::after,
.label-chip.placed-label.anchor-br::after,
.label-chip.placed-label.anchor-bl::after,
.label-chip.placed-label.with-leader::after {
  display: none;
}

.label-link {
  position: absolute;
  height: 3px;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 96%, white 4%), color-mix(in srgb, var(--primary) 70%, white 30%));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.9),
    0 2px 10px rgba(15, 23, 42, 0.24);
  z-index: 2;
  pointer-events: none;
  opacity: 0.98;
}

.label-link::before,
.label-link::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95);
}

.label-link::before {
  left: 0;
}

.label-link::after {
  left: 100%;
}

.label-chip.correct {
  border: 2px solid #22c55e;
  background: linear-gradient(180deg, #dcfce7, #bbf7d0);
  color: #14532d;
  box-shadow: 0 12px 22px rgba(21, 128, 61, 0.18);
}

.label-chip.incorrect {
  border: 2px solid #ef4444;
  background: linear-gradient(180deg, #ffe4e6, #fecdd3);
  color: #7f1d1d;
  box-shadow: 0 12px 22px rgba(185, 28, 28, 0.16);
}

.label-chip:disabled {
  opacity: 1;
  cursor: default;
}

.label-chip.drag-origin {
  visibility: hidden;
}

.label-chip.drag-origin-placed {
  visibility: visible;
  opacity: 0.18;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10050;
  pointer-events: none;
  opacity: 0.96;
  transform: none;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.22);
}

.drag-ghost.snap-preview {
  opacity: 1;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.26), 0 0 0 2px rgba(255, 255, 255, 0.88);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 480px;
  width: 100%;
  border: 2px dashed #bfdbfe;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  gap: 8px;
  padding: 24px;
}

.hidden {
  display: none !important;
}

.toolbar-main .is-hidden {
  display: none !important;
}

.result-text-row {
  display: grid;
  gap: 6px;
}

.result-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-display {
  margin-top: 12px;
  min-height: 72px;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92);
}

.result-display.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.result-display.is-warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.result-display.is-neutral {
  border-color: #dbeafe;
  background: #f8fbff;
}

.result-main {
  font-weight: 800;
  font-size: 1rem;
}

.result-sub,
.result-note {
  margin-top: 6px;
  color: var(--muted);
}

.result-selected-message {
  margin-top: 8px;
  font-weight: 700;
}

.result-no-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  background: rgba(255, 255, 255, 0.9);
  color: #475569;
  font-size: 0.88rem;
  font-weight: 800;
}

.panel-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 6px;
}

.sidebar-toolbar strong {
  font-size: 0.98rem;
}

.sidebar-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sidebar-section {
  display: block;
  padding: 0;
  border-radius: 20px;
  border: 1px solid #dbe4ef;
  background: linear-gradient(180deg, #fff, #f8fafc);
  overflow: clip;
}

.sidebar-accordion[open] {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.sidebar-summary {
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  cursor: pointer;
  user-select: none;
}

.sidebar-summary::-webkit-details-marker {
  display: none;
}

.sidebar-summary:hover {
  background: rgba(248, 250, 252, 0.92);
}

.sidebar-summary-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.sidebar-summary-copy p {
  margin: 0;
}

.sidebar-chevron {
  flex: 0 0 auto;
  inline-size: 14px;
  block-size: 14px;
  margin-top: 6px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin-top 0.18s ease;
}

.sidebar-accordion[open] .sidebar-chevron {
  transform: rotate(225deg);
  margin-top: 10px;
}

.sidebar-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.sidebar-section p {
  margin: 0;
}

.points-list,
.score-rules,
.control-grid {
  display: grid;
  gap: 12px;
}

.quick-presets {
  display: grid;
  gap: 8px;
}

.quick-presets > span {
  font-weight: 700;
  color: var(--muted);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.point-row,
.score-rule-row {
  border-radius: 16px;
  border: 1px solid #dbe4ef;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.point-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.point-row label,
.score-rule-row label,
.control-grid label {
  display: grid;
  gap: 6px;
}

.point-row input,
.score-rule-row input,
.control-grid input[type="number"],
.control-grid input[type="text"] {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 0 12px;
  background: #fff;
}

.inline-field,
.range-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-field input {
  flex: 1;
}

.field-suffix {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
}

.range-field output {
  min-width: 66px;
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-row input {
  inline-size: 18px;
  block-size: 18px;
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 12px;
}

.meta-list div {
  display: grid;
  gap: 4px;
}

.meta-list dd {
  margin: 0;
}

.placeholder-note {
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed #cbd5e1;
  color: var(--muted);
  background: #fff;
}

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  padding: 26px;
}

.fullscreen-shell {
  position: relative;
  height: 100%;
  display: grid;
  align-items: center;
}

.fullscreen-mount {
  display: grid;
  place-items: center;
  height: 100%;
}

.fullscreen-mount .game-card {
  width: min(1380px, 100%);
  max-height: calc(100vh - 72px);
  overflow: auto;
}

.close-overlay-btn {
  position: absolute;
  top: 0;
  right: 0;
}

@media (max-height: 900px) and (min-width: 961px) {
  body {
    padding: 10px;
  }

  .app-shell {
    gap: 10px;
  }

  .topbar,
  .panel {
    padding: 12px;
    border-radius: 18px;
  }

  .topbar {
    gap: 10px;
  }

  .subtitle {
    margin-top: 6px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 10px;
  }

  .panel-heading {
    margin-bottom: 10px;
    gap: 10px;
  }

  .game-card {
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
  }

  .game-header,
  .image-zone,
  .label-zone,
  .result-zone {
    border-radius: 14px;
  }

  .game-header {
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .game-header h2 {
    font-size: clamp(1.2rem, 1.4vw, 1.55rem);
  }

  .instructions {
    margin-top: 4px;
    font-size: 0.86rem;
  }

  .game-body {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 10px;
  }

  .side-stack {
    gap: 8px;
  }

  .image-zone {
    padding: 10px;
  }

  .image-stage {
    width: min(100%, 760px);
  }

  .label-zone {
    padding: 8px;
  }

  .label-pool {
    min-height: 0;
    max-height: 28vh;
    overflow: auto;
    padding-right: 4px;
  }

  .result-zone {
    padding: 10px 12px;
  }

  .result-display {
    margin-top: 8px;
    min-height: 120px;
    padding: 12px;
  }

  .panel-sidebar {
    top: 10px;
    max-height: calc(100vh - 20px);
  }

  .sidebar-summary {
    padding: 12px;
  }

  .sidebar-body {
    gap: 10px;
    padding: 0 12px 12px;
  }

  .point-row,
  .score-rule-row {
    gap: 8px;
    padding: 10px;
  }
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel-sidebar {
    order: -1;
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 1366px) and (min-width: 961px) {
  body {
    padding: 10px;
  }

  .app-shell {
    gap: 10px;
  }

  .topbar,
  .panel {
    padding: 12px;
    border-radius: 18px;
  }

  .topbar {
    gap: 10px;
  }

  .topbar h1 {
    font-size: clamp(1.15rem, 1.45vw, 1.45rem);
  }

  .subtitle {
    margin-top: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .toolbar {
    gap: 8px;
  }

  .button {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.86rem;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 328px;
    gap: 10px;
  }

  .panel-heading {
    margin-bottom: 10px;
    gap: 10px;
  }

  .badge,
  .remaining-badge {
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .game-card {
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
  }

  .game-header,
  .image-zone,
  .label-zone,
  .result-zone {
    border-radius: 14px;
  }

  .game-header {
    padding: 10px 12px;
    gap: 8px 10px;
  }

  .game-header h2 {
    font-size: clamp(1.18rem, 1.5vw, 1.52rem);
  }

  .instructions {
    margin-top: 4px;
    font-size: 0.86rem;
  }

  .panel-sidebar {
    gap: 10px;
    top: 10px;
    max-height: calc(100vh - 20px);
  }

  .sidebar-summary {
    padding: 12px;
    gap: 10px;
  }

  .sidebar-body {
    gap: 10px;
    padding: 0 12px 12px;
  }

  .points-list,
  .score-rules,
  .control-grid {
    gap: 10px;
  }

  .point-row,
  .score-rule-row {
    padding: 10px;
    gap: 8px;
    border-radius: 14px;
  }

  .point-row input,
  .score-rule-row input,
  .control-grid input[type="number"],
  .control-grid input[type="text"] {
    min-height: 36px;
    padding: 0 10px;
  }
}

@media (max-width: 1280px) and (min-width: 961px) and (max-height: 840px) {
  body {
    padding: 8px;
  }

  .app-shell {
    gap: 8px;
  }

  .topbar,
  .panel {
    padding: 10px;
    border-radius: 16px;
  }

  .toolbar {
    gap: 6px;
  }

  .button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.82rem;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 308px;
    gap: 8px;
  }

  .panel-heading {
    margin-bottom: 8px;
    gap: 8px;
  }

  .panel-heading p,
  .status-text,
  .subtitle {
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .badge,
  .remaining-badge {
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.8rem;
  }

  .game-card {
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
  }

  .game-header,
  .image-zone,
  .label-zone,
  .result-zone {
    border-radius: 12px;
  }

  .game-header {
    padding: 8px 10px;
  }

  .game-header h2 {
    font-size: clamp(1.08rem, 1.35vw, 1.34rem);
  }

  .instructions {
    margin-top: 3px;
    font-size: 0.82rem;
  }

  .image-zone,
  .label-zone,
  .result-zone {
    padding: 8px;
  }

  .label-zone-header {
    margin-bottom: 8px;
    gap: 8px;
  }

  .label-pool {
    gap: 8px;
    min-height: 0;
    max-height: 26vh;
  }

  .label-chip {
    min-height: calc(34px * var(--label-scale) * var(--label-scale-small-factor));
    padding: calc(7px * var(--label-scale) * var(--label-scale-small-factor)) calc(9px * var(--label-scale) * var(--label-scale-small-factor));
  }

  .result-display {
    margin-top: 8px;
    min-height: 96px;
    padding: 10px;
  }

  .panel-sidebar {
    gap: 8px;
    top: 8px;
    max-height: calc(100vh - 16px);
  }

  .sidebar-summary {
    padding: 10px;
    gap: 8px;
  }

  .sidebar-body {
    gap: 8px;
    padding: 0 10px 10px;
  }

  .point-row,
  .score-rule-row {
    padding: 8px;
    gap: 7px;
    border-radius: 12px;
  }

  .point-row input,
  .score-rule-row input,
  .control-grid input[type="number"],
  .control-grid input[type="text"] {
    min-height: 34px;
    padding: 0 9px;
  }
}

@media (max-width: 1180px) and (min-width: 721px) {
  body {
    padding: 12px;
  }

  .topbar,
  .panel {
    padding: 14px;
  }

  .workspace {
    gap: 12px;
  }

  .panel-sidebar {
    order: 0;
  }

  .game-card {
    padding: 12px;
    gap: 12px;
  }

  .game-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .image-stage {
    width: min(100%, 820px);
  }

  .label-pool {
    min-height: 0;
    max-height: 34vh;
    overflow: auto;
    padding-right: 4px;
  }

  .button,
  .point-row input,
  .score-rule-row input,
  .control-grid input[type="number"],
  .control-grid input[type="text"] {
    min-height: 44px;
  }
}

@media (max-width: 960px) {
  body {
    padding: 14px;
  }

  .sidebar-toolbar,
  .sidebar-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .topbar,
  .panel-heading {
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .status-wrap {
    align-items: flex-start;
  }

  .game-body {
    grid-template-columns: 1fr;
  }

  .image-zone,
  .label-zone {
    min-height: auto;
  }

  .label-pool {
    min-height: 120px;
  }

  .fullscreen-overlay {
    padding: 12px;
  }

  .fullscreen-mount .game-card {
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 1280px) {
  .game-body {
    grid-template-columns: 1fr;
  }
}

.result-display .result-legend {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(148, 163, 184, .28);
  font-size: .9rem;
  color: #334155;
}

.result-display .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.result-display .legend-dot.is-correct { background: #22c55e; }
.result-display .legend-dot.is-incorrect { background: #ef4444; }


.timing-grid {
  gap: 14px;
}

.timing-help {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}


@media (max-width: 720px) {
  .compact-inline-setting {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .compact-inline-control,
  .compact-inline-short .compact-inline-control,
  .compact-inline-score .compact-inline-control {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 560px) {
  :root {
    --label-scale-small-factor: var(--label-scale-auto-factor);
  }

  body {
    padding: 8px;
  }

  .app-shell {
    gap: 10px;
  }

  .topbar,
  .panel {
    padding: 10px;
    border-radius: 16px;
  }

  .topbar {
    gap: 10px;
  }

  .toolbar {
    gap: 8px;
  }

  .button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .panel-heading {
    margin-bottom: 10px;
    gap: 10px;
  }

  .game-card {
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
  }

  .game-header,
  .image-zone,
  .label-zone,
  .result-zone {
    border-radius: 12px;
  }

  .game-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .game-header h2 {
    font-size: clamp(1.02rem, 5vw, 1.25rem);
  }

  .instructions {
    margin-top: 4px;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .game-body {
    gap: 8px;
  }

  .side-stack {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .image-zone {
    padding: 8px;
  }

  .label-zone {
    padding: 8px;
  }

  .label-zone-header {
    margin-bottom: 8px;
    gap: 8px;
  }

  .label-pool {
    min-height: 0;
    max-height: 30vh;
    overflow: auto;
    gap: 8px;
    padding-right: 4px;
  }

  .label-chip {
    min-height: calc(36px * var(--label-scale) * var(--label-scale-small-factor));
    max-width: 100%;
    padding: calc(8px * var(--label-scale) * var(--label-scale-small-factor)) calc(10px * var(--label-scale) * var(--label-scale-small-factor));
  }

  .result-display {
    margin-top: 8px;
    min-height: 100px;
    padding: 10px;
  }

  .result-main {
    font-size: 0.96rem;
  }

  .panel-sidebar {
    gap: 10px;
  }

  .sidebar-summary {
    padding: 10px;
    gap: 10px;
  }

  .sidebar-body {
    gap: 10px;
    padding: 0 10px 10px;
  }

  .point-row,
  .score-rule-row {
    padding: 8px;
    gap: 8px;
  }
}



.app-credit {
  margin: -4px 0 2px;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(241, 245, 249, 0.78);
}

.app-credit a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px dotted rgba(255,255,255,0.5);
}

.app-credit .brand-link:hover {
  color: #9eb721;
  border-bottom: none;
  text-decoration: none;
}


.app-meta-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.88);
}

.app-credit {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88);
}

.app-credit a,
.editor-share-strip a {
  color: #ffffff;
  text-decoration: none;
}

.app-credit .brand-link:hover {
  color: #9eb721;
  text-decoration: none;
}

.editor-share-strip a:hover {
  text-decoration: underline;
}


.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: inline-block;
  width: 44.8px;
  height: 44.8px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.editor-share-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
}

.editor-share-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.74);
}

.editor-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.55);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  color: #0f172a;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background-color .14s ease, color .14s ease;
  cursor: pointer;
}

.share-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.16);
  border-color: rgba(148, 163, 184, 0.88);
}

.share-link {
  color: #0f172a;
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.share-icon-link {
  width: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
}

.share-icon {
  width: 15px;
  height: 15px;
  display: block;
}

/* Social icons: monochrome at rest, official brand colors on hover */
.share-icon-link {
  color: #0f172a;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
}

#editorShareFacebookLink:hover {
  color: #ffffff;
  background: #1877f2;
  border-color: #1877f2;
}

#editorShareXLink:hover {
  color: #ffffff;
  background: #000000;
  border-color: #000000;
}

#editorShareLinkedInLink:hover {
  color: #ffffff;
  background: #0a66c2;
  border-color: #0a66c2;
}

@media (max-width: 960px) {
  .app-meta-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  display: inline-block;
  width: 44.8px;
  height: 44.8px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

.editor-share-strip {
    justify-content: flex-start;
  }
}
