* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #111;
  background: #f6f6f4;
}
main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { text-align: center; margin: .5rem 0; }
.subtitle, .hint { text-align: center; color: #444; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: #222; color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar .brand { font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; }
button.link { background: none; border: none; color: #ccc; cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: #fff; text-decoration: underline; }

.login-card {
  max-width: 460px; margin: 4rem auto; padding: 2rem;
  background: #fff; border: 2px solid #111; text-align: center;
}
.login-card form { display: flex; gap: .5rem; margin-top: 1rem; }
.login-card input { flex: 1; }

input, textarea {
  font: inherit; padding: .5rem; border: 1px solid #999; border-radius: 4px; width: 100%;
}
button {
  font: inherit; padding: .5rem 1rem; border-radius: 4px; border: 1px solid #111;
  background: #111; color: #fff; cursor: pointer;
}
button.secondary { background: #fff; color: #111; }
button.danger { background: #fff; color: #b00020; border-color: #b00020; }
.error { color: #b00020; min-height: 1em; }

.status {
  text-align: center; font-weight: 600; margin: 1rem auto; padding: .5rem;
  border-radius: 6px; max-width: 600px;
}
.status.win { background: #fff3cd; }
.status.pop { animation: pop .8s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }

.board {
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  border: 2px solid #111;
  background: #fff;
}
.cell {
  position: relative;
  aspect-ratio: 1 / 0.75;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  padding: .6rem;
  text-align: left;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
  font-size: .95rem;
}
button.cell:hover { background: #f0f7ff; }
.cell .note {
  font-size: .72rem; color: #555; margin-top: .3rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cell.has-note::after {
  content: "📝"; position: absolute; top: 3px; right: 5px; font-size: .75rem;
}
.cell.free { background: #fdf0cf; }
.cell.marked { background: #e6f4ea; }
.cell.marked .label { text-decoration: line-through; text-decoration-thickness: 2px; color: #555; }
.cell.free.marked .label { text-decoration: none; color: #111; }
.cell.marked:not(.free)::before {
  content: "✔"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; color: rgba(0, 140, 60, .18); pointer-events: none;
}
.cell.in-bingo { background: #c8ecd4; }
.cell.free.in-bingo { background: #fbe3a6; }

.awards { margin-top: 2rem; }
.awards ul { padding-left: 1.2rem; }
.awards li { margin: .3rem 0; }

dialog { border: 2px solid #111; border-radius: 8px; width: min(520px, 92vw); padding: 1.2rem; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin-top: 0; }
dialog label { display: block; margin: .8rem 0; font-weight: 600; }
dialog label textarea, dialog label input:not([type=checkbox]) { margin-top: .3rem; font-weight: 400; }
dialog label.check { display: flex; gap: .5rem; align-items: center; }
dialog label.check input { width: auto; }
.actions { display: flex; gap: .5rem; justify-content: flex-end; }

.table { width: 100%; border-collapse: collapse; background: #fff; margin: 1rem 0 2rem; }
.table th, .table td { border: 1px solid #ccc; padding: .45rem .6rem; text-align: left; vertical-align: top; }
.table th { background: #222; color: #fff; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.pill { display: inline-block; background: #fdf0cf; border-radius: 999px; padding: .1rem .6rem; margin: .15rem; font-size: .85rem; }

@media (max-width: 640px) {
  .cell { font-size: .7rem; padding: .3rem; aspect-ratio: 1 / 1; }
  .cell .note { display: none; }
}

/* ---- v2 additions ---- */
.muted { color: #888; }
.topbar a.muted { color: #999; }
.board-switch { font: inherit; padding: .2rem .4rem; border-radius: 4px; max-width: 220px; }
.flash { background: #e8f0fe; border: 1px solid #9ab; padding: .6rem .8rem; border-radius: 6px; margin-bottom: 1rem; }
.error-flash { background: #fde8ea; border-color: #b00020; color: #b00020; }
a.button, .secondary-btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 4px; border: 1px solid #111;
  background: #111; color: #fff; text-decoration: none; cursor: pointer;
}
a.button.secondary, .secondary-btn { background: #fff; color: #111; }
.danger-link { color: #b00020 !important; }
.cat { display: inline-block; font-size: .75rem; background: #eef; color: #335; border-radius: 999px; padding: .05rem .5rem; margin: 0; }

/* attachments in dialog */
.attachments { margin: .8rem 0; }
.attachments ul { list-style: none; padding: 0; margin: .4rem 0; }
.attachments li { display: flex; align-items: center; gap: .4rem; margin: .25rem 0; word-break: break-all; }
.attachments li img { width: 48px; height: 36px; object-fit: cover; border: 1px solid #ccc; margin-right: .4rem; vertical-align: middle; }
.attachments label.upload { display: inline-block; font-weight: 400; margin: 0; }

/* hall of fame */
.hof-player { background: #fff; border: 2px solid #111; border-radius: 8px; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.hof-player h2 { margin: 0 0 .6rem; }
.hof-player h2 small { font-size: .85rem; font-weight: 400; color: #555; margin-left: .5rem; }
.hof-entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.hof-entry { border: 1px solid #ccc; border-radius: 6px; padding: .6rem .8rem; background: #fafafa; }
.hof-entry.done { border-left: 5px solid #2e8b57; }
.hof-entry.open { border-left: 5px solid #e0a800; }
.hof-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.hof-entry .tick { color: #2e8b57; font-weight: 700; }
.hof-entry .loc { margin-top: .3rem; word-break: break-all; font-size: .9rem; }
.hof-entry blockquote { margin: .4rem 0; font-style: italic; color: #333; white-space: pre-wrap; }
.hof-entry .when { font-size: .72rem; color: #999; margin-top: .3rem; }
.att-gallery { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.att { display: flex; align-items: flex-start; gap: .2rem; }
.att form { margin: 0; }
.att img { width: 110px; height: 80px; object-fit: cover; border: 1px solid #ccc; border-radius: 4px; }
.att a.file { font-size: .85rem; word-break: break-all; }

/* statistics */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin: 1rem 0 1.5rem; }
.tile { background: #fff; border: 2px solid #111; border-radius: 8px; padding: .8rem; text-align: center; color: #444; }
.tile .num { display: block; font-size: 2rem; font-weight: 700; color: #111; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.most-found li { margin: .3rem 0; }
.bars { width: 100%; border-collapse: collapse; }
.bars td { padding: .25rem .3rem; }
.bar-label { white-space: nowrap; width: 1%; }
.bar-cell { width: 100%; }
.bar { height: 1.1rem; background: linear-gradient(90deg, #f0a35e, #d9480f); border-radius: 3px; min-width: 2px; }
.bar-num { text-align: right; width: 1%; font-weight: 600; }
.board.heat .cell { background: rgba(217, 72, 15, calc(var(--heat, 0) * .85)); aspect-ratio: 1 / .6; }
.board.heat .cell.free { background: #fdf0cf; }
.heat-num { position: absolute; bottom: 4px; right: 6px; font-weight: 700; font-size: .9rem; }

/* admin */
tr.archived td { color: #999; }
.admin-actions { white-space: nowrap; }
.admin-actions a, .admin-actions form { display: inline-block; margin-right: .5rem; }
.admin-actions button.link { color: #0645ad; }
.board-form label { display: block; margin: 1rem 0; font-weight: 600; }
.board-form label small { font-weight: 400; color: #555; }
.board-form input, .board-form textarea { margin-top: .3rem; font-weight: 400; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .9rem; }

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: .5rem; }
}

/* CSV export */
.export-links { text-align: center; margin: -0.5rem 0 1rem; font-size: 0.9rem; color: #666; }
.export-links a { font-weight: 600; }


.login-card form.stacked { flex-direction: column; }
.login-card form.stacked a { font-size: .9rem; }

