:root {
  --paper: #fffdf9;
  --paper-soft: #f7f3ed;
  --paper-deep: #eee8df;
  --ink: #161412;
  --muted: #756f68;
  --accent: #8a5c4d;
  --accent-dark: #71473b;
  --success: #4b7656;
  --danger: #97404d;
  --line: rgba(22, 20, 18, .24);
  --line-soft: rgba(22, 20, 18, .11);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #fff 0%, var(--paper) 56%, #faf7f2 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.photo-shell { padding-top: max(10px, env(safe-area-inset-top)); }
.root-shell { padding-top: max(18px, env(safe-area-inset-top)); }

.hero { text-align: center; }
.wedding-hero { padding: 0 10px 22px; }
.brand-illustration {
  display: block;
  width: min(74vw, 310px);
  max-height: 280px;
  object-fit: contain;
  margin: 0 auto -8px;
}
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 10vw, 48px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.025em;
}
.brand-divider {
  width: min(210px, 56vw);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px auto 9px;
}
.brand-divider span { height: 1px; background: rgba(22,20,18,.55); }
.brand-divider b {
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
}
.lead {
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
  font-size: 13px;
  letter-spacing: .01em;
}

.picker-section { margin-top: 2px; }
.action-card {
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: 54px 1fr 22px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  color: var(--ink);
  background: rgba(255,255,255,.86);
  border: 1.35px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(22,20,18,.04);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.action-card:active { transform: translateY(1px); background: var(--paper-soft); }
.action-card:focus-visible { outline: 3px solid rgba(138,92,77,.18); outline-offset: 2px; }
.action-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
}
.action-icon svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.action-copy strong { font-size: 16px; line-height: 1.2; font-weight: 620; }
.action-copy small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.action-chevron { font-family: Arial, sans-serif; font-size: 34px; line-height: 1; font-weight: 300; transform: translateY(-1px); }
.microcopy { text-align: center; color: var(--muted); font-size: 10.5px; margin: 9px 0 0; }

.selection, .upload-panel, .success {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.selection, .upload-panel, .success { margin-top: 12px; }
.selection-head { display: flex; justify-content: space-between; align-items: end; padding: 1px 1px 12px; }
.kicker { color: var(--accent); letter-spacing: .17em; font-size: 9px; font-weight: 760; display: inline-block; margin-bottom: 5px; }
h2 { font-family: Georgia, "Times New Roman", serif; margin: 0; font-size: 24px; line-height: 1.08; font-weight: 500; }
.text-button { background: none; border: 0; color: var(--accent); padding: 10px 0 10px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }

.primary, .secondary {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.primary { border: 1px solid var(--ink); background: var(--ink); color: white; box-shadow: none; }
.primary:active { background: #2c2926; transform: translateY(1px); }
.primary:disabled { opacity: .48; cursor: not-allowed; }
.secondary { margin-top: 8px; background: transparent; color: var(--ink); border: 1px solid var(--line); }

.file-list { max-height: 315px; overflow: auto; border-top: 1px solid var(--line-soft); }
.file-row { display: grid; grid-template-columns: 46px 1fr 34px; gap: 10px; align-items: center; min-height: 62px; border-bottom: 1px solid var(--line-soft); }
.thumb { width: 42px; height: 42px; border-radius: 9px; overflow: hidden; display: grid; place-items: center; background: var(--paper-deep); color: var(--accent); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { font-family: Georgia, serif; }
.file-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.file-size { font-size: 10px; color: var(--muted); }
.remove-file { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.summary-row { display: flex; justify-content: space-between; color: var(--muted); padding: 12px 2px 13px; font-size: 11px; }
.summary-row strong { color: var(--ink); }

.upload-panel { padding: 18px 16px; }
.upload-panel > p { color: var(--muted); margin: 8px 0 16px; font-size: 12px; }
.progress-track { width: 100%; height: 7px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .15s linear; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10px; color: var(--muted); }
.progress-meta strong { color: var(--accent); }
.upload-items { margin-top: 13px; border-top: 1px solid var(--line-soft); }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 0; font-size: 10.5px; border-bottom: 1px solid var(--line-soft); }
.upload-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .ok { color: var(--success); font-weight: 750; }
.upload-item .error { color: var(--danger); font-weight: 750; }

.success { text-align: center; padding: 24px 16px 16px; }
.success .heart { font-family: Georgia, serif; color: var(--accent); font-size: 34px; line-height: 1; margin-bottom: 10px; }
.success p { color: var(--muted); line-height: 1.45; font-size: 12px; margin: 8px 0 18px; }
.success p strong { color: var(--ink); }

.my-photos { margin-top: 22px; }
.gallery-head { padding-bottom: 4px; }
.gallery-intro { margin: 4px 1px 12px; color: var(--muted); line-height: 1.4; font-size: 11px; }
.icon-button { border: 1px solid var(--line); background: white; color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.gallery-card { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; box-shadow: none; }
.gallery-preview { position: relative; width: 100%; aspect-ratio: 1 / .86; border: 0; padding: 0; overflow: hidden; background: var(--paper-deep); color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.gallery-preview:disabled { cursor: default; }
.gallery-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery-fallback { font-family: Georgia, serif; font-size: 26px; opacity: .7; }
.video-badge { position: absolute; z-index: 2; right: 7px; bottom: 7px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: white; background: rgba(22,20,18,.68); font-size: 9px; }
.preview-local-only::after { content: "Vorschau lokal"; position: absolute; left: 6px; bottom: 6px; z-index: 3; color: white; font-size: 8px; letter-spacing: .04em; background: rgba(22,20,18,.58); padding: 4px 6px; border-radius: 99px; }
.gallery-copy { padding: 8px 9px 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gallery-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10.5px; }
.gallery-meta { color: var(--muted); font-size: 8.5px; }
.gallery-state { color: var(--success); font-size: 8.5px; font-weight: 720; }
.gallery-actions { display: flex; justify-content: space-between; padding: 2px 5px 6px; gap: 4px; }
.text-action { border: 0; background: none; padding: 7px 4px; color: var(--accent); font-size: 10px; font-weight: 750; cursor: pointer; }
.text-action.danger { color: var(--danger); }

.toast { position: fixed; z-index: 50; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 36px), 420px); padding: 10px 13px; border-radius: 11px; background: var(--ink); color: white; text-align: center; font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.modal-open { overflow: hidden; }
.viewer { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 16px; }
.viewer-backdrop { position: absolute; inset: 0; background: rgba(20,18,17,.76); backdrop-filter: blur(6px); }
.viewer-card { position: relative; z-index: 2; width: min(100%, 900px); max-height: min(92dvh, 920px); border-radius: 16px; overflow: hidden; background: #171514; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.viewer-head { height: 50px; display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 0 8px 0 14px; background: #211e1c; color: white; }
.viewer-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.viewer-close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: white; font-size: 23px; cursor: pointer; }
.viewer-media { min-height: 260px; max-height: calc(92dvh - 50px); display: grid; place-items: center; color: rgba(255,255,255,.75); }
.viewer-object { display: block; max-width: 100%; max-height: calc(92dvh - 50px); width: auto; height: auto; object-fit: contain; }
video.viewer-object { width: 100%; }
.viewer-loading { font-size: 11px; padding: 60px 20px; }
.viewer-message { display: flex; flex-direction: column; text-align: center; gap: 6px; padding: 60px 26px; }
.viewer-message span { opacity: .7; font-size: 10px; }

footer { display: flex; justify-content: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .08em; padding: 24px 0 0; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.link-action-card { text-decoration: none; }

/* Admin stays intentionally more utilitarian. */
.admin-shell { width: min(100%, 560px); padding-top: max(36px, env(safe-area-inset-top)); }
.compact-hero { padding: 16px 6px 22px; }
.compact-hero .eyebrow { color: var(--muted); letter-spacing: .18em; font-size: 10px; font-weight: 760; margin-bottom: 10px; }
.compact-hero h1 { font-size: clamp(36px, 9vw, 48px); }
.admin-login, #adminPanel { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.field-label { display: block; font-size: 11px; font-weight: 750; margin: 0 0 7px; }
.admin-input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 11px; background: white; padding: 0 12px; margin-bottom: 10px; outline: none; }
.admin-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138,92,77,.1); }
.admin-status { min-height: 22px; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.admin-group { padding: 16px 0; border-top: 1px solid var(--line-soft); display: grid; gap: 7px; }
.radio-row, .switch-row { min-height: 40px; display: flex; align-items: center; gap: 9px; font-size: 13px; }
.radio-row span { margin-left: auto; color: var(--muted); font-size: 10px; }
.switch-row { justify-content: space-between; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.radio-row input { accent-color: var(--accent); }

@media (min-width: 520px) {
  .shell { padding-left: 22px; padding-right: 22px; }
  .brand-illustration { width: 300px; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-height: 720px) {
  .brand-illustration { width: min(55vw, 235px); max-height: 210px; }
  .wedding-hero { padding-bottom: 15px; }
  h1 { font-size: clamp(32px, 9vw, 42px); }
  .brand-divider { margin-top: 10px; }
}
