:root {
  --bg: #0f1114;
  --surface: #1a1d23;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #7c9cff;
  --accent-dim: #5a7ae0;
  --border: #2d323c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.top {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.top h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.main {
  padding: 1rem 1.25rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

/* Same width as the square viewer; centers on the page */
.photo-column {
  width: min(100%, min(85vw, min(70vh, 560px)));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.photo-column__steps {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.photo-column__step {
  display: block;
}

.photo-column__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

label.btn-block {
  margin: 0;
}

.choppy {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.choppy input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Full-width row under Enhance; easy to tap, clearly secondary */
.choppy--below {
  display: flex;
  width: 100%;
  justify-content: center;
  padding: 0.35rem 0 0;
  margin: 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  border-color: var(--accent-dim);
  background: linear-gradient(180deg, #2a3140, #222831);
}

.btn.accent {
  border-color: var(--accent);
  background: linear-gradient(180deg, #35406a, #2a3355);
  font-weight: 600;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.placeholder {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

.stage.has-image .placeholder {
  display: none !important;
}

#view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#view:active {
  cursor: grabbing;
}

.status--error {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: #f5a8a8;
  line-height: 1.4;
}

.gif-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gif-modal[hidden] {
  display: none !important;
}

.gif-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.gif-modal__panel {
  position: relative;
  z-index: 1;
  max-width: 22rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem 1.25rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.gif-modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.gif-modal__preview {
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.gif-modal__preview img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  touch-action: manipulation;
  -webkit-touch-callout: default;
}

.gif-modal__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.gif-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gif-modal__actions .btn {
  text-decoration: none;
  text-align: center;
}
