:root{
  --ink:#101314;
  --surface:#191F21;
  --surface-2:#20282A;
  --line:#2B3436;
  --text:#EDEDEA;
  --muted:#8B9296;
  --amber:#E8A33D;
  --amber-dim:#4A3A20;
  --green:#5FA777;
  --red:#D9705B;
  --radius:14px;
  --font-display:"Fraunces", serif;
  --font-body:"Inter", sans-serif;
  --font-mono:"IBM Plex Mono", monospace;
}

*{box-sizing:border-box;}

html,body{
  margin:0;
  min-height:100%;
  background:var(--ink);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
}

.grain{
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:0.035;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index:0;
}

.page{
  position:relative;
  z-index:1;
  max-width:640px;
  margin:0 auto;
  padding:32px 20px 64px;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  gap:36px;
}

/* --- Masthead --- */
.masthead{
  display:flex;
  align-items:center;
  gap:14px;
}
.masthead__mark{
  font-family:var(--font-mono);
  font-size:13px;
  letter-spacing:0.08em;
  color:var(--amber);
  border:1px solid var(--amber-dim);
  border-radius:6px;
  padding:6px 8px;
}
.masthead__title{
  font-family:var(--font-display);
  font-weight:600;
  font-size:30px;
  margin:0;
  line-height:1;
}
.masthead__sub{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
}

/* --- Dropzone / pick button --- */
.dropzone{
  border:1.5px dashed var(--line);
  border-radius:var(--radius);
  padding:56px 24px;
  text-align:center;
  transition:border-color .2s ease, background .2s ease;
}
.dropzone.is-dragover{
  border-color:var(--amber);
  background:rgba(232,163,61,0.06);
}

.pick-btn{
  display:inline-flex;
  align-items:center;
  gap:12px;
  background:var(--amber);
  color:#1B1305;
  font-family:var(--font-body);
  font-weight:600;
  font-size:17px;
  border:none;
  border-radius:999px;
  padding:16px 30px;
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease;
  box-shadow:0 0 0 0 rgba(232,163,61,0.4);
}
.pick-btn:hover{ transform:translateY(-1px); box-shadow:0 6px 20px rgba(232,163,61,0.25); }
.pick-btn:active{ transform:translateY(0); }
.pick-btn:focus-visible{ outline:2px solid var(--amber); outline-offset:3px; }

.dropzone__hint{
  margin:16px 0 0;
  color:var(--muted);
  font-size:13px;
}

/* --- Contact sheet --- */
.sheet{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
}
.sheet__head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  margin-bottom:14px;
}
.sheet__title{
  font-family:var(--font-display);
  font-size:19px;
  margin:0;
  font-weight:600;
}
.sheet__count{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--muted);
}

.frames{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(84px,1fr));
  gap:10px;
  margin-bottom:20px;
}
.frame{
  position:relative;
  aspect-ratio:1/1;
  border-radius:8px;
  overflow:hidden;
  background:var(--surface-2);
  border:1px solid var(--line);
}
.frame img{
  width:100%; height:100%;
  object-fit:cover;
  display:block;
}
.frame__num{
  position:absolute;
  top:5px; left:6px;
  font-family:var(--font-mono);
  font-size:10px;
  color:#fff;
  background:rgba(0,0,0,0.55);
  padding:1px 5px;
  border-radius:4px;
  letter-spacing:0.03em;
}
.frame__remove{
  position:absolute;
  top:4px; right:4px;
  width:20px; height:20px;
  border-radius:50%;
  border:none;
  background:rgba(16,19,20,0.75);
  color:#fff;
  font-size:13px;
  line-height:1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.frame__remove:hover{ background:var(--red); }

/* --- Actions --- */
.actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.ghost-btn{
  background:transparent;
  color:var(--muted);
  border:1px solid var(--line);
  border-radius:999px;
  padding:12px 18px;
  font-family:var(--font-body);
  font-size:14px;
  cursor:pointer;
}
.ghost-btn:hover{ color:var(--text); border-color:var(--muted); }

.upload-btn{
  background:var(--text);
  color:var(--ink);
  border:none;
  border-radius:999px;
  padding:12px 22px;
  font-family:var(--font-body);
  font-weight:600;
  font-size:14px;
  cursor:pointer;
  flex:1;
  min-width:180px;
}
.upload-btn:hover{ background:#fff; }
.upload-btn:disabled{ opacity:0.5; cursor:not-allowed; }

/* --- Progress --- */
.progress{
  margin-top:18px;
  display:flex;
  align-items:center;
  gap:12px;
}
.progress__track{
  flex:1;
  height:6px;
  border-radius:999px;
  background:var(--surface-2);
  overflow:hidden;
}
.progress__fill{
  height:100%;
  width:0%;
  background:var(--amber);
  transition:width .15s ease;
}
.progress__label{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--muted);
  min-width:36px;
  text-align:right;
}

/* --- Toast --- */
.toast{
  position:fixed;
  left:50%;
  bottom:28px;
  transform:translateX(-50%) translateY(12px);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:999px;
  padding:12px 20px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
  box-shadow:0 10px 30px rgba(0,0,0,0.4);
  opacity:0;
  transition:opacity .25s ease, transform .25s ease;
  z-index:5;
  max-width:calc(100% - 40px);
}
.toast.is-visible{ opacity:1; transform:translateX(-50%) translateY(0); }
.toast__icon{
  width:20px; height:20px;
  border-radius:50%;
  background:var(--green);
  color:#0F1A13;
  display:flex; align-items:center; justify-content:center;
  font-size:12px;
  flex-shrink:0;
}
.toast.is-error .toast__icon{ background:var(--red); color:#2A0F0A; }

@media (max-width:480px){
  .dropzone{ padding:44px 16px; }
  .masthead__title{ font-size:26px; }
}
