:root{
  --bg:#15120d;
  --bg-soft:#1c1812;
  --paper:#ffffff;
  --paper-shadow:#d8cdae;
  --ink:#2b2622;
  --accent:#b33a3a;
  --accent-glow:rgba(179,58,58,.35);
  --muted:#93897a;
  --line:rgba(244,238,221,.12);
  --display:'Fraunces', serif;
  --mono:'IBM Plex Mono', monospace;
  --hand:'Caveat', cursive;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;overflow-x:hidden;}
body{
  background:
    radial-gradient(ellipse at 20% -10%, rgba(179,58,58,.10), transparent 55%),
    radial-gradient(ellipse at 90% 110%, rgba(179,58,58,.08), transparent 50%),
    var(--bg);
  color:#f4eedd;
  font-family:var(--mono);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
.app{
  max-width:1240px;
  margin:0 auto;
  padding:48px 28px 80px;
}
header {
  display: flex;
  flex-direction: column; /* Stacks title section and tagline vertically */
  align-items: flex-start;  /* Aligns everything cleanly to the left */
  gap: 16px; /* Controls vertical spacing between title & description */
  border-bottom: 1px solid var(--line);
  padding-bottom: 28px;
  margin-bottom: 44px;
}
.eyebrow{
  font-size:11px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:var(--accent);
  display:flex;
  align-items:center;
  gap:8px;
}
.eyebrow::before{
  content:'';
  width:6px;height:6px;border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 8px 2px var(--accent-glow);
}
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.05;
  margin: 10px 0 0;
  max-width: 100%; /* Allows heading to expand full width and wrap dynamically */
  color: #f4eedd;
}
h1 em{
  font-style:italic;
  font-weight:500;
  color:var(--accent);
}
.tagline {
  max-width: 100%; /* Allows tagline text to span full width under the heading */
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
main{
  display:grid;
  grid-template-columns:1.15fr .85fr;
  gap:36px;
  align-items:start;
}

/* ---- Light table / preview ---- */
.table{
  background:
    repeating-linear-gradient(0deg, rgba(244,238,221,.03) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(244,238,221,.03) 0 1px, transparent 1px 28px),
    var(--bg-soft);
  border:1px solid var(--line);
  border-radius:4px;
  min-height:620px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  overflow:hidden;
  padding:40px 20px;
}
.table-label{
  position:absolute;
  top:16px;left:18px;
  font-size:10px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--muted);
}
.card-wrap{
  position:relative;
  transition:transform .25s ease;
  filter:
    drop-shadow(0 26px 34px rgba(0,0,0,.55))
    drop-shadow(0 3px 10px rgba(0,0,0,.35));
  max-width:100%;
  max-height:100%;
}
#cardCanvas{
  display:block;
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  border-radius:2px;
}
.flash{
  position:absolute;
  inset:0;
  background:#f7f4ea;
  border-radius:2px;
  opacity:0;
  pointer-events:none;
}
.photo-stage{
  position:absolute;
  touch-action:none;
  cursor:grab;
  pointer-events:none;
}
.photo-stage.active{
  pointer-events:auto;
}
.photo-stage:active{
  cursor:grabbing;
}
.stage-hint{
  position:absolute;
  bottom:14px;
  left:50%;
  transform:translateX(-50%);
  font-size:10.5px;
  letter-spacing:.04em;
  color:#f4eedd;
  background:rgba(0,0,0,.55);
  padding:7px 14px;
  border-radius:20px;
  opacity:0;
  pointer-events:none;
  transition:opacity .4s ease;
  white-space:nowrap;
  z-index:10;
}
.stage-hint.show{opacity:1;}
.card-wrap.developing .flash{
  animation:develop-flash 1.7s ease-out forwards;
}
.card-wrap.developing #cardCanvas{
  animation:develop-canvas 1.7s ease-out forwards;
}
@keyframes develop-flash{
  0%{opacity:1;}
  100%{opacity:0;}
}
@keyframes develop-canvas{
  0%{filter:contrast(.4) brightness(2) saturate(.2);}
  100%{filter:contrast(1) brightness(1) saturate(1);}
}

/* Original Stable Desktop Dropzone Dimensions */
.dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  z-index: 5;
  box-sizing: border-box;
  margin-top: 0;
}
.dropzone.hidden{display:none;}
.dropzone-icon{
  width:52px;height:52px;
  border:1.5px dashed var(--muted);
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:20px;
  color:var(--accent);
}
.dropzone p{margin:0;font-size:12.5px;line-height:1.6;}
.dropzone .hint{font-size:10.5px;color:var(--muted);opacity:.7;}
.dropzone.drag-over{color:var(--accent);}
.dropzone.drag-over .dropzone-icon{border-color:var(--accent);}
#fileInput{display:none;}

.dropzone-actions {
  display: flex;
  gap: 16px;
  margin: 16px 0;
  z-index: 10;
  justify-content: center;
}

/* Redesigned Button Actions: Desktop Native Standard Sizing */
.dropzone-btn.primary,
.dropzone-btn.ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.dropzone-btn.primary:hover,
.dropzone-btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  filter: none !important;
}

.dropzone-btn svg {
  fill: #000000 !important;
}

/* ---- Controls rail ---- */
.rail{
  background:var(--bg-soft);
  border:1px solid var(--line);
  border-radius:4px;
  padding:26px 24px 24px;
}
.rail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.rail h2{
  font-family:var(--display);
  font-style:italic;
  font-weight:500;
  font-size:18px;
  margin:0;
  color:#f4eedd;
}
.field{
  margin-bottom:20px;
}
.field label{
  display:flex;
  justify-content:space-between;
  font-size:10.5px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:8px;
}
.field label span.val{color:var(--accent);}

.select-wrapper {
  position: relative;
  width: 100%;
}
select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px;
  color:#f4eedd;
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
select:focus {
  border-color: var(--accent);
}
.select-wrapper::after {
  content: '▼';
  font-size: 8px;
  color: var(--muted);
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

input[type=range]{
  -webkit-appearance:none;
  width:100%;
  height:2px;
  background:var(--line);
  outline:none;
  margin:0;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:13px;height:13px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  box-shadow:0 0 0 3px rgba(179,58,58,.18);
}
input[type=range]::-moz-range-thumb{
  width:13px;height:13px;border:none;border-radius:50%;
  background:var(--accent);cursor:pointer;
}
input[type=text]{
  width:100%;
  background:transparent;
  border:1px solid var(--line);
  border-radius:2px;
  padding:9px 10px;
  color:#f4eedd;
  font-family:var(--hand);
  font-size:18px;
  outline:none;
}
input[type=text]:focus{border-color:var(--accent);}
input[type=text]::placeholder{color:var(--muted);font-family:var(--mono);font-size:12px;}

.toggle-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.switch{
  position:relative;
  width:36px;height:20px;
  background:var(--line);
  border-radius:20px;
  cursor:pointer;
  transition:background .2s;
  flex:none;
}
.switch.on{background:var(--accent);}
.switch::after{
  content:'';
  position:absolute;
  top:2px;left:2px;
  width:16px;height:16px;
  background:var(--bg-soft);
  border-radius:50%;
  transition:left .2s;
}
.switch.on::after{left:18px;}

.segmented{
  display:flex;
  border:1px solid var(--line);
  border-radius:2px;
  overflow:hidden;
}
.segmented button{
  flex:1;
  background:transparent;
  border:none;
  color:var(--muted);
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:.04em;
  padding:9px 4px;
  cursor:pointer;
  border-right:1px solid var(--line);
}
.segmented button:last-child{border-right:none;}
.segmented button.active{background:var(--accent);color:var(--paper);}

.actions{
  margin-top:26px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
button.primary{
  width:100%;
  background:var(--accent);
  color:#f4eedd;
  border:none;
  padding:14px;
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:.1em;
  text-transform:uppercase;
  border-radius:2px;
  cursor:pointer;
  transition:filter .15s, transform .15s;
}
button.primary:hover{filter:brightness(1.12);}
button.primary:active{transform:scale(.98);}
button.primary:disabled{
  opacity:.35;
  cursor:not-allowed;
}
button.ghost{
  width:100%;
  background:transparent;
  border:1px solid var(--line);
  color:var(--muted);
  padding:11px;
  font-family:var(--mono);
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  border-radius:2px;
  cursor:pointer;
}
button.ghost:hover{color:#f4eedd;border-color:#f4eedd;}

.note{
  font-size:10.5px;
  color:var(--muted);
  line-height:1.6;
  margin-top:16px;
  opacity:.75;
}

.mobile-camera-bar, .mobile-shutter-deck, .close-rail-btn, .mobile-filter-toast {
  display: none;
}

/* ---- Responsive Mobile Viewport Overrides (Camera UI Architecture) ---- */
@media (max-width:920px){
  .desktop-only {
    display: none !important;
  }
  body {
    background: #000000; 
    position: fixed;
    inset: 0;
    overflow: hidden;
  }
  .app {
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }
  main {
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    height: 100%;
    position: relative;
  }
  
  .table {
    border: none;
    border-radius: 0;
    background: #000000;
    width: 100vw;
    height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    position: relative;
  }
  
  .card-wrap {
    margin-top: 76px; 
    height: calc(100vh - 290px); 
    width: calc(100vw - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.1, 0.8, 0.3, 1);
  }

  /* Compact Mobile Framing Constraints for Placeholder Zone */
  .dropzone {
    padding: 20px !important;
    pointer-events: none;
    margin-top: -50%;
  }
  .dropzone-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    margin-bottom: 4px !important;
  }
  .dropzone p.dropzone-title {
    font-size: 11px !important;
    line-height: 1.4 !important;
    color: #7a7265 !important;
  }
  .dropzone .hint {
    font-size: 9px !important;
    margin-top: 4px !important;
  }
  .dropzone-actions {
    flex-direction: column !important;
    gap: 8px !important;
    width: 85% !important;
    max-width: 240px !important;
    margin: 12px 0 6px 0 !important;
    pointer-events: auto;
  }
  .dropzone-btn.primary,
  .dropzone-btn.ghost {
    justify-content: center !important;
    width: 100% !important;
    padding: 9px !important;
    font-size: 9.5px !important;
    border: 1.5px solid #000000 !important;
  }

  /* ---- Pill Camera Settings Row Overlay ---- */
  .mobile-camera-bar {
    display: flex;
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 32px);
    max-width: 420px;
    background: rgba(24, 22, 18, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 6px;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
  }
  
  .cam-icon-btn {
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888888;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
  }
  .cam-icon-btn.active, .cam-icon-btn:active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
  }
  .cam-icon-btn svg {
    width: 22px; 
    height: 22px;
    fill: currentColor;
  }
  .cam-icon-btn span {
    font-size: 12px;
    font-weight: 500;
    font-family: var(--mono);
    letter-spacing: -0.02em;
    line-height: 1;
    display: inline-block;
  }

  .mobile-filter-toast {
    display: block;
    position: absolute;
    top: 74px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #ffffff;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 90;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .mobile-filter-toast.show {
    opacity: 1;
  }

  /* ---- Bottom Shutter Hardware Deck Area ---- */
  .mobile-shutter-deck {
    display: flex;
    position: absolute;
    bottom: 34px; 
    left: 0;
    width: 100vw;
    height: 110px;
    background: transparent;
    justify-content: space-around;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
  }
  
  .shutter-trigger {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #ffffff;
    border: 5px solid #000000;
    box-shadow: 0 0 0 2px #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease;
  }
  .shutter-trigger:shadow {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  }
  .shutter-trigger:active {
    transform: scale(0.92);
  }
  .shutter-trigger:disabled {
    background: #444444;
    box-shadow: 0 0 0 2px #444444;
    cursor: not-allowed;
  }
  .shutter-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
  }
  .shutter-core svg {
    display: block;
  }
  .shutter-trigger:disabled .shutter-core {
    background: #222222;
  }
  .shutter-trigger:disabled .shutter-core svg {
    fill: #555555 !important;
  }
  
  .shutter-side-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }
  .shutter-side-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }
  .reset-icon-inner {
    font-size: 16px;
    font-weight: 400;
  }

  .rail {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-height: 75vh;
    overflow-y: auto;
    z-index: 200;
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.15, 0.85, 0.3, 1);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
  }
  .rail.open {
    transform: translateY(0);
  }
  .close-rail-btn {
    display: block;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}