:root {
  --yellow: #FFD21E;
  --orange: #FF9D00;
  --bg: #fafaf7;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5b6270;
  --line: #e5e7eb;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f14;
    --surface: #171a21;
    --text: #f3f4f6;
    --muted: #a3a9b5;
    --line: #2a2f3a;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #f87171;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
a { color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 16px 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { flex: none; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.01em; }
h2 { margin: 0; font-size: 18px; }
.lede { margin: 10px 0 22px; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }

.actions { display: grid; gap: 12px; }
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 72px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--line);
  font-size: 19px; font-weight: 700; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent; transition: transform .08s ease;
}
.big-btn:active { transform: scale(.98); }
.big-btn.primary { background: var(--yellow); border-color: var(--yellow); color: #111; }
.big-btn .icon { font-size: 26px; }
input[type=file]:focus-visible + .big-btn, .big-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.card {
  margin-top: 20px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 14px; color: var(--muted); }
.card .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.card.highlight { border: 2px solid var(--yellow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: 14px; border: 0;
  background: var(--yellow); color: #111; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn.link { background: none; padding: 0 4px; min-height: 40px; color: var(--muted); text-decoration: underline; font-weight: 600; }
.small { font-size: 13px; color: var(--muted); margin-top: 10px !important; margin-bottom: 0 !important; }

#tray-section { margin-top: 26px; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tray { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; }
.tile .overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); }
.tile .ring { width: 46px; height: 46px; }
.tile .ring circle { fill: none; stroke-width: 5; }
.tile .ring .track { stroke: rgba(255,255,255,.35); }
.tile .ring .bar { stroke: var(--yellow); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .2s; }
.tile .badge {
  position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: rgba(0,0,0,.65); color: #fff;
}
.tile .badge.live { background: var(--ok); color: #fff; }
.tile .badge.pending { background: #92400e; }
.tile .badge.error { background: var(--err); }
.tile .remove {
  position: absolute; top: 6px; right: 6px; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.tile .remove.confirm { background: var(--err); }
.tile button.retry { position: absolute; inset: 0; background: transparent; border: 0; cursor: pointer; }

.note { margin-top: 18px; font-size: 14px; }
.note.warn { color: var(--warn); }

.account {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); font-size: 14px; text-align: center;
}
.account img { width: 26px; height: 26px; border-radius: 50%; }
.account .who { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.account .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #111827; color: #fff;
  font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.frame-banner {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--yellow); color: #111; font-size: 14px; font-weight: 600;
}
.pill { padding: 6px 12px; border-radius: 999px; background: #111; color: #fff; text-decoration: none; font-weight: 700; }
[hidden] { display: none !important; }
