@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Fragment+Mono&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #0f0f12;
  --panel: #17171b;
  --panel-2: #1e1e23;
  --ink: #f3f1e9;
  --soft: #9d9a91;
  --accent: #c9ff3d;
  --accent-deep: #9ccb1f;
  --pop: #a06bff;
  --line: #26262d;
  --onaccent: #0f0f12;
  --ok: #c9ff3d;
  --err: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 22px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---- header ---- */
.head { text-align: center; padding-top: 8px; }
.wordmark {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark span { display: block; color: var(--accent); font-size: 30px; }
.tag { margin: 12px auto 0; max-width: 20rem; color: var(--soft); font-size: 15px; line-height: 1.4; }

/* ---- camera ---- */
.body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 24px 0; }
.camera {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  background: radial-gradient(120% 120% at 50% 0%, #23232a 0%, #131317 60%, #0b0b0e 100%);
  border: 1px solid #000;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.05), 0 14px 30px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lens {
  width: 118px; height: 118px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #4a4a44 0%, #1f1f22 45%, #050505 100%);
  border: 6px solid #101013;
  box-shadow: 0 0 0 10px rgba(0,0,0,0.35), inset 0 0 22px rgba(0,0,0,0.85);
  position: relative;
}
.glint { position: absolute; top: 20px; left: 26px; width: 26px; height: 16px; border-radius: 50%;
  background: rgba(201,255,61,0.25); filter: blur(2px); transform: rotate(-24deg); }
.counter {
  position: absolute; top: 14px; right: 16px;
  font-family: "Fragment Mono", monospace;
  font-weight: 700; font-size: 26px; color: var(--accent);
  line-height: 1; text-align: right; font-variant-numeric: tabular-nums;
}
.counter small { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #fff; opacity: 0.7; font-weight: 700; margin-top: 3px; }

/* name */
.name { display: block; }
.name span { display: block; font-size: 13px; color: var(--soft); margin: 0 4px 7px; }
.name input {
  width: 100%; padding: 14px 16px; font-size: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; outline: none;
  font-family: inherit;
}
.name input:focus { border-color: var(--accent); }

/* shutter */
.shutter {
  width: 100%; padding: 18px; font-size: 18px; font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  color: var(--onaccent); background: var(--accent); border: none; border-radius: 14px;
  box-shadow: 0 8px 0 var(--accent-deep); cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.shutter:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--accent-deep); }
.shutter:disabled { background: #3a3a40; color: #8b8b92; box-shadow: 0 8px 0 #2a2a30; cursor: default; }

.status { margin: 0; min-height: 22px; text-align: center; font-size: 15px; color: var(--soft); }
.status.ok { color: var(--accent); font-weight: 600; }
.status.err { color: var(--err); font-weight: 600; }
.status.busy { color: var(--ink); }

/* footer */
.foot { text-align: center; padding-top: 4px; }
.foot a { color: var(--soft); font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.hidden { display: none; }

/* ---- gallery: locked ---- */
.locked { flex: 1; display: flex; align-items: center; justify-content: center; }
.develop { text-align: center; }
.film { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; }
.film span {
  width: 46px; height: 60px; border-radius: 6px;
  background: linear-gradient(180deg, #23232a, #101013); border: 2px solid #000;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8); animation: pulse 1.6s ease-in-out infinite;
}
.film span:nth-child(2) { animation-delay: 0.2s; }
.film span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.countdown { font-family: "Bricolage Grotesque", sans-serif; font-size: 44px; font-weight: 800; letter-spacing: -0.01em; color: var(--accent); font-variant-numeric: tabular-nums; }
.develop-note { margin: 10px auto 0; max-width: 18rem; color: var(--soft); font-size: 15px; }

/* ---- gallery: grid ---- */
.grid { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 8px 0 16px; align-content: start; }
.cell { position: relative; padding: 0; border: none; border-radius: 12px; overflow: hidden; aspect-ratio: 1 / 1; background: var(--panel); cursor: pointer; box-shadow: 0 6px 14px rgba(0,0,0,0.3); }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .by { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 10px 7px; font-size: 12px; font-weight: 600; color: #fff; text-align: left; background: linear-gradient(0deg, rgba(0,0,0,0.65), rgba(0,0,0,0)); }

/* ---- fullscreen viewer ---- */
.viewer { position: fixed; inset: 0; background: rgba(5,5,7,0.96); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 18px; z-index: 40; padding: 24px; }
.viewer.open { display: flex; }
.viewer img { max-width: 100%; max-height: 74vh; border-radius: 10px; }
.viewer-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 18px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255,255,255,0.14); color: #fff; font-size: 18px; cursor: pointer; }
.viewer-dl { color: var(--onaccent); background: var(--accent); font-weight: 700; font-size: 16px; padding: 13px 26px; border-radius: 12px; text-decoration: none; }

/* ---- admin ---- */
.admin { background: var(--bg); }
.admin .shell { max-width: 620px; }
.gate { display: flex; flex-direction: column; gap: 12px; padding: 20px 0; }
.gate input { padding: 14px 16px; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); outline: none; font-family: inherit; }
.gate input:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  padding: 13px 18px; font-size: 15px; font-weight: 700; font-family: "Space Grotesk", sans-serif;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--onaccent); border-color: var(--accent); }
.btn.danger { color: var(--err); border-color: #4a2a2c; background: transparent; }
.panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.panel h2 { margin: 0 0 4px; font-family: "Bricolage Grotesque", sans-serif; font-size: 16px; }
.panel p { margin: 0 0 12px; color: var(--soft); font-size: 14px; }
.mod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mod-cell { position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.mod-cell img { width: 100%; height: 100%; object-fit: cover; }
.mod-cell button { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,107,107,0.92); color: #fff; font-size: 15px; cursor: pointer; }
.note { font-size: 14px; color: var(--soft); margin: 8px 4px 0; }
.note.ok { color: var(--accent); }
.note.err { color: var(--err); }

/* add-to-home-screen nudge */
.a2hs {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 440px; margin: 0 auto; background: #17171b; color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 40px 16px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5); z-index: 30; animation: a2hsUp .28s ease;
}
@keyframes a2hsUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.a2hs strong { display: block; font-family: "Bricolage Grotesque", sans-serif; font-size: 15px; margin-bottom: 4px; }
.a2hs p { margin: 0; font-size: 13.5px; color: var(--soft); line-height: 1.45; }
.a2hs p b { color: var(--accent); }
.a2hs .shareico { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; color: #fff; }
.a2hs-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
