* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "DB Screen Sans", "DB Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f0f3f5;
  color: #282d37;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
}

.topbar {
  width: 100%;
  max-width: 720px;
  background: #ffffff;
  border-top: 5px solid #ec0016;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 6px rgba(40, 45, 55, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.db-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #ec0016;
  border: 3.5px solid #ec0016;
  border-radius: 6px;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: #282d37;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: #646973;
  margin-top: 0.1rem;
}

.back-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 2px solid #282d37;
  background: #ffffff;
  color: #282d37;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.back-btn:hover {
  background: #282d37;
  color: #ffffff;
}

main {
  width: 100%;
  max-width: 720px;
}

.active-cards-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card-tab {
  flex: 1 1 auto;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  border: 2px solid #d7dce1;
  background: #ffffff;
  color: #282d37;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.card-tab:hover {
  border-color: #ec0016;
}

.card-tab.active {
  background: #ec0016;
  border-color: #ec0016;
  color: #ffffff;
}

.bingo-banner {
  background: #ec0016;
  color: #ffffff;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding: 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  box-shadow: 0 3px 10px rgba(236, 0, 22, 0.28);
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bingo-board {
  display: grid;
  gap: 0.65rem;
  width: 100%;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: #ffffff;
  background-size: cover;
  background-position: center;
  border: 2px solid #d7dce1;
  border-radius: 6px;
  padding: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: clamp(0.82rem, 2vw, 1rem);
  color: #282d37;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(40, 45, 55, 0.06);
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: #ec0016;
}

.bingo-board.readonly .tile {
  cursor: default;
}

.bingo-board.readonly .tile:hover {
  transform: none;
  border-color: #d7dce1;
}

.bingo-board.readonly .tile.stamped:hover {
  border-color: #ec0016;
}

.tile.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(40, 45, 55, 0.55);
  z-index: 1;
}

.tile.has-image .tile-label {
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.tile-label {
  position: relative;
  z-index: 2;
  word-break: break-word;
}

.tile.stamped {
  border-color: #ec0016;
}

.tile.stamped::after {
  content: "✕";
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 900;
  color: rgba(236, 0, 22, 0.88);
  background: rgba(236, 0, 22, 0.16);
  pointer-events: none;
}

.empty-state {
  background: #ffffff;
  border-radius: 6px;
  padding: 2rem 1.5rem;
  box-shadow: 0 2px 6px rgba(40, 45, 55, 0.08);
  text-align: center;
}

.empty-message {
  font-size: 1.1rem;
  font-weight: 700;
  color: #282d37;
}

.history-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid #d7dce1;
  text-align: left;
}

.history-section h2 {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #646973;
  margin-bottom: 0.75rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.history-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: #f8f9fa;
  border: 2px solid #d7dce1;
  border-radius: 6px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.history-item:hover {
  border-color: #ec0016;
  background: #ffffff;
}

.history-title {
  font-size: 1rem;
  font-weight: 700;
  color: #282d37;
}

.history-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: #646973;
  margin-top: 0.15rem;
}

.history-arrow {
  font-weight: 800;
  color: #ec0016;
  font-size: 1.1rem;
}

.error-msg {
  background: #ffffff;
  border-left: 4px solid #ec0016;
  color: #282d37;
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.hidden {
  display: none;
}
