:root {
  --bg: #0d1420;
  --panel: #172234;
  --panel-2: #1f2d44;
  --line: #2c3d58;
  --text: #eef3fa;
  --muted: #93a3bb;
  --accent: #ffd166;
  --danger: #ef476f;
  --team: #ffd166;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

main.wide { max-width: 1000px; }

h1 { font-size: 1.6rem; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
a { color: var(--accent); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin: 16px 0;
}

button, .button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--team); color: #111; }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.link { background: none; padding: 4px; color: var(--muted); text-decoration: underline; font-weight: 400; }
.full { width: 100%; }

input[type=text], input[type=password], input[type=search] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* avoids iOS zoom on focus */
}
input:focus { outline: 2px solid var(--team); outline-offset: 1px; }
label { display: block; font-weight: 600; margin: 0 0 6px; }

.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.ok { color: #06d6a0; }
.hidden { display: none !important; }

/* Team picker */
.teams { display: grid; gap: 14px; }
.team-btn {
  padding: 26px 16px;
  font-size: 1.4rem;
  border-radius: 14px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  font-weight: 700;
}
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }

/* Upload */
.photo-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 12px;
}
.photo-drop img { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }
.photo-drop input { display: none; }

.suggestions { list-style: none; margin: 6px 0 0; padding: 0; border-radius: 10px; overflow: hidden; }
.suggestions li button {
  width: 100%;
  justify-content: flex-start;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  padding: 11px 14px;
}
.suggestions.scroll { max-height: 264px; overflow-y: auto; }
.suggestions .dots { margin-left: auto; display: inline-flex; gap: 4px; }

.chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel-2);
  font-weight: 700;
}
.chosen button { margin-left: auto; }

.progress { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--team); transition: width .2s; }

.stack > * + * { margin-top: 16px; }

/* Photo grids */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
}
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.thumb .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: .8rem;
}
.thumb .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .del {
  position: absolute;
  top: 6px; right: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .8rem;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
