/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cherry+Bomb+One&family=Fredoka+One&family=Righteous&family=Roboto+Slab:wght@400;700&family=Permanent+Marker&family=Pixelify+Sans:wght@400;500;600;700&family=VT323&display=swap');

/* Funkhouse-style: Righteous as primary, Fredoka as fallback */
/* Cute Bubble / Fanky Bubble Graffiti: Fredoka One */
/* Osgood Slab: Roboto Slab */
/* Retro-OS chrome: Pixelify Sans for chunky pixel headings, VT323 for terminal-style accents */

:root {
  --pink:       #EE8DD2;
  --cream:      #F5E6D3;
  --lavender:   #7B68AE;
  --lavender-dark: #5A4A8A;
  --lavender-mid:  #9B8FC8;
  --lavender-light:#C4B7E8;
  --blue-light: #B0CDD6;
  --sky-blue:   #6EC6F0;
  --dusty-rose: #CC6688;
  --burgundy:   #6A2539;
  --white:      #ffffff;
  --panel-bg:   #D4C8F0;
  --header-from:#6B5FA5;
  --header-to:  #9080C8;

  /* Retro-OS window chrome */
  --os-toolbar-bg:  #e8e8e4;
  --os-toolbar-border: #000000;
  --os-tab-bg:      #f4f4f0;
  --os-tab-border:  #9a9a92;
  --os-win-bg:      #f0f0ec;
  --os-win-border:  #000000;
  --os-title-from:  #2038c9;
  --os-title-to:    #121e8a;
  --os-link-blue:   #4b3fd6;
}

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

html, body {
  height: 100%;
  font-family: 'Roboto Slab', serif;
  overflow: hidden;
}

/* ── Background ── */
body {
  background:
    linear-gradient(rgba(255,255,255,0.72), rgba(255,255,255,0.72)),
    url('assets/bg.jpg') center center / cover no-repeat fixed;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('assets/bg.jpg') center center / cover no-repeat fixed;
  opacity: 0.4;
  filter: hue-rotate(0deg) brightness(1.05) saturate(1.2);
  animation: holo 18s linear infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes holo {
  0%   { filter: hue-rotate(0deg)   brightness(1.05) saturate(1.2); }
  25%  { filter: hue-rotate(30deg)  brightness(1.1)  saturate(1.3); }
  50%  { filter: hue-rotate(60deg)  brightness(1.05) saturate(1.2); }
  75%  { filter: hue-rotate(20deg)  brightness(1.1)  saturate(1.4); }
  100% { filter: hue-rotate(0deg)   brightness(1.05) saturate(1.2); }
}

/* ── Layout wrapper ── */
#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Retro-OS toolbar ── */
.os-toolbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--os-toolbar-bg);
  border-bottom: 2px solid var(--os-toolbar-border);
  padding: 8px 14px;
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

.os-start-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--white);
  border: 1.5px solid var(--os-toolbar-border);
  border-radius: 3px;
  padding: 6px 16px;
  cursor: default;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.18);
}

.os-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.os-tab {
  font-family: inherit;
  font-size: 0.8rem;
  color: #555;
  background: var(--os-tab-bg);
  border: 1px solid var(--os-tab-border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 6px 16px;
  cursor: default;
  white-space: nowrap;
}

.os-tab:first-of-type {
  color: #111;
  font-weight: 700;
  background: var(--white);
}

.os-tab-add {
  flex: 0 0 auto;
  font-weight: 700;
  padding: 6px 12px;
  color: #111;
}

.os-clock {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  font-family: 'VT323', Tahoma, monospace;
  font-size: 1.05rem;
  color: #222;
  background: var(--white);
  border: 1.5px solid var(--os-toolbar-border);
  border-radius: 3px;
  padding: 4px 12px;
}

/* ── Title ── */
.site-title {
  font-family: 'Pixelify Sans', 'Cherry Bomb One', 'Righteous', cursive;
  font-weight: 700;
  font-size: clamp(2.5rem, 6vw, 5rem);
  color: #16161a;
  text-shadow: none;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 1.2rem 2rem 0.5rem;
  text-align: center;
  line-height: 1.1;
  image-rendering: pixelated;
}

/* ── Sections ── */
.section {
  display: none;
  width: 100%;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.5rem 1.5rem;
}
.section.active {
  display: flex;
}

/* ── Retro-OS window panel ── */
.panel {
  background: var(--os-win-bg);
  border: 2px solid var(--os-win-border);
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.28);
  overflow: hidden;
}

.panel-header {
  background: linear-gradient(180deg, var(--os-title-from), var(--os-title-to));
  color: var(--white);
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 7px 8px 7px 12px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  line-height: 16px;
  font-size: 0.7rem;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  color: #222;
  background: #d9d9d5;
  border: 1px solid #000;
  border-radius: 2px;
  cursor: default;
  padding: 0;
}

.panel-body {
  padding: 14px;
  background: var(--os-win-bg);
}

/* ── Consent Section ── */
#consent-section {
  flex-direction: column;
}

.consent-panel {
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.consent-panel .panel-body {
  padding: 2rem 2rem 1.5rem;
}

.consent-text {
  font-family: 'Roboto Slab', serif;
  font-size: 1.15rem;
  color: var(--burgundy);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.consent-text strong {
  color: var(--lavender-dark);
}

.consent-list {
  font-family: 'Roboto Slab', serif;
  font-size: 1.05rem;
  color: var(--burgundy);
  line-height: 1.7;
  text-align: left;
  max-width: 420px;
  margin: 0 auto 1.5rem;
}

.consent-list strong {
  color: var(--lavender-dark);
}

.consent-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.btn {
  font-family: 'Righteous', 'Fredoka One', cursive;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  padding: 0.7rem 2.5rem;
  border: 2px solid #000;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.35);
}

.btn-yes {
  background: linear-gradient(135deg, var(--lavender), var(--lavender-dark));
  color: var(--white);
}

.btn-yes:hover {
  background: linear-gradient(135deg, var(--lavender-mid), var(--lavender));
}

.btn-no {
  background: linear-gradient(135deg, var(--dusty-rose), var(--burgundy));
  color: var(--white);
}

.btn-no:hover {
  background: linear-gradient(135deg, var(--pink), var(--dusty-rose));
}

/* ── Camera Section ── */
#camera-section {
  flex-direction: column;
}

.camera-panel {
  max-width: 540px;
  width: 100%;
  text-align: center;
}

.camera-panel .panel-body {
  padding: 1rem;
}

#camera-message {
  font-size: 0.95rem;
  color: var(--burgundy);
  margin: 0.6rem 0 0;
  min-height: 1.4em;
  text-align: center;
  font-style: italic;
}

#camera-instruction {
  font-family: 'Righteous', 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: var(--lavender-dark);
  margin: 0.7rem 0 0;
  text-align: center;
}

#camera-infographic {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* ── Video wrapper + overlays ── */
#video-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  line-height: 0;
}

#video-preview {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border: 2px solid var(--lavender);
  background: #111;
  display: block;
  border-radius: 2px;
  transform: scaleX(-1); /* mirror so it feels like looking in a mirror */
}

/* Countdown */
#countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 2px;
}

#countdown-number {
  font-family: 'Righteous', cursive;
  font-size: 7rem;
  color: var(--white);
  text-shadow: 0 0 30px var(--pink), 0 4px 12px rgba(0,0,0,0.5);
  animation: pulse-num 1s ease-in-out infinite;
  line-height: 1;
}

@keyframes pulse-num {
  0%, 100% { transform: scale(1);   opacity: 1;   }
  50%       { transform: scale(1.2); opacity: 0.85; }
}

/* Flash */
#flash-overlay {
  position: absolute;
  inset: 0;
  background: white;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
}

#flash-overlay.flashing {
  animation: flash 0.4s ease-out forwards;
}

@keyframes flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Camera denied panel ── */
#camera-denied {
  text-align: center;
  padding: 0.5rem 0;
}

.denied-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.denied-title {
  font-family: 'Righteous', cursive;
  font-size: 1.3rem;
  color: var(--lavender-dark);
  margin-bottom: 0.6rem;
}

.denied-desc {
  font-size: 0.9rem;
  color: var(--burgundy);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.denied-steps {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  text-align: left;
  margin-bottom: 1.2rem;
}

.denied-browser {
  background: rgba(255,255,255,0.55);
  border: 1.5px solid var(--lavender);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  min-width: 160px;
  flex: 1;
  font-size: 0.8rem;
  color: #444;
  line-height: 1.55;
}

.denied-browser strong {
  display: block;
  color: var(--lavender-dark);
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.denied-browser ol {
  padding-left: 1.1rem;
}

.denied-browser li {
  margin-bottom: 0.2rem;
}

.btn-retry {
  background: linear-gradient(135deg, var(--lavender), var(--lavender-dark));
  color: var(--white);
}

.hidden {
  display: none !important;
}

#canvas-capture {
  display: none;
}

/* ── Form Section ── */
#form-section {
  align-items: stretch;
}

.form-layout {
  display: flex;
  gap: 1.2rem;
  width: 100%;
  max-width: 1400px;
  height: 100%;
  align-items: flex-start;
}

/* Picture panel */
.picture-panel {
  flex: 0 0 54%;
  height: 100%;
}

.picture-panel .panel-body {
  padding: 8px;
  height: calc(100% - 36px);
}

#photo-display,
#instructions-photo-display {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--lavender);
  display: block;
  border-radius: 2px;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid var(--lavender);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.9rem;
  border-radius: 2px;
}

/* Info panel */
.info-panel {
  flex: 1;
  min-width: 0;
}

.info-panel .panel-body {
  padding: 12px 12px 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--lavender);
  border-radius: 3px;
  font-family: 'Roboto Slab', serif;
  font-size: 0.85rem;
  background: var(--white);
  color: #333;
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
textarea:focus {
  border-color: var(--lavender-dark);
  box-shadow: 0 0 0 2px rgba(107, 95, 165, 0.2);
}

input.error,
textarea.error {
  border-color: var(--dusty-rose);
  background: rgba(204, 102, 136, 0.06);
  box-shadow: 0 0 0 2px rgba(204, 102, 136, 0.22);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

.shake {
  animation: shake 0.35s ease;
}

input::placeholder,
textarea::placeholder {
  color: #aaa;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.btn-submit {
  width: 100%;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--header-from), var(--header-to));
  color: var(--white);
  font-size: 1.1rem;
  padding: 0.6rem 1rem;
  letter-spacing: 0.08em;
}

.btn-submit:hover {
  background: linear-gradient(90deg, var(--lavender-dark), var(--lavender-mid));
}

/* ── Instructions Section ── */
#instructions-section {
  align-items: stretch;
}

.right-stack {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.info-summary-panel {
  flex: 0 0 auto;
}

.instructions-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.instructions-panel .panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.info-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 0.9rem;
  color: var(--burgundy);
}

.info-summary dt {
  font-weight: 700;
  color: var(--lavender-dark);
}

.info-summary dd {
  word-break: break-word;
}

.instructions-intro {
  font-size: 0.9rem;
  color: var(--burgundy);
  margin-bottom: 0.6rem;
}

.pose-list {
  list-style: none;
  font-size: 0.9rem;
  color: var(--burgundy);
  line-height: 1.6;
  margin-bottom: 0.8rem;
}

.pose-list li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(90, 74, 138, 0.15);
}

.pose-list li:last-child {
  border-bottom: none;
}

.pose-list strong {
  color: var(--lavender-dark);
  margin-right: 6px;
}

.instructions-note {
  font-size: 0.8rem;
  color: var(--burgundy);
  font-style: italic;
  margin-bottom: 0.8rem;
}

.instructions-panel .btn-submit {
  margin-top: auto;
}

/* ── Post-photos / Final sections ── */
#post-photos-section,
#final-section {
  flex-direction: column;
}

.success-card {
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.success-card .panel-body {
  padding: 2rem 2rem 1.5rem;
}

.success-text {
  font-family: 'Righteous', cursive;
  font-size: 1.4rem;
  color: var(--lavender-dark);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.success-sub {
  font-size: 0.95rem;
  color: var(--burgundy);
  margin-bottom: 1.5rem;
}

/* ── Extra Info Section ── */
.extra-info-panel {
  max-width: 760px;
  width: 100%;
}

.extra-info-panel .panel-body {
  max-height: 82vh;
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
}

.extra-info-intro {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.slider-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--lavender-dark);
  margin-bottom: 4px;
}

.slider-field input[type="range"] {
  width: 100%;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--burgundy);
  margin-top: 2px;
}

/* ── Responsive tweaks ── */
@media (max-width: 820px) {
  .form-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .picture-panel {
    flex: none;
    height: 240px;
  }
  .info-panel,
  .right-stack {
    flex: none;
  }
  .os-tabs {
    display: none;
  }
  .os-clock {
    font-size: 0.9rem;
    padding: 4px 8px;
  }
}
