:root {
  --brand-dark: #1c1410;
  --brand-primary: #e8622c;
  --brand-primary-dark: #c94f1f;
  --brand-cream: #fff6ea;
  --brand-accent: #ffd9a0;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: linear-gradient(160deg, #ffb26b 0%, #e8622c 55%, #c94f1f 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--brand-dark);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 18px 40px;
}

.card {
  background: var(--brand-cream);
  border-radius: var(--radius);
  padding: 28px 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
  text-align: center;
}

.emoji-hero {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 6px;
}

.hero-image {
  width: 100%;
  max-width: 480px;
  margin-top: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}

.hero-image img {
  width: 100%;
  display: block;
}

h1 {
  font-size: 24px;
  margin: 4px 0 6px;
}

p.subtitle {
  margin: 0 0 20px;
  color: #6b5c50;
  font-size: 15px;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 16px 20px;
  border-radius: 999px;
  border: none;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand-primary);
  color: white;
}

.btn-primary:hover { background: var(--brand-primary-dark); }

.btn-secondary {
  background: transparent;
  color: var(--brand-dark);
  border: 2px solid rgba(28,20,16,0.15);
  margin-top: 12px;
}

.btn-link {
  display: inline-block;
  margin-top: 16px;
  color: white;
  font-size: 14px;
  text-decoration: underline;
  opacity: 0.9;
}

.stack { display: flex; flex-direction: column; gap: 12px; }

video, canvas, .preview-img {
  width: 100%;
  border-radius: 14px;
  background: #000;
  display: block;
}

.camera-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}

.camera-frame-hint {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  background: rgba(20,16,15,0.55);
  color: white;
  font-size: 13px;
  text-align: center;
}

.camera-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}

.icon-btn {
  background: rgba(28,20,16,0.08);
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
}

input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(28,20,16,0.18);
  font-size: 15px;
  margin-bottom: 14px;
}

.hint {
  font-size: 12px;
  color: #8a7a6d;
  margin-top: -8px;
  margin-bottom: 14px;
}

.error-box {
  background: #ffe3e3;
  color: #7a1f1f;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}

/* Collage page */
.collage-header {
  color: white;
  text-align: center;
  margin-bottom: 18px;
}

.collage-header h1 { margin-bottom: 4px; }
.collage-header p { margin: 0; opacity: 0.9; font-size: 14px; }

.toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.toolbar .btn {
  width: auto;
  padding: 12px 20px;
  font-size: 14px;
}

.grid {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.tile {
  background: var(--brand-cream);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
}

.tile img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.tile-footer {
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.tile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #5c4d42;
}

.tile-footer a {
  color: var(--brand-primary-dark);
  font-weight: 700;
  text-decoration: none;
  font-size: 12px;
  flex-shrink: 0;
}

.empty-state {
  color: white;
  text-align: center;
  padding: 40px 20px;
  opacity: 0.9;
}

/* Admin */
.admin-tile { position: relative; }
.admin-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(180,30,30,0.9);
  color: white;
  border: none;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
}
