*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a12;
  color: #f0f0f5;
  font-family: system-ui, -apple-system, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#gallery-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#touch-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  touch-action: none;
}

#touch-overlay.active {
  pointer-events: auto;
}

.joy-zone,
.look-zone {
  position: absolute;
  touch-action: none;
}

.joy-zone {
  left: 0;
  bottom: 0;
  width: 40%;
  height: 55%;
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
}

.look-zone {
  right: 0;
  top: 0;
  width: 60%;
  height: 100%;
  padding-right: env(safe-area-inset-right, 0);
}

.joystick-base {
  position: absolute;
  left: 50%;
  bottom: 28%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
  transition: opacity 0.15s;
}

.joystick-base.visible {
  opacity: 1;
}

.joystick-stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(5, 5, 15, 0.75);
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
}

#start-overlay h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hint-small {
  font-size: 0.85rem;
  opacity: 0.65;
  max-width: 280px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

#auth-panel {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  width: min(320px, 92vw);
  padding: 1rem;
  background: rgba(12, 12, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

#auth-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.auth-error {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(180, 40, 40, 0.35);
  border: 1px solid rgba(255, 120, 120, 0.45);
  font-size: 0.9rem;
  line-height: 1.35;
}

.auth-status {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.75;
}

#auth-panel input {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  font-size: 1rem;
}

#auth-panel button {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  background: #4a6cf7;
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
}

#auth-panel button[type="button"] {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#guest-mode {
  margin-top: 0.75rem;
  opacity: 0.85;
  font-size: 0.85rem;
}

#reenter-btn {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(12, 12, 22, 0.92);
  backdrop-filter: blur(8px);
  color: #f0f0f5;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s;
}

#reenter-btn:hover {
  background: rgba(24, 24, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.35);
}

#status-bar {
  position: fixed;
  top: env(safe-area-inset-top, 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  pointer-events: none;
}

#status-bar.with-reenter {
  top: calc(env(safe-area-inset-top, 12px) + 2.6rem);
}

#upload-progress {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 8px) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  pointer-events: none;
  max-width: min(90vw, 28rem);
  text-align: center;
}

#settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 17;
  background: rgba(4, 4, 12, 0.55);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#settings-backdrop.open {
  opacity: 1;
}

#settings-menu {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  right: env(safe-area-inset-right, 12px);
  z-index: 18;
}

#settings-menu-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(12, 12, 22, 0.92);
  backdrop-filter: blur(8px);
  color: #f0f0f5;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, border-color 0.15s;
}

#settings-menu-btn:hover,
#settings-menu-btn.active {
  background: rgba(24, 24, 40, 0.95);
  border-color: rgba(255, 255, 255, 0.35);
}

#settings-menu-btn.active {
  border-color: rgba(74, 108, 247, 0.7);
  box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.25);
}

#settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 19;
  width: min(320px, 86vw);
  padding:
    calc(env(safe-area-inset-top, 12px) + 1rem)
    calc(env(safe-area-inset-right, 12px) + 1rem)
    calc(env(safe-area-inset-bottom, 12px) + 1rem)
    1rem;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background:
    linear-gradient(165deg, rgba(28, 30, 52, 0.97), rgba(10, 10, 20, 0.98)),
    rgba(12, 12, 22, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(105%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

#settings-panel.open {
  transform: translateX(0);
}

.settings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.settings-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0;
}

#settings-close-btn,
#share-modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #f0f0f5;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

#settings-close-btn:hover,
#share-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.settings-user {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 1.1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.settings-user-label {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
}

.settings-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #4a6cf7;
  cursor: pointer;
}

.settings-hint {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.6;
}

.settings-action {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(74, 108, 247, 0.55);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(74, 108, 247, 0.95), rgba(96, 70, 210, 0.92));
  color: white;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(40, 60, 180, 0.35);
}

.settings-action:hover {
  filter: brightness(1.08);
}

#share-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

#share-modal.hidden {
  display: none !important;
}

#share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 12, 0.62);
  backdrop-filter: blur(3px);
}

.share-modal-card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(30, 32, 56, 0.98), rgba(12, 12, 22, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.share-modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.share-modal-hint {
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.7;
}

.share-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.share-choice:hover {
  background: rgba(74, 108, 247, 0.18);
  border-color: rgba(74, 108, 247, 0.55);
}

.share-choice:active {
  transform: scale(0.985);
}

.share-choice-title {
  font-size: 0.98rem;
  font-weight: 600;
}

.share-choice-desc {
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0.65;
}

.share-copy-feedback {
  margin-top: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(48, 140, 90, 0.28);
  border: 1px solid rgba(110, 220, 150, 0.35);
  font-size: 0.85rem;
  line-height: 1.35;
  word-break: break-all;
  -webkit-user-select: text;
  user-select: text;
}

.share-copy-feedback.error {
  background: rgba(180, 40, 40, 0.35);
  border-color: rgba(255, 120, 120, 0.45);
}

#floorplan-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

#floorplan-modal.hidden {
  display: none !important;
}

#floorplan-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 12, 0.62);
  backdrop-filter: blur(3px);
}

.floorplan-card {
  position: relative;
  z-index: 1;
  width: min(720px, 92vw);
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(30, 32, 56, 0.98), rgba(12, 12, 22, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.floorplan-stage {
  position: relative;
}

#floorplan-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: rgba(8, 8, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: default;
  touch-action: none;
}

#floorplan-canvas.interactive {
  cursor: pointer;
}

.floorplan-toggles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floorplan-toggles.hidden {
  display: none !important;
}

.floorplan-room-toggle {
  position: absolute;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.floorplan-room-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: #4a6cf7;
  cursor: pointer;
}

.floorplan-room-toggle input:disabled {
  cursor: wait;
  opacity: 0.55;
}

.floorplan-room-toggle.is-lobby input {
  cursor: not-allowed;
}

.floorplan-label {
  min-height: 1.2em;
  margin-top: 0.65rem;
  font-size: 0.85rem;
  line-height: 1.35;
  opacity: 0.75;
  text-align: center;
}

.floorplan-feedback {
  min-height: 1.2em;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #ffb4b4;
  text-align: center;
}

.floorplan-feedback.hidden {
  display: none !important;
}

#room-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#room-editor-modal.hidden {
  display: none;
}

#room-editor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.room-editor-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 1.25rem 1.35rem 1.35rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 28, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

#room-editor-canvas {
  display: block;
  width: 100%;
  height: min(52vw, 320px);
  min-height: 220px;
  margin-top: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  touch-action: none;
  cursor: crosshair;
}

.room-editor-label {
  min-height: 1.2em;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.75;
  text-align: center;
}

.room-editor-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.room-editor-palette button {
  flex: 1 1 calc(50% - 0.45rem);
  min-width: 7rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.room-editor-palette button:hover {
  background: rgba(74, 108, 247, 0.22);
  border-color: rgba(74, 108, 247, 0.55);
}

.room-editor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.room-editor-actions button {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.room-editor-secondary {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.room-editor-primary {
  border: none;
  background: rgba(74, 108, 247, 0.92);
  color: #fff;
  font-weight: 500;
}

.room-editor-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.room-editor-feedback {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  text-align: center;
  color: #8bdc9a;
}

.room-editor-feedback.error {
  color: #f08080;
}

.room-editor-feedback.hidden {
  display: none;
}

#multiupload-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

#multiupload-modal.hidden {
  display: none !important;
}

#multiupload-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 12, 0.62);
  backdrop-filter: blur(3px);
}

.multiupload-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(30, 32, 56, 0.98), rgba(12, 12, 22, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.multiupload-steps {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
}

.multiupload-step.hidden {
  display: none !important;
}

.multiupload-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.multiupload-file-actions button {
  flex: 1 1 auto;
  min-width: 8rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.multiupload-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.55rem;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 0.15rem;
}

.multiupload-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 140px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.multiupload-thumb img {
  display: block;
  max-width: 100%;
  max-height: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.multiupload-thumb-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: 999px;
  background: rgba(20, 12, 12, 0.78);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.multiupload-thumb-remove:hover {
  background: rgba(180, 40, 40, 0.9);
}

.multiupload-image-count {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  opacity: 0.7;
}

.multiupload-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.multiupload-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.multiupload-option:has(input:checked) {
  border-color: rgba(74, 108, 247, 0.55);
  background: rgba(74, 108, 247, 0.16);
}

.multiupload-option input {
  margin-top: 0.2rem;
  accent-color: #4a6cf7;
}

.multiupload-option-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.multiupload-option-desc {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.35;
  opacity: 0.65;
}

.multiupload-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.multiupload-actions button {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.multiupload-actions button.hidden {
  display: none !important;
}

.multiupload-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#text-element-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#text-element-modal.hidden {
  display: none;
}

#text-element-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.72);
}

.text-element-card {
  position: relative;
  width: min(440px, 100%);
  max-height: min(90vh, 640px);
  overflow: auto;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: 14px;
  background: #1a1917;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f0ebe3;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.text-element-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: #c8c2b8;
}

.text-element-field textarea,
.text-element-field select,
.text-element-field input[type="color"] {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #121110;
  color: #f0ebe3;
  font: inherit;
  padding: 0.55rem 0.65rem;
}

.text-element-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.text-element-field input[type="color"] {
  padding: 0.2rem;
  height: 2.4rem;
  cursor: pointer;
}

.text-element-count {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #9a958c;
  text-align: right;
}

.text-element-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr;
  gap: 0.65rem;
}

.text-element-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.text-element-actions button {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.text-element-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .text-element-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  #settings-backdrop,
  #settings-panel,
  .share-choice {
    transition: none;
  }
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10;
  width: 24px;
  height: 24px;
  margin: -12px;
  pointer-events: none;
}

.crosshair-h,
.crosshair-v {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.crosshair-h {
  left: 0;
  top: 50%;
  width: 100%;
  height: 2px;
  margin-top: -1px;
}

.crosshair-v {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
}

#frame-select-btn {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 16px) + 16px);
  transform: translateX(-50%);
  z-index: 12;
  padding: 0.7rem 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(74, 108, 247, 0.92);
  color: white;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

#frame-select-btn:active {
  transform: translateX(-50%) scale(0.97);
}
