:root {
  color-scheme: light;
  --page-bg: #f5f1e8;
  --page-tint: #ece4d6;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(248, 244, 236, 0.86);
  --border: rgba(49, 41, 24, 0.12);
  --border-strong: rgba(49, 41, 24, 0.18);
  --text: #251f12;
  --muted: #6d6248;
  --accent: #87683a;
  --accent-strong: #6e5227;
  --shadow: 0 16px 38px rgba(52, 40, 19, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --stage-aspect: 1.2;
  --mount-padding: 7%;
  --arrangement-size: 1600px;
  --library-panel-width: 320px;
  --pool-tile-size: 104px;
  --pool-tile-size-responsive: 128px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 38%),
    linear-gradient(145deg, var(--page-bg), var(--page-tint));
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(117, 95, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 95, 54, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.55;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1760px, calc(100vw - 24px));
  height: calc(100dvh - 24px);
  margin: 12px auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.layout-code-shell {
  flex: 1 1 420px;
  min-width: 260px;
  display: flex;
  align-items: center;
}

.layout-code-input {
  width: 100%;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0.78rem 1rem;
  box-shadow: 0 10px 24px rgba(47, 38, 24, 0.08);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layout-code-input:focus {
  outline: none;
  border-color: rgba(135, 104, 58, 0.45);
  box-shadow: 0 0 0 3px rgba(135, 104, 58, 0.16), 0 10px 24px rgba(47, 38, 24, 0.08);
}

.layout-code-input.is-invalid {
  border-color: rgba(132, 42, 32, 0.45);
  background: rgba(255, 248, 246, 0.95);
}

.language-switcher-shell {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.language-switcher-shell.floating {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 90;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.72rem 0.9rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(47, 38, 24, 0.08);
}

.language-switcher-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.language-switcher-select {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.language-switcher-select:focus {
  outline: none;
}

.topbar > .button {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  justify-content: center;
}

.topbar #logoutButton {
  margin-left: 0 !important;
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.button.primary {
  background: var(--accent);
  color: #fffaf1;
  box-shadow: 0 10px 24px rgba(126, 90, 35, 0.25);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(47, 38, 24, 0.08);
}

.button.secondary:hover {
  border-color: var(--border-strong);
}

.upload-button {
  position: relative;
  overflow: hidden;
}

.panel {
  min-height: 0;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.workspace-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 28vw, var(--library-panel-width));
  gap: 12px;
}

.stage-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
}

.stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.grid-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.grid-size-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  text-align: center;
}

.grid-size-label {
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.stepper strong {
  min-width: 2ch;
  text-align: center;
  font-size: 1rem;
}

.stepper-button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border);
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.stepper-button:hover:not(:disabled) {
  background: var(--accent);
  color: #fffaf1;
  transform: translateY(-1px);
}

.stepper-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.status-text {
  margin: 0;
  flex: 1 1 220px;
  min-width: 180px;
  text-align: right;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.export-tasks-shell {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.export-tasks-panel {
  position: relative;
  top: auto;
  right: auto;
  z-index: 55;
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 10px 12px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 238, 228, 0.88));
  border: 1px solid rgba(49, 41, 24, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 8px 20px rgba(39, 30, 18, 0.08);
  backdrop-filter: blur(12px);
}

.export-tasks-dock {
  appearance: none;
  display: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border: 1px solid rgba(49, 41, 24, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 238, 228, 0.84));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.4),
    0 6px 18px rgba(39, 30, 18, 0.06);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.export-tasks-dock strong {
  font-size: 0.88rem;
}

.export-tasks-dock-summary {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
}

.export-tasks-panel[hidden] {
  display: none;
}

.export-tasks-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.export-tasks-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 0.5rem 0.85rem;
}

.export-tasks-header strong {
  font-size: 0.98rem;
}

.export-tasks-summary {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.export-tasks-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.export-tasks-body {
  display: grid;
  gap: 10px;
  max-height: min(24dvh, 220px);
  overflow: auto;
  padding-right: 2px;
}

.export-tasks-panel.is-collapsed {
  gap: 0;
}

.export-tasks-dock:not([hidden]) {
  display: inline-flex;
}

.export-task {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(250, 247, 241, 0.94);
  border: 1px solid rgba(109, 98, 72, 0.14);
}

.export-task-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.export-task-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.export-task-state {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.export-task-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(135, 104, 58, 0.12);
  box-shadow: inset 0 0 0 1px rgba(109, 98, 72, 0.08);
}

.export-task-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #87683a, #c39759);
  transition: width 180ms ease;
}

.export-task-fill.indeterminate {
  width: 35% !important;
  animation: export-progress-indeterminate 1.1s ease-in-out infinite;
}

.export-task-fill.complete {
  background: linear-gradient(90deg, #5f7f3d, #82ab51);
}

.export-task-fill.failed {
  background: linear-gradient(90deg, #a04634, #c66b54);
}

.export-task-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.export-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@keyframes export-progress-indeterminate {
  0% {
    transform: translateX(-70%);
  }
  50% {
    transform: translateX(45%);
  }
  100% {
    transform: translateX(170%);
  }
}

.stage-board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: calc(var(--radius-xl) - 6px);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.88), rgba(242, 235, 223, 0.84));
  border: 1px solid rgba(73, 57, 28, 0.08);
  overflow: hidden;
}

.mount-preview {
  width: min(100%, var(--arrangement-size));
  max-width: 100%;
  aspect-ratio: var(--stage-aspect);
  padding: var(--mount-padding);
  min-height: 0;
  display: flex;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(241, 235, 226, 0.95));
  border-radius: clamp(12px, 1.5vw, 22px);
  box-shadow: 0 18px 40px rgba(47, 35, 16, 0.12);
}

.mount-board {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: clamp(2px, 0.28vw, 4px);
  border-radius: clamp(8px, 0.9vw, 14px);
  background: linear-gradient(145deg, #f7f1e6, #ece0ce);
}

.stage-board-wrap.is-frame-zoomed {
  display: block;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.stage-board-wrap.is-frame-zoomed .mount-preview {
  max-width: none;
}

.stage-board-wrap.is-frame-zoomed .grid-cell {
  touch-action: pan-x pan-y;
}

.grid-board {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: clamp(2px, 0.28vw, 6px);
  align-items: stretch;
  justify-items: stretch;
}

.grid-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  border-radius: clamp(4px, 0.5vw, 8px);
  border: 1px dashed rgba(96, 76, 44, 0.12);
  background: rgba(255, 255, 255, 0.48);
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.grid-cell::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

.grid-cell.filled {
  border-color: rgba(96, 76, 44, 0.06);
  background: rgba(255, 255, 255, 0.14);
}

.grid-cell.filled::after {
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.grid-cell.drag-over {
  border-color: rgba(135, 104, 58, 0.65);
  background: rgba(237, 223, 198, 0.9);
  transform: scale(1.01);
}

.grid-cell.is-dragging {
  opacity: 0.5;
}

.grid-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(91, 76, 50, 0.55);
  font-weight: 600;
  font-size: clamp(0.8rem, 1vw, 0.95rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grid-empty::before {
  content: "+";
  font-size: clamp(1.5rem, 2vw, 2rem);
  line-height: 1;
}

.grid-item {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.grid-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.grid-item img.is-flipped {
  transform: scaleX(-1);
}

.grid-item-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.grid-item-action {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(37, 31, 18, 0.72);
  color: #fffaf1;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    transform 140ms ease;
}

.grid-item-action svg {
  width: 15px;
  height: 15px;
  display: block;
}

.grid-item-action:hover {
  background: rgba(37, 31, 18, 0.9);
  transform: scale(1.05);
}

.grid-item-flip.is-active {
  background: rgba(135, 104, 58, 0.88);
}

.grid-item-remove {
  background: rgba(132, 42, 32, 0.82);
}

.grid-item-remove:hover {
  background: rgba(132, 42, 32, 0.94);
}

.mobile-tile-actions {
  position: fixed;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: 156px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 251, 243, 0.98);
  border: 1px solid rgba(49, 41, 24, 0.12);
  box-shadow: 0 20px 36px rgba(39, 30, 18, 0.18);
}

.mobile-tile-actions[hidden] {
  display: none;
}

.mobile-tile-actions .button {
  width: 100%;
  justify-content: center;
}

.mobile-tile-actions .button.danger {
  background: rgba(132, 42, 32, 0.12);
  border-color: rgba(132, 42, 32, 0.18);
  color: #842a20;
}

.empty-stage-hint {
  position: absolute;
  inset: auto 0 18px;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 0 16px;
}

.empty-stage-hint[hidden] {
  display: none;
}

.empty-stage-hint p {
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(49, 41, 24, 0.1);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 8px 24px rgba(39, 30, 18, 0.08);
}

.library-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 14px 14px 16px;
}

.library-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
}

.library-close-button,
.mobile-library-toggle {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.library-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.library-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.pool-grid {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pool-tile-size-responsive), 1fr));
  gap: 10px;
  align-content: start;
}

.pool-grid:empty::after {
  content: attr(data-empty-message);
  padding: 14px;
  text-align: center;
  color: var(--muted);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 1px var(--border);
}

.pool-tile {
  position: relative;
  appearance: none;
  width: 100%;
  padding: 3px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(49, 41, 24, 0.08),
    0 12px 24px rgba(39, 30, 18, 0.08);
  cursor: grab;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.pool-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(49, 41, 24, 0.1),
    0 18px 28px rgba(39, 30, 18, 0.12);
}

.pool-tile.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.pool-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 11px;
}

.pool-tile::after {
  content: attr(data-add-label);
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(37, 31, 18, 0.7);
  color: #fffaf1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.pool-tile:hover::after,
.pool-tile:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.pool-tile-used-indicator {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(46, 101, 55, 0.92);
  color: #fffaf1;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(46, 101, 55, 0.2);
  pointer-events: none;
}

.pool-tile.is-used {
  box-shadow:
    inset 0 0 0 1px rgba(46, 101, 55, 0.28),
    0 14px 26px rgba(39, 30, 18, 0.1);
}

.pool-tile:focus-visible {
  outline: 2px solid rgba(135, 104, 58, 0.35);
  outline-offset: 2px;
}

.mobile-touch-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(49, 41, 24, 0.1),
    0 18px 34px rgba(39, 30, 18, 0.18);
  pointer-events: none;
  z-index: 80;
}

.mobile-touch-drag-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reveal {
  animation: fade-up 420ms ease both;
}

.reveal-delay-2 {
  animation-delay: 80ms;
}

.reveal-delay-3 {
  animation-delay: 140ms;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .layout-code-shell {
    flex: 1 0 100%;
    order: 10;
    min-width: 0;
  }

  .grid-item-controls {
    display: none;
  }

  .page-shell {
    width: min(calc(100vw - 20px), 1500px);
    height: calc(100dvh - 20px);
    min-height: calc(100dvh - 20px);
    margin: 10px auto;
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-panel {
    min-height: 0;
  }

  .library-panel {
    position: fixed;
    top: clamp(132px, 24dvh, 260px);
    right: 10px;
    bottom: 12px;
    width: min(320px, calc(100vw - 68px));
    min-height: 0;
    max-width: calc(100vw - 68px);
    z-index: 30;
    box-shadow: 0 22px 44px rgba(39, 30, 18, 0.18);
    transform: translateX(calc(100% + 22px));
    opacity: 0;
    pointer-events: none;
    animation: none;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  body.mobile-library-mode .library-panel.is-mobile-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-library-toggle {
    position: fixed;
    right: 12px;
    bottom: 14px;
    z-index: 31;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    box-shadow: 0 18px 36px rgba(39, 30, 18, 0.18);
  }

  body.mobile-library-open .mobile-library-toggle {
    background: var(--accent);
    color: #fffaf0;
  }

  body.mobile-pool-dragging .mobile-library-toggle {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 720px) {
  .language-switcher-shell.floating {
    top: 8px;
    right: 8px;
  }

  .language-switcher {
    padding: 0.62rem 0.8rem;
  }

  .language-switcher-label {
    display: none;
  }

  .page-shell {
    width: min(calc(100vw - 16px), 1200px);
    min-height: calc(100dvh - 16px);
    margin: 8px auto;
    gap: 10px;
  }

  .topbar {
    gap: 8px;
  }

  .layout-code-input {
    padding: 0.72rem 0.88rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
  }

  .topbar .button {
    min-width: 0;
    justify-content: center;
    text-align: center;
    padding-inline: 0.85rem;
  }

  .topbar #logoutButton {
    margin-left: 0 !important;
  }

  .stage-header {
    align-items: flex-start;
  }

  .status-text {
    text-align: left;
    white-space: normal;
  }

  .export-tasks-panel.is-collapsed {
    display: none;
  }

  .export-tasks-shell {
    margin-bottom: 6px;
  }

  .grid-controls {
    width: 100%;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .grid-size-control {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    align-items: center;
  }

  .export-tasks-panel {
    top: auto;
    right: 8px;
    bottom: 72px;
    left: 8px;
    width: auto;
    max-height: min(42dvh, 420px);
  }

  .export-tasks-body {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .export-tasks-list {
    grid-template-columns: 1fr;
  }

  .pool-grid {
    grid-template-columns: repeat(auto-fill, minmax(max(84px, calc(var(--pool-tile-size) - 12px)), 1fr));
  }
}