:root { color-scheme: dark; font: 16px system-ui, sans-serif; }
body { background: #14141a; color: #f1eee7; margin: 0; }
main { max-width: 62rem; padding: 2rem 1.25rem; margin: auto; }
h1 { color: #efd298; letter-spacing: .12em; }
form, li { background: #202027; border: 1px solid #434047; padding: 1rem; }
label { display: block; margin: .6rem 0; }
input { display: block; max-width: 100%; margin-top: .3rem; }
button, a { color: #efd298; }
button { background: #29262a; padding: .55rem; border: 1px solid #b29762; cursor: pointer; }
ul { padding: 0; list-style: none; }
li { margin: .6rem 0; display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }

/* Premium AEGIS login and registration experience */
body { min-height:100vh; background:radial-gradient(ellipse at 50% 0%,#34204d 0%,#100d1c 55%,#080711 100%); color:#f9f0dd; }
main { max-width:440px; margin:0 auto; padding:1.25rem 1rem 3rem; }
body:has(#login:not([hidden])) main, body:has(#signup:not([hidden])) main, body:has(#forgot:not([hidden])) main, body:has(#reset:not([hidden])) main { max-width:440px; }
.brand { text-align:center; position:relative; padding:235px 0 22px; background: url('/guardian.svg') center top / 350px 350px no-repeat; }
.brand-mark { display:none; }
.brand h1 { font: 600 clamp(2rem,8vw,2.7rem) Georgia,serif; margin:0; letter-spacing:.13em; color:#f5d69b; text-shadow:0 0 28px #8e5a2e; }
.brand p { margin:.5rem 0 0; color:#d6c4dd; font-size:.78rem; letter-spacing:.1em; text-transform:uppercase; }
#auth-tabs { display:grid; grid-template-columns:1fr 1fr; gap:.6rem; margin:0 0 .8rem; }
#auth-tabs button { font-size:.95rem; padding:.9rem .45rem; border-radius:12px; color:#f5d69b; background:#1b142b; border:1px solid #86643f; }
#auth-tabs button[aria-pressed="true"] { color:#201325; font-weight:700; background:linear-gradient(125deg,#ffe5a8,#b88945,#f9df9f); box-shadow:0 0 20px #d2a25c44; }
#login,#signup,#forgot,#reset { border:1px solid #97764d; border-radius:22px; padding:1.4rem; background:linear-gradient(145deg,#21172eea,#130e20f5); box-shadow:0 18px 55px #0009,0 0 35px #8c4bba22; }
#login label,#signup label,#forgot label,#reset label { font-size:.95rem; margin:1rem 0 .5rem; color:#e8d7ed; }
#login input,#signup input,#forgot input,#reset input { box-sizing:border-box; width:100%; max-width:none; padding:.85rem 1rem; border-radius:10px; border:1px solid #927c9d; background:#130f1c; color:#fff; font-size:1rem; outline-offset:3px; }
#login button,#signup button,#forgot button,#reset button { border-radius:10px; margin-top:.65rem; }
#login button[type="submit"],#signup button[type="submit"],#forgot button[type="submit"],#reset button[type="submit"],#login button:not([type]),#signup button:not([type]),#forgot button:not([type]),#reset button:not([type]) { display:block; width:100%; padding:1rem; font-weight:700; color:#201325; background:linear-gradient(120deg,#ffe5a8,#b98a47,#ffe2a2); border:1px solid #f8dc9b; }
#forgot-link { display:block; margin:1rem auto 0 !important; background:none !important; border:0 !important; color:#e7c8ff !important; padding:.4rem !important; text-decoration:underline; }
[data-toggle-password] { background:transparent !important; color:#f4d6a0 !important; border:0 !important; padding:.45rem 0 !important; font-size:.9rem; }
#notice { text-align:center; color:#f7dcaa; }
[hidden] { display:none !important; }
@media(min-width:700px) { .brand { padding-top:280px; background-size:410px 410px; } }

/* AEGIS VAULT cinematic entrance — presentation only, no auth changes */
body { background: #100817; }
body:has(#vault[hidden]) {
  background:
    linear-gradient(180deg,rgba(8,4,17,.05) 0%,rgba(10,4,19,.42) 48%,#0c0615 100%),
    radial-gradient(ellipse at center 20%,#6c328a 0%,#20102e 53%,#090511 100%);
  background-attachment:fixed;
}
body:has(#vault[hidden])::before {
  content:""; position:fixed; inset:0; pointer-events:none; z-index:-1;
  background:url('/guardian.svg') center 5% / min(125vh,1100px) auto no-repeat;
  opacity:.52; filter:drop-shadow(0 0 42px #bc70ff);
}
body:has(#vault[hidden]) main {max-width:560px; padding:clamp(12px,3vw,30px) 16px 50px;}
.brand {background:none; padding:clamp(155px,27vh,255px) 0 26px;}
.brand h1 {font-size:clamp(2.35rem,8vw,3.7rem);letter-spacing:.085em;color:#f7d89c;text-shadow:0 2px 3px #1a0b14,0 0 22px #e7a34c;}
.brand p {font-size:clamp(.65rem,2vw,.83rem);color:#f4e4df;letter-spacing:.055em;text-shadow:0 2px 6px #000;}
#auth-tabs {margin:0;gap:12px;padding:20px 22px 0;background:linear-gradient(140deg,#24112be8,#0e0717f2);border:2px solid #b48b58;border-bottom:0;border-radius:25px 25px 0 0;box-shadow:0 -7px 35px #c76cf52e;}
#auth-tabs button {border-radius:13px;font-size:clamp(.85rem,2.8vw,1.08rem);font-weight:650;border:1px solid #b8905e;background:linear-gradient(140deg,#2a1632,#100b1c);color:#f9e6c3;padding:15px 6px;}
#auth-tabs button[aria-pressed="true"] {background:linear-gradient(125deg,#ffde9a,#9b6024 56%,#ffe6ab);color:#1c101b;box-shadow:0 0 24px #e5a74b99;}
#login,#signup {border-top:0;border-radius:0 0 25px 25px;padding:18px 26px 28px;}
#forgot,#reset {margin-top:20px;}
#login,#signup,#forgot,#reset {background:linear-gradient(145deg,#24112bee,#100918f5);border-color:#b48b58;box-shadow:0 20px 60px #000b,0 0 26px #a23cff33;}
#login::before {content:"Connexion";display:block;text-align:center;color:#ffe1a3;font:600 clamp(2rem,6vw,2.6rem) Georgia,serif;text-shadow:0 0 14px #9e633b;margin:0 0 15px;}
#login label,#signup label,#forgot label,#reset label {color:#ead6ed;font-size:1rem;}
#login input,#signup input,#forgot input,#reset input {border:1px solid #ad8b60;background:linear-gradient(90deg,#140b1f,#231329);border-radius:12px;min-height:49px;box-shadow:inset 0 1px 9px #0008;}
#login button:not([type]),#signup button:not([type]),#forgot button:not([type]),#reset button:not([type]) {font:700 1.35rem Georgia,serif;border-radius:12px;box-shadow:0 4px 0 #5c381e,0 0 16px #d79c5066;}
#forgot-link {font-size:1rem;}
#notice:empty {display:none;}
@media(max-width:450px) {body:has(#vault[hidden])::before {background-size:850px auto;background-position:center 0;opacity:.42;} .brand {padding-top:170px;}#auth-tabs {padding:14px 12px 0;gap:7px;}#login,#signup {padding:15px 16px 24px;}}

/* Authenticated workspace: hide landing layout, show a clear dashboard */
body.authenticated main {max-width:1080px;padding:24px clamp(16px,4vw,44px) 80px;}
body.authenticated .brand {padding:12px 0 22px;}
body.authenticated .brand h1 {font-size:clamp(1.8rem,5vw,2.7rem);}
body.authenticated #auth-tabs,body.authenticated #login,body.authenticated #signup,body.authenticated #forgot,body.authenticated #reset {display:none!important;}
#vault {display:grid;gap:18px;}
.vault-top {display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap;background:linear-gradient(130deg,#2b173d,#171021);border:1px solid #a88150;border-radius:18px;padding:24px;}
.vault-top h2 {font:600 clamp(1.8rem,5vw,2.6rem) Georgia,serif;color:#f5d69b;margin:8px 0 12px;}
.eyebrow {color:#d3b783;font-size:.75rem;letter-spacing:.15em;font-weight:700;}
#account {margin:0;overflow-wrap:anywhere;color:#e7dce9;}
.session-controls {display:flex;align-items:center;gap:14px;flex-wrap:wrap;}
.connected {font-weight:650;color:#bcebcf;white-space:nowrap;}
.status-dot {display:inline-block;width:8px;height:8px;background:#6ddc9a;border-radius:50%;margin-right:4px;}
#logout {padding:10px 14px;border-radius:9px;}
.vault-heading h3 {font-size:1.3rem;color:#f5d69b;margin:0 0 8px;}
.vault-heading p {margin:0;color:#cfc2d5;}
#upload {border-radius:18px;border-color:#987648;padding:24px;background:#21162d;}
#upload input[type=file] {width:100%;box-sizing:border-box;padding:15px;border:1px dashed #b69361;border-radius:10px;background:#130e1c;color:#f7e7d2;}
#upload button {padding:12px 22px;border-radius:10px;background:linear-gradient(125deg,#ffe1a2,#b58b51);color:#201323;font-weight:700;}
#upload button:disabled {opacity:.65;cursor:wait;}
#upload-status {min-height:1.4em;color:#f3d6a2;}
#empty-images {padding:20px;border:1px dashed #665372;border-radius:12px;color:#d8cbdc;}
#images li {border-radius:12px;background:#24192f;padding:18px;}
@media(max-width:600px){.vault-top {padding:18px;}.session-controls {width:100%;justify-content:space-between;}}

/* Photo vault cards: responsive previews and clear actions */
#images {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));gap:20px;}
#images .photo-card {display:block;margin:0;padding:22px;border:1px solid #95734b;border-radius:18px;background:linear-gradient(145deg,#2c1c3c,#181020);box-shadow:0 12px 28px #0004;min-width:0;}
.photo-card-header {display:flex;justify-content:space-between;margin-bottom:16px;}
.photo-status {display:inline-flex;padding:7px 12px;border-radius:999px;background:#233d35;color:#b8f1d5;font-size:.9rem;}
.photo-comparison {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0 0 16px;}
.photo-comparison figure {margin:0;min-width:0;border:1px solid #765b7d;border-radius:12px;overflow:hidden;background:#120e19;}
.photo-comparison img {display:block;width:100%;height:170px;object-fit:contain;background:#120e19;}
.photo-comparison figcaption {padding:9px 7px;text-align:center;font-size:.87rem;color:#f4d69b;font-weight:700;}
.photo-actions {display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin:0 0 15px;}
.photo-actions button,.photo-actions a,.photo-review button {padding:10px 12px;border:1px solid #b28c55;border-radius:9px;background:#352440;color:#fbe3b0;text-decoration:none;font-size:.88rem;font-weight:650;cursor:pointer;}
.photo-actions button:first-child {background:linear-gradient(115deg,#ffe4a9,#b58b51);color:#201323;}
.photo-actions .danger-button {color:#ffced0;border-color:#a95565;background:#3a1d2b;}
.photo-actions button:hover,.photo-actions a:hover,.photo-review button:hover {filter:brightness(1.15);}
.photo-review {border-top:1px solid #654e6a;padding-top:14px;display:flex;flex-wrap:wrap;gap:10px;align-items:end;}
.photo-review label {flex:1 1 190px;font-size:.88rem;color:#e5d4ea;}
.photo-review input {width:100%;max-width:100%;font-size:.82rem;}
@media(max-width:520px){#images .photo-card{padding:14px;}.photo-comparison img{height:125px;}.photo-actions button,.photo-actions a{flex:1 1 140px;text-align:center;}}

/* Authenticated AEGIS VAULT guardian: same asset as the login screen.
   A fixed, non-interactive backdrop preserves legibility and controls. */
body.authenticated {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 52% 23%, #392048 0%, #1b1028 48%, #0d0915 100%);
  background-attachment: fixed;
}
body.authenticated::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("/guardian.svg") center 44% / min(85vw, 760px) auto no-repeat;
  opacity: .20;
  filter: drop-shadow(0 0 32px rgba(204, 143, 255, .45));
}
body.authenticated .vault-top,
body.authenticated #upload,
body.authenticated #images .photo-card {
  background-color: rgba(24, 14, 36, .86);
  backdrop-filter: blur(5px);
}
@media (max-width: 600px) {
  body.authenticated::before {
    background-position: center 35%;
    background-size: 115vw auto;
    opacity: .14;
  }
}
@media (prefers-reduced-transparency: reduce) {
  body.authenticated .vault-top,
  body.authenticated #upload,
  body.authenticated #images .photo-card { backdrop-filter: none; }
}

/* Versioned informed consent and per-photo identifier */
.consent-panel { padding: 1.25rem; margin: 1rem 0; border: 1px solid rgba(215,177,255,.5); border-radius: 16px; background: rgba(35,20,48,.92); }
.consent-panel p { line-height: 1.65; white-space: pre-wrap; }
.consent-panel label { display: flex; gap: .7rem; align-items: flex-start; margin: 1rem 0; }
.consent-panel input[type=checkbox] { width: 1.2rem; height: 1.2rem; flex: none; }
.photo-identifier { display: block; font-size: .73rem; overflow-wrap: anywhere; opacity: .85; margin-top: .5rem; }

/* Image watermark verifier */
.verify-panel { margin: 1.5rem 0; padding: 1.25rem; border: 1px solid rgba(208,166,255,.5); border-radius: 16px; background: rgba(29,17,43,.88); }
.verify-panel p { line-height: 1.5; }
.verify-panel form { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; }
.verify-panel label { flex: 1 1 240px; }
#verify-result { font-weight: 650; overflow-wrap: anywhere; }
.verify-disclaimer { opacity: .78; font-size: .86rem; }
