:root {
  --bg: #FFFBF4;
  --card: #FFFFFF;
  --ink: #1F1A14;
  --muted: #5B5247;
  --line: #E7DFD2;
  --accent: #1E4D8C;
  --accent-dark: #163A6A;
  --heart: #B83A1B;
  --ok: #2E7D4F;
  --warn: #8A5A00;
  --focus: #F2A93B;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

h1 { font-size: 28px; line-height: 1.15; margin: 0; font-weight: 800; }
h2 { font-size: 21px; margin: 0 0 10px; font-weight: 800; }
p { margin: 0; }

.muted { color: var(--muted); font-size: 16px; }
.center { text-align: center; }
.small { font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero {
  background: var(--accent);
  color: #fff;
  border: 0;
}
.hero .muted { color: #DCE6F4; }

button, .button {
  font: inherit;
  font-weight: 800;
  border-radius: 16px;
  min-height: 56px;
  padding: 12px 18px;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
button.primary { background: var(--accent); color: #fff; }
.hero button.primary { background: #fff; color: var(--accent); border-color: #fff; min-height: 68px; font-size: 22px; }
button.danger { border-color: var(--heart); color: var(--heart); }
button.link { border: 0; min-height: 44px; padding: 8px; background: none; font-weight: 700; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

label { font-weight: 700; font-size: 16px; display: block; margin-bottom: 6px; }
input[type=text], input[type=password] {
  font: inherit;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.picked {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.picked .tile {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #EEE7DA;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--muted);
}
.picked img, .picked video { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(31,26,20,.78); color: #fff; font-size: 13px; padding: 2px 8px; border-radius: 8px;
}

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px;
}
.item .thumb {
  width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0; background: #EEE7DA;
  object-fit: cover; display: block;
}
.item .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .title { font-weight: 800; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.status { font-size: 15px; font-weight: 700; }
.status.liked { color: var(--heart); }
.status.seen { color: var(--ok); }
.status.wait { color: var(--muted); }
.status.bad { color: var(--warn); }

.progress { height: 10px; background: #EEE7DA; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); width: 0; transition: width .3s; }

.qr { background: #fff; border-radius: 16px; padding: 12px; width: min(280px, 80vw); margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.code { font-size: 34px; font-weight: 800; letter-spacing: 4px; text-align: center; }

.tip { background: #FFF3DC; border: 1px solid #F0D9A8; border-radius: 16px; padding: 14px; font-size: 16px; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 528px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 14px 18px;
  font-weight: 700; text-align: center; z-index: 10;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
