/* ─────────────────────────────────────────────
   IMAGE×SWAPP — Stylesheet
   Palette: #0a0a0a bg · #f0ede8 text · #c8f060 accent
   Type: Space Mono (labels/mono) + DM Sans (body)
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500&display=swap');

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

/* ── Tokens ─────────────────────────────────── */
:root {
  --bg:        #0a0a0a;
  --bg-2:      #111111;
  --bg-3:      #1a1a1a;
  --bg-4:      #242424;
  --text:      #f0ede8;
  --text-dim:  #888;
  --text-mute: #444;
  --accent:    #c8f060;
  --accent-dim:#8aab30;
  --danger:    #ff5c5c;
  --border:    #2a2a2a;
  --radius:    4px;
  --mono:      'Space Mono', monospace;
  --sans:      'DM Sans', sans-serif;
}

/* ── Base ───────────────────────────────────── */
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h2 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.5rem;
}

small, .hint { font-size: 0.8rem; color: var(--text-dim); }
.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.accent { color: var(--accent); }

/* ── Site Header ─────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Buttons ─────────────────────────────────── */
.btn-primary {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-block;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: #d8ff70; text-decoration: none; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-block;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-mute); text-decoration: none; }
.btn-ghost.small { padding: 0.3rem 0.7rem; font-size: 0.65rem; }

/* ── Forms ───────────────────────────────────── */
label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

label .hint {
  margin-left: 0.4rem;
}

input[type=text],
input[type=email],
input[type=password] {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.65rem 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--accent); }

.form-error {
  background: rgba(255, 92, 92, 0.1);
  border: 1px solid rgba(255, 92, 92, 0.3);
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.form-success {
  background: rgba(200, 240, 96, 0.07);
  border: 1px solid rgba(200, 240, 96, 0.3);
  color: var(--accent);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ── Auth Page ───────────────────────────────── */
.auth-page { display: flex; flex-direction: column; min-height: 100vh; }

.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}

.tab-row {
  display: flex;
  gap: 0;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.5rem 1rem 0.7rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); text-decoration: none; }

.auth-tagline {
  font-size: 0.8rem;
  color: var(--text-mute);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

/* ── Dashboard ───────────────────────────────── */
.dashboard {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Invite panel */
.invite-panel {
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.invite-link-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.invite-url {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  color: var(--accent);
  word-break: break-all;
  flex: 1;
}

/* New session form */
.new-session { display: flex; flex-direction: column; gap: 1rem; }
.new-session-form { display: flex; flex-direction: column; gap: 1.5rem; }
.form-row { display: flex; gap: 2rem; flex-wrap: wrap; }

fieldset {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
legend {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.15s;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text);
}
.radio-card input { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.radio-card:has(input:checked) { border-color: var(--accent); }
.radio-card small { display: block; color: var(--text-dim); font-size: 0.75rem; line-height: 1.3; }

/* Session cards */
.sessions-list { display: flex; flex-direction: column; gap: 0.8rem; }
.session-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.session-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s;
  color: var(--text);
}
.session-card:hover { border-color: var(--text-mute); text-decoration: none; }
.session-card .session-arrow { margin-left: auto; color: var(--text-mute); }
.session-meta { font-size: 0.85rem; color: var(--text-dim); }

.session-status {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.status-waiting  { background: rgba(200,240,96,0.1); color: var(--accent); }
.status-uploading { background: rgba(96,160,240,0.1); color: #60a0f0; }
.status-processing { background: rgba(240,200,96,0.1); color: #f0c860; }
.status-complete { background: rgba(96,240,160,0.1); color: #60f0a0; }

/* ── Upload Page ─────────────────────────────── */
.upload-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.upload-header { display: flex; flex-direction: column; gap: 0.3rem; }
.upload-meta { font-size: 0.85rem; color: var(--text-dim); }
.upload-rule {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(200,240,96,0.06);
  border-left: 2px solid var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Status banners */
.status-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.status-banner.waiting { background: rgba(200,240,96,0.07); border: 1px solid rgba(200,240,96,0.2); color: var(--text); }
.status-banner.ready   { background: rgba(96,240,160,0.07); border: 1px solid rgba(96,240,160,0.2); color: #60f0a0; }

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Upload grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.8rem;
}

.upload-slot {
  aspect-ratio: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.15s;
  overflow: hidden;
}
.upload-slot.done { border-color: var(--accent); }
.upload-slot.uploading { border-color: #60a0f0; }

.slot-number {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-mute);
  position: absolute;
  top: 6px; left: 8px;
}
.slot-check {
  font-size: 1.5rem;
  color: var(--accent);
}
.slot-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  cursor: pointer;
  margin: 0;
}
.slot-input { display: none; }
.slot-plus {
  font-size: 1.8rem;
  color: var(--text-mute);
  transition: color 0.15s;
  line-height: 1;
}
.slot-label:hover .slot-plus { color: var(--text); }
.slot-progress {
  font-size: 0.65rem;
  color: #60a0f0;
  position: absolute;
  bottom: 5px;
  font-family: var(--mono);
}

.upload-footer { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Result Page ─────────────────────────────── */
.result-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.result-header { display: flex; flex-direction: column; gap: 0.3rem; }
.result-meta { font-size: 0.9rem; color: var(--text-dim); }

.blend-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.blend-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.blend-options { display: flex; gap: 0.4rem; }
.blend-btn {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.blend-btn:hover { color: var(--text); border-color: var(--text-mute); }
.blend-btn.active { background: var(--bg-3); color: var(--accent); border-color: var(--accent); }
.blend-controls .btn-primary { margin-left: auto; }

/* Loading */
.loading-state {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 2rem 0;
}
.loading-bar-wrap {
  height: 2px;
  background: var(--bg-3);
  border-radius: 1px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
#loadingText {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
}
.gallery-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}
.gallery-item:hover { border-color: var(--text-mute); }
.gallery-item img {
  width: 100%;
  display: block;
  aspect-ratio: auto;
}
.gallery-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.8rem;
  border-top: 1px solid var(--border);
}
.gallery-num {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-mute);
}

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  .site-header { padding: 0.8rem 1rem; }
  .dashboard, .upload-main, .result-main { padding: 1.2rem 1rem; }
  .form-row { flex-direction: column; gap: 1rem; }
  .blend-controls .btn-primary { margin-left: 0; }
  .gallery { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .upload-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }
}
