/* Image Octopus v11: consistent controls, guided story flow, multi-look output. */
:root { --io-control-font: 15px; }
button, input, select, textarea { font-family: inherit; }
.choose-btn, .preview-btn, .action-btn, .flow-picker-btn,
.emoji-picker-btn, .wizard-button, .look-action, .looks-generate {
  font-size: var(--io-control-font);
  line-height: 1.3;
  text-align: center;
  font-weight: 800;
}
.choose-btn, .preview-btn, .action-btn, .emoji-picker-btn,
.wizard-button, .look-action, .looks-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.flow-picker-btn { align-items: center; }
#headlineInput, #namesInput, #locationInput, #dateInput { font-size: 16px; line-height: 1.35; }
#dateInput {
  display: block;
  width: 100%;
  min-height: 52px;
  background: linear-gradient(180deg,rgba(255,255,255,.15),rgba(255,255,255,.06));
  color: white;
  color-scheme: dark;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  padding: 11px 13px;
  outline: none;
}
#dateInput:focus-visible, button:focus-visible, .wizard-input:focus-visible,
.look-action:focus-visible, .looks-generate:focus-visible {
  outline: 3px solid #80bfff;
  outline-offset: 3px;
}
.io-actions { margin: 12px 0 0; display: grid; gap: 9px; }
.io-actions .io-secondary {
  width: 100%; min-height: 44px; border: 1px solid rgba(255,255,255,.23);
  border-radius: 15px; background: rgba(255,255,255,.10); color: white;
}
.io-muted { font-size: 12px; line-height: 1.45; color: #d6def0; margin: 4px 0 0; }
.wizard-modal[hidden], .looks-output[hidden] { display: none !important; }
.wizard-modal {
  position: fixed; inset: 0; z-index: 10010;
  display: grid; place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  background: rgba(4,8,18,.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.wizard-dialog {
  position: relative; width: min(100%, 440px); max-height: 90dvh; overflow-y: auto;
  border-radius: 25px; padding: 26px 22px 22px;
  background: linear-gradient(160deg,#263552 0%,#101725 75%);
  border: 1px solid rgba(255,255,255,.24);
  box-shadow: 0 32px 80px rgba(0,0,0,.62);
  color: #fff;
}
.wizard-kicker { margin: 0 0 10px; font-size: 12px; font-weight: 800; color: #abd2ff; letter-spacing: .09em; text-transform: uppercase; }
.wizard-title { font-size: clamp(23px, 5vw, 29px); line-height: 1.17; margin: 0 38px 10px 0; font-weight: 800; }
.wizard-help { font-size: 14px; line-height: 1.5; min-height: 42px; color: #d8e4f5; margin: 0 0 16px; }
.wizard-progress { height: 5px; background: rgba(255,255,255,.14); border-radius: 999px; margin: 0 0 22px; overflow: hidden; }
.wizard-progress-fill { display: block; height: 100%; width: 25%; background: linear-gradient(90deg,#4da3ff,#87e7dd); transition: width 180ms ease; }
.wizard-input {
  display: block; width: 100%; min-height: 54px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.28); background: #111e31;
  color: white; color-scheme: dark; font-size: 17px; padding: 12px 15px;
}
.wizard-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0 0; }
.wizard-button {
  border: 1px solid rgba(255,255,255,.24); border-radius: 15px;
  min-height: 52px; color: #fff; background: rgba(255,255,255,.12);
}
.wizard-button.primary { background: linear-gradient(135deg,#2785ff,#635de9); border-color: #75b5ff; }
.wizard-close { position: absolute; right: 15px; top: 14px; width: 38px; height: 38px;
  border: 1px solid rgba(255,255,255,.20); border-radius: 50%;
  background: rgba(255,255,255,.09); color: #fff; font-size: 21px; }
.looks-panel { margin-top: 12px; padding: 14px; border-radius: 17px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.13); }
.looks-title { margin: 0 0 9px; font-size: 17px; font-weight: 850; }
.looks-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.looks-count { min-height: 46px; flex: 0 0 90px; color: white; background: #182336;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.22); padding: 10px; }
.looks-generate { min-height: 46px; flex: 1; padding: 10px 12px; color: white;
  border: 1px solid rgba(255,255,255,.20); border-radius: 12px; background: linear-gradient(135deg,#2563eb,#6d56d9); }
.looks-generate:disabled { opacity: .5; cursor: not-allowed; }
.looks-output { margin-top: 14px; }
.looks-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.look-card { min-width: 0; padding: 7px; border-radius: 12px; background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.15); }
.look-image { display: block; width: 100%; height: 124px; object-fit: contain; background: #121621; border-radius: 8px; }
.look-label { font-size: 12px; margin: 8px 0; color: white; text-align: center; font-weight: 800; }
.look-action { min-height: 36px; width: 100%; padding: 7px 3px; margin-top: 5px;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.17); border-radius: 9px; font-size: 12px; }
.looks-download { width: 100%; min-height: 45px; padding: 9px; margin-top: 12px;
  border-radius: 12px; border: 1px solid #83c3ff; background: rgba(39,133,255,.25); color: white; font-size: 14px; font-weight: 850; }
.looks-status { margin: 10px 0 0; font-size: 12px; color: #d6def0; line-height: 1.45; }
@media (max-width: 520px) {
  .wizard-dialog { padding: 24px 18px 20px; }
  .looks-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .look-image { height: 142px; }
}
@media (prefers-reduced-motion: reduce) { .wizard-progress-fill { transition: none; } }

/* v11.1: flexible typography and style browser */
.io-type-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.io-type-row label { margin:0; }
.io-type-value { min-width:54px; padding:6px 9px; border-radius:10px; font-size:14px; font-weight:800; background:rgba(255,255,255,.12); text-align:center; }
.io-type-scale { display:flex; align-items:center; gap:12px; }
.io-type-scale .io-type-small { font-size:12px; color:var(--muted); }
.io-type-scale .io-type-large { font-size:21px; font-weight:800; }
#ioTextSize { flex:1; min-width:0; width:100%; height:32px; accent-color:#72bbff; cursor:pointer; }
.io-type-caption { margin:8px 0 0; color:#d6def0; line-height:1.4; font-size:12px; }
.io-style-open { width:100%; min-height:48px; margin-top:10px; background:linear-gradient(140deg,#2563eb,#6353e1); border:1px solid rgba(255,255,255,.26); border-radius:15px; color:#fff; font-size:15px; font-weight:800; }
.io-style-open[disabled] { opacity:.5; cursor:not-allowed; }
.io-style-modal[hidden] { display:none !important; }
.io-style-modal { position:fixed; inset:0; z-index:10012; padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); background:rgba(3,7,17,.83); backdrop-filter:blur(11px); -webkit-backdrop-filter:blur(11px); display:flex; align-items:center; justify-content:center; }
.io-style-dialog { width:min(100%,740px); max-height:93dvh; min-height:0; display:flex; flex-direction:column; gap:12px; border:1px solid rgba(255,255,255,.22); border-radius:22px; padding:18px; background:linear-gradient(170deg,#253450,#101725 75%); box-shadow:0 34px 86px rgba(0,0,0,.62); }
.io-style-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.io-style-heading h2 { margin:0 0 5px; font-size:22px; line-height:1.15; font-weight:850; }
.io-style-heading p { color:#d8e4f5; margin:0; font-size:13px; line-height:1.4; }
.io-style-close { width:40px; height:40px; flex:0 0 40px; border-radius:50%; background:rgba(255,255,255,.10); border:1px solid rgba(255,255,255,.24); color:#fff; font-size:23px; }
.io-style-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; overflow-y:auto; overscroll-behavior:contain; padding:3px 3px 12px; }
.io-style-card { position:relative; width:100%; min-width:0; padding:8px; border:2px solid rgba(255,255,255,.22); border-radius:16px; background:rgba(255,255,255,.075); color:#fff; text-align:center; display:flex; flex-direction:column; gap:7px; align-items:center; cursor:pointer; transition:border-color .14s,background .14s; }
.io-style-card[aria-pressed="true"] { border-color:#8ec9ff; background:rgba(51,126,230,.25); }
.io-style-card:focus-visible { outline:3px solid #80cfff; outline-offset:2px; }
.io-style-thumb { width:100%; height:175px; object-fit:contain; border-radius:9px; background:#0f1622; }
.io-style-name { font-size:14px; font-weight:850; line-height:1.3; }
.io-style-selected { color:#a9d5ff; font-weight:700; font-size:11px; min-height:15px; }
.io-style-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:3px; border-top:1px solid rgba(255,255,255,.13); }
.io-style-footer small { line-height:1.3; color:#d6def0; font-size:12px; }
.io-style-done { min-width:118px; min-height:43px; border:1px solid #8ec9ff; border-radius:12px; background:#226ce0; color:#fff; font-weight:800; }
@media(max-width:560px) {
  .io-style-dialog { padding:13px; border-radius:18px; max-height:95dvh; }
  .io-style-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .io-style-thumb { height:145px; }
  .io-style-heading h2 { font-size:20px; }
  .io-style-card { padding:6px; gap:5px; }
  .io-style-footer small { font-size:11px; }
}
@media(prefers-reduced-motion:reduce) { .io-style-card { transition:none; } }

/* v11.2 — guided one-tap calendar, horizontal swipe gallery and preview gesture */
.io-gesture-hint[hidden], .io-calendar[hidden] {display:none !important}
.io-gesture-hint {
  position:absolute; z-index:16; left:50%; bottom:16px; transform:translateX(-50%);
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:max-content; max-width:calc(100% - 26px); pointer-events:none; user-select:none;
  padding:8px 12px; border-radius:14px; color:#fff;
  font-size:clamp(10px,2.75vw,13px); line-height:1.25; font-weight:700;
  text-shadow:0 1px 3px #000; white-space:nowrap;
  background:rgba(7,12,24,.82); border:1px solid rgba(255,255,255,.25);
  box-shadow:0 6px 22px rgba(0,0,0,.35);
}
.io-gesture-icon {width:27px; height:27px; flex-shrink:0; color:#e2efff}
.preview-card:not(.has-photo) .io-gesture-hint {display:none}
.preview-card.expanded .io-gesture-hint {bottom:24px}
.io-calendar {width:100%; border:1px solid rgba(255,255,255,.15); border-radius:16px; padding:12px; background:rgba(10,19,36,.38)}
.io-calendar-nav {display:grid;grid-template-columns:38px minmax(0,1.4fr) minmax(0,1fr) 38px;gap:7px;align-items:center}
.io-cal-nav {min-height:40px;border:1px solid rgba(255,255,255,.20);border-radius:11px;background:#253452;color:#fff;font-size:25px}
.io-calendar select {width:100%;min-width:0;min-height:41px;border:1px solid rgba(255,255,255,.22);border-radius:10px;background:#202d44;color:#fff;font-size:14px;padding:6px}
.io-calendar-weekdays, .io-calendar-days {display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
.io-calendar-weekdays {margin-top:12px;color:#b9c9e1;font-size:12px;text-align:center;font-weight:800}
.io-calendar-weekdays span {padding:4px 0}
.io-cal-empty {aspect-ratio:1}
.io-calendar-days button {min-width:0;aspect-ratio:1;border:1px solid transparent;border-radius:10px;background:rgba(255,255,255,.07);color:#fff;font-size:14px;font-weight:700}
.io-calendar-days button:focus-visible {outline:3px solid #b2d9ff;outline-offset:1px}
.io-calendar-days button.io-cal-current {border-color:rgba(255,255,255,.7)}
.io-calendar-days button.io-cal-selected {background:#3a8cff;box-shadow:inset 0 0 0 1px #fff}
.io-calendar-footer {display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:11px;color:#b9c9e1;font-size:12px}
.io-cal-today {border:1px solid #6daefe;border-radius:10px;background:rgba(39,117,222,.25);padding:9px 13px;color:#fff;font-weight:700}
.io-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}
.io-style-gallery {display:grid;grid-template-columns:40px minmax(0,1fr) 40px;align-items:center;gap:7px;min-height:0}
.io-style-arrow {border:1px solid rgba(255,255,255,.24);background:rgba(255,255,255,.10);border-radius:12px;width:40px;height:54px;color:#fff;font-size:32px;font-weight:300}
.io-style-arrow:disabled {opacity:.28;cursor:default}
.io-style-grid {display:flex !important;grid-template-columns:none !important;gap:0;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scroll-behavior:smooth;scrollbar-width:none;overscroll-behavior-x:contain;touch-action:pan-x pan-y;padding:3px 1px 9px}
.io-style-grid::-webkit-scrollbar {display:none}
.io-style-card {flex:0 0 100%;width:100%;scroll-snap-align:center;scroll-snap-stop:always;padding:12px;border-radius:18px;gap:8px}
.io-style-thumb {height:clamp(200px,46vh,390px);object-fit:contain;max-width:100%;width:100%;border-radius:12px}
.io-style-name {font-size:18px;font-weight:800}
.io-style-selected {font-size:12px;min-height:19px}
.io-style-pagination {display:flex;gap:15px;align-items:center;justify-content:center}
.io-style-position {font-size:13px;color:#d4e4fd;font-weight:700;white-space:nowrap}
.io-style-dots {display:flex;align-items:center;gap:7px}
.io-style-dot {width:9px;height:9px;padding:0;border-radius:50%;border:0;background:rgba(255,255,255,.31)}
.io-style-dot[aria-current="true"] {background:#8ec9ff;width:22px;border-radius:7px}
@media(max-width:560px){
 .io-style-gallery {grid-template-columns:30px minmax(0,1fr) 30px;gap:4px}
 .io-style-arrow {width:30px;height:50px;font-size:26px;border-radius:10px}
 .io-style-thumb {height:min(47dvh,350px)}
 .io-style-card {padding:8px}
 .io-style-dialog {max-height:95dvh}
 .io-gesture-hint {bottom:10px;padding:6px 9px;font-size:11px}
 .io-gesture-icon {width:23px;height:23px}
}
@media(prefers-reduced-motion:reduce){.io-style-grid{scroll-behavior:auto}}

/* Keep the original tap affordance separate from the gesture hint on mobile. */
@media (max-width:860px) {
 .preview-card:not(.expanded).has-photo .preview-tap-label {
   top:10px;
   bottom:auto;
   z-index:17;
 }
}

/* v11.3 — render modal contents only within the visible viewport.
   Safari shrinks the visual viewport when the software keyboard opens. */
.wizard-modal,
.io-style-modal {
  top:var(--io-visual-top, 0px);
  left:var(--io-visual-left, 0px);
  right:auto;
  bottom:auto;
  width:var(--io-visual-width, 100vw);
  height:var(--io-visual-height, 100dvh);
  max-width:100%;
  max-height:none;
  overflow:hidden;
  box-sizing:border-box;
}
.wizard-modal {
  padding:12px 13px;
  align-items:center;
  justify-items:center;
  overscroll-behavior:contain;
}
.wizard-dialog {
  max-height:calc(var(--io-visual-height, 100dvh) - 24px);
  overflow-y:auto;
  overscroll-behavior:contain;
  scroll-padding-block:12px;
  -webkit-overflow-scrolling:touch;
}
.wizard-input {
  font-size:16px; /* iOS Safari must not auto-zoom a focused field. */
  scroll-margin-top:18px;
  scroll-margin-bottom:18px;
}
.wizard-modal.io-keyboard-open {
  padding:7px 12px;
}
.wizard-modal.io-keyboard-open .wizard-dialog {
  max-height:calc(var(--io-visual-height, 100dvh) - 14px);
  padding:14px 17px 14px;
  border-radius:18px;
}
.wizard-modal.io-keyboard-open .wizard-title {font-size:clamp(19px, 4.4vw, 24px); margin-bottom:5px}
.wizard-modal.io-keyboard-open .wizard-help {min-height:0;margin-bottom:9px;font-size:12px;line-height:1.35}
.wizard-modal.io-keyboard-open .wizard-progress {margin-bottom:10px}
.wizard-modal.io-keyboard-open .wizard-kicker {margin-bottom:6px}
.wizard-modal.io-keyboard-open .wizard-buttons {margin-top:10px}
.wizard-modal.io-keyboard-open .wizard-button {min-height:43px}
.wizard-modal.io-keyboard-open .wizard-input {min-height:46px}

/* Fullscreen review: gallery occupies the available height.
   Navigation is deliberately BELOW the full-sized photo. */
.io-style-modal {
  padding:0;
  align-items:stretch;
  justify-content:center;
}
.io-style-dialog {
  width:min(100%, 1080px);
  height:100%;
  max-height:100%;
  min-height:0;
  padding:calc(env(safe-area-inset-top) + 9px) 11px calc(env(safe-area-inset-bottom) + 9px);
  border-radius:0;
  border-top:0;
  border-bottom:0;
  gap:6px;
  overflow:hidden;
}
.io-style-heading {flex:0 0 auto;align-items:center}
.io-style-heading h2 {font-size:18px;line-height:1.2;margin-bottom:2px}
.io-style-heading p {font-size:11px;line-height:1.2}
.io-style-close {width:36px;height:36px;flex-basis:36px}
.io-style-gallery {
  display:flex;
  flex:1 1 auto;
  min-height:0;
  min-width:0;
  width:100%;
  gap:0;
  overflow:hidden;
}
.io-style-grid {
  flex:1 1 auto;
  height:100%;
  min-height:0;
  min-width:0;
  width:100%;
  padding:0;
  touch-action:pan-x;
}
.io-style-card {
  flex:0 0 100%;
  height:100%;
  min-height:0;
  justify-content:stretch;
  border-radius:12px;
  padding:5px;
  gap:4px;
}
.io-style-thumb {
  display:block;
  flex:1 1 0;
  width:100%;
  height:0;
  min-height:0;
  max-height:none;
  object-fit:contain;
  background:#101829;
  border-radius:9px;
}
.io-style-name {flex:0 0 auto;font-size:16px;line-height:1.1}
.io-style-selected {flex:0 0 auto;font-size:11px;line-height:1.1;min-height:12px}
.io-style-navigation {
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:18px;
  width:100%;
}
.io-style-arrow {
  flex:0 0 auto;
  width:min(28vw,88px);
  height:43px;
  border-radius:12px;
  font-size:29px;
}
.io-style-position {min-width:52px;text-align:center;font-size:14px}
.io-style-pagination {
  flex:0 0 auto;
  justify-content:center;
  min-height:12px;
  gap:0;
}
.io-style-footer {
  flex:0 0 auto;
  min-height:40px;
  padding-top:4px;
}
.io-style-done {min-height:40px}
@media(max-width:560px) {
 .io-style-dialog {padding:calc(env(safe-area-inset-top) + 6px) 7px calc(env(safe-area-inset-bottom) + 7px);gap:4px}
 .io-style-heading h2 {font-size:17px}
 .io-style-heading p {font-size:10px}
 .io-style-card {padding:3px}
 .io-style-thumb {height:0;min-height:0;max-height:none}
 .io-style-arrow {width:74px;height:43px}
 .io-style-footer small {font-size:10px}
 .io-style-done {min-width:110px}
}
@media(max-height:580px) {
 .io-style-heading p,.io-style-footer small {display:none}
 .io-style-footer {justify-content:center}
 .io-style-dialog {gap:3px}
 .io-style-pagination {min-height:9px}
 .io-style-arrow {height:35px}
}

.io-install-help[hidden] {display:none!important}
.io-install-help {
  width:min(100%,1060px);
  margin:0 auto 12px;
  padding:10px 13px;
  border:1px solid rgba(126,181,245,.38);
  border-radius:13px;
  background:rgba(24,44,72,.7);
  color:#dceaff;
  font-size:12px;
  line-height:1.5;
}
.io-install-help strong {color:#fff}
