/* Styles for the phone pages (welcome, upload, my photos) and the admin area. */
:root {
  --bg: #f5f3ef;
  --fg: #1f1d2b;
  --muted: #6b6878;
  --card: #ffffff;
  --border: #e3dfd8;
  --primary: #e4572e;
  --primary-fg: #ffffff;
  --secondary: #1f1d2b;
  --danger: #c0392b;
  --success: #2e7d4f;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15141c;
    --fg: #f1eff5;
    --muted: #a19eae;
    --card: #211f2b;
    --border: #353242;
    --secondary: #f1eff5;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h1 { font-size: 1.5rem; margin: .2em 0 .6em; }
code { background: var(--border); padding: 0 .3em; border-radius: 4px; }

.container { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.container.wide { max-width: 1200px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 4px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); margin: 0; }
.success { color: var(--success); }
.danger { color: var(--danger); }

.hero { text-align: center; padding: 28px 0 18px; }
.hero-icon { font-size: 3rem; }

label { font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=url], select {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--fg);
}
input[type=color] { width: 64px; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: var(--bg); }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg);
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); color: var(--bg); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-big { padding: 22px; font-size: 1.15rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; }
.hello { font-size: 1.3rem; font-weight: 700; }

/* Upload progress list */
.upload-list { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 8px; }
.upload-item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.upload-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--border); }
.upload-item .info { flex: 1; min-width: 0; }
.upload-item .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-item.done .progress > div { background: var(--success); }
.upload-item.failed .progress > div { background: var(--danger); }

/* Photo grids */
.photo-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.admin-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.photo-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.photo-card.is-hidden .thumb img { opacity: .35; }
.thumb { aspect-ratio: 1; background: var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.thumb-placeholder { font-size: 2rem; }
.photo-meta { padding: 8px 10px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.admin-grid .photo-meta { display: flex; flex-direction: column; align-items: stretch; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--border); }
.badge-published { background: #d7f0e0; color: #1d6b3d; }
.badge-pending, .badge-processing { background: #fdf0cf; color: #8a6100; }
.badge-error { background: #fbdcd8; color: #9c2b1f; }
.badge-hidden { background: #e2e0ea; color: #4c4960; }

/* Admin */
.admin-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.admin-nav .brand { font-weight: 800; text-decoration: none; }
.admin-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.admin-links a { text-decoration: none; font-weight: 500; padding: 4px 0; }
.admin-links a.active { color: var(--primary); border-bottom: 2px solid var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; text-decoration: none; display: flex; flex-direction: column; }
.stat b { font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.settings-form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.settings-form fieldset { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.settings-form legend { font-weight: 700; padding: 0 6px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 10px; }
.field-check input { width: 20px; height: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

h2 { font-size: 1.15rem; margin: 0; }
kbd { font: inherit; font-size: .8em; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; }
.board-name { text-align: center; font-weight: 700; color: var(--muted); margin: -8px 0 16px; }
.admin-crumbs { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.admin-crumbs b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.board-item { display: flex; flex-direction: column; gap: 8px; }
.board-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.board-item-name { font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.new-board { max-width: 480px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.font-preview { padding: 18px; border-radius: 10px; font-size: 2.2rem; text-align: center; text-shadow: 0 2px 6px rgba(0,0,0,.4); overflow-wrap: anywhere; }
.danger-zone { max-width: 720px; margin-top: 32px; border-color: var(--danger); }
