@font-face {
  font-family: 'Montserrat';
  font-weight: 100 900;
  font-display: swap;
  src: url(../assets/fonts/montserrat-latin.woff2) format('woff2');
}

@font-face {
  font-family: 'Exo 2';
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/exo2-latin.woff2) format('woff2');
}

:root {
  --bg: #0b0c0f;
  --surface: #17191e;
  --surface-2: #23262d;
  --text: #f4f5f7;
  --muted: #9aa3ae;
  --accent: #ffffff;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

button, input, select { font: inherit; color: inherit; }

.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 0 12px;
}
.header-logo { height: 26px; }

.icon-button {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-button svg { width: 26px; height: 26px; fill: var(--text); }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 8px;
}
/* Width and height are set from JS to the largest 2:3 box that fits. */
.stage canvas {
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.countdown {
  position: absolute;
  font-size: 160px;
  font-weight: 700;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
  animation: pulse 1s ease-out infinite;
}
@keyframes pulse { from { transform: scale(1.3); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }

.flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
.flash.active { animation: flash 0.35s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

.zoom-label {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font-weight: 700;
}

.stage-message, .stage-hint {
  position: absolute;
  bottom: 16px;
  margin: 0 32px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.7);
  text-align: center;
  font-size: 14px;
}
.stage-hint { color: var(--muted); background: transparent; bottom: -4px; font-size: 12px; }

.controls { padding: 6px 12px 16px; }

.zoom-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 8px;
}
.chips { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surface); }
.chips:empty { display: none; }
.chip {
  min-width: 40px; height: 36px;
  padding: 0 8px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px; font-weight: 700;
}
.chip.active { background: var(--surface-2); color: var(--text); }

.lens-select {
  height: 40px;
  max-width: 200px;
  padding: 0 12px;
  border: 0; border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}

.shutter-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.round-button {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.round-button svg { width: 26px; height: 26px; fill: currentColor; }

.shutter {
  width: 78px; height: 78px;
  border: 5px solid var(--accent);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--bg);
  cursor: pointer;
  transition: transform 0.1s;
}
.shutter:active { transform: scale(0.92); }
.shutter:disabled { opacity: 0.4; }

.review-controls { display: flex; gap: 10px; }
.review-controls .button { flex: 1; padding: 0 12px; }
.review-controls .button.primary { flex: 1.4; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
}
.button.primary { background: var(--accent); color: #111317; }
.button.secondary { background: var(--surface-2); }
.button.ghost { background: transparent; color: var(--muted); }
.button.small { height: 40px; font-size: 14px; padding: 0 14px; }
.button:disabled { opacity: 0.5; }

dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

.settings { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.settings h2 { margin: 0; font-size: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-weight: 500; }
.field input[type="text"] {
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--surface-2);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px;
  user-select: text;
}

.toggle { flex-direction: row; align-items: center; gap: 10px; }
.toggle input { width: 22px; height: 22px; accent-color: #ffffff; }
.toggle em { margin-left: auto; color: var(--muted); font-style: normal; font-weight: 500; }

.logo-picker { display: flex; align-items: center; gap: 10px; }
.logo-preview {
  width: 96px; height: 56px;
  border-radius: 10px;
  background: #ffffff center / contain no-repeat;
  background-origin: content-box;
  padding: 6px;
}
.logo-preview:not([style*="url"]) { background: var(--bg); border: 1px dashed var(--surface-2); }

.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); }
.segmented button {
  flex: 1; height: 40px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.segmented button.active { background: var(--surface-2); color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #111317;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 10;
}
