/* HiveAlbum design system */
:root {
  --bg: #fbf8f3; --surface: #ffffff; --surface-2: #f6f1e8; --line: #eae3d8; --line-2: #ddd3c4;
  --ink: #1f1b16; --ink-2: #4a4238; --muted: #857a6d; --faint: #b0a597;
  --honey: #f2a93b; --honey-2: #e39424; --honey-soft: #fdf1dc; --honey-ink: #8a5a12;
  --ok: #2e9d6b; --ok-soft: #e3f4ec; --bad: #d64545; --bad-soft: #fbe7e5; --warn: #c9861a;
  --radius: 14px; --radius-lg: 20px; --shadow: 0 1px 2px rgba(31,27,22,.05), 0 4px 16px rgba(31,27,22,.06);
  --shadow-lg: 0 20px 60px rgba(31,27,22,.18);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body { margin: 0; overflow-x: hidden; overflow-x: clip; max-width: 100vw; background: var(--bg); color: var(--ink); font: 15.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--honey-ink); }
img, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0; }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .tiny { font-size: 12px; }
.grow { flex: 1; } .row { display: flex; gap: 10px; align-items: center; } .wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo b { font-weight: 500; }
.hex { color: var(--honey); font-size: 1.25em; line-height: 1; display: inline-block; }
.hex.spin { animation: spin 1.1s linear infinite; font-size: 36px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 650; font-size: 15px; text-decoration: none;
  cursor: pointer; transition: background .15s, border-color .15s, transform .06s, box-shadow .15s; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--honey); border-color: var(--honey); color: var(--on-accent, #1f1b16); box-shadow: 0 2px 0 var(--honey-2); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { min-height: 56px; padding: 14px 24px; font-size: 17px; border-radius: 16px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }

/* forms */
.field { display: block; margin: 14px 0; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.input, .field input, .field textarea, .field select { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 12px 14px; min-height: 46px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--honey); box-shadow: 0 0 0 4px rgba(242,169,59,.18); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.err { color: var(--bad); font-size: 14px; min-height: 1.3em; margin: 8px 0; }
.switch { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch:first-child { border-top: 0; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.switch b { display: block; font-weight: 650; }
.switch small { color: var(--muted); font-size: 13.5px; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.pad { padding: 22px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.pill.honey { background: var(--honey-soft); color: var(--honey-ink); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* media grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } .tile { border-radius: 6px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; } }
.tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; border: 0; padding: 0; display: block; width: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tile:hover img { transform: scale(1.03); }
.tile .badge { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.62); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; display: flex; gap: 4px; align-items: center; }
.tile .flag { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.92); color: var(--ink); }
.tile .flag.pending { background: var(--honey); }
.tile .flag.hidden { background: var(--ink); color: #fff; }
.tile .flag.failed { background: var(--bad); color: #fff; }
.tile .work { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(251,248,243,.78); font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-align: center; padding: 8px; }
.tile .check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.25); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.tile.selected { outline: 3px solid var(--honey); outline-offset: -3px; }
.tile.selected .check { background: var(--honey); }
.tile.selected .check::after { content: "✓"; display: grid; place-items: center; height: 100%; font-size: 13px; font-weight: 900; color: #1f1b16; }
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--honey), var(--honey-2)); transition: width .3s; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: #0b0908; display: flex; flex-direction: column; color: #fff; }
.lightbox .lb-top { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
.lightbox .lb-top .who { font-weight: 650; font-size: 14.5px; }
.lightbox .lb-top .when { font-size: 12.5px; opacity: .65; }
.lightbox .lb-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 18px; cursor: pointer; display: grid; place-items: center; text-decoration: none; }
.lightbox .lb-btn:hover { background: rgba(255,255,255,.2); }
.lightbox .lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; touch-action: pan-y; }
.lightbox .lb-top, .lightbox .lb-bottom { position: relative; z-index: 3; }
.lightbox .lb-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.lightbox .lb-stage img, .lightbox .lb-stage video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lightbox .lb-stage video { width: 100%; height: 100%; background: #000; }
.lightbox .lb-nav { z-index: 2; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox .lb-prev { left: 10px; } .lightbox .lb-next { right: 10px; }
@media (pointer: coarse) { .lightbox .lb-nav { display: none; } }
.lightbox .lb-bottom { padding: 10px 14px max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* modal */
.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(31,27,22,.45); backdrop-filter: blur(2px); }
.modal .m-body { padding: 24px; }
.modal h2 { font-size: 21px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); text-align: center; }

/* simple pages */
.center-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.message { text-align: center; max-width: 420px; }
.message h1 { font-family: var(--serif); font-size: 30px; margin-top: 28px; }
.message p { color: var(--muted); }
.boot { min-height: 70vh; display: grid; place-items: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .hex { font-size: 44px; opacity: .7; }

/* iOS Safari zooms into any focused field under 16px and leaves the page zoomed. Keep every field at 16px on touch devices. */
@media (pointer: coarse) { input, select, textarea, .input, .field input, .field textarea, .field select, .sheet-form textarea { font-size: 16px !important; } }
