@import url("https://fonts.cdnfonts.com/css/din-1451");

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

body {
  font-family: "DIN 1451", "DIN 1451 Mittelschrift", "Bahnschrift", "D-DIN", "DIN Alternate", Arial, sans-serif;
  background: #ffffff;
  color: #282d37;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  -webkit-font-smoothing: antialiased;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.topbar {
  width: 100%;
  max-width: 680px;
  border-bottom: 3px solid #ec0016;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: #ec0016;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.subtitle {
  font-size: 1rem;
  font-weight: 700;
  color: #282d37;
  margin-top: 0.3rem;
}

.expiry-info {
  font-size: 0.88rem;
  font-weight: 400;
  color: #646973;
  margin-top: 0.15rem;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.lang-select {
  padding: 0.4rem 0.55rem;
  border: 1px solid #afb4bb;
  border-radius: 4px;
  background: #ffffff;
  color: #282d37;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.lang-select:hover,
.lang-select:focus {
  border-color: #ec0016;
  outline: none;
}

.back-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #afb4bb;
  border-radius: 4px;
  background: #ffffff;
  color: #282d37;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.back-btn:hover {
  border-color: #ec0016;
  color: #ec0016;
}

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

.upcoming-notice {
  background: #f8f9fa;
  border-left: 3px solid #ec0016;
  color: #282d37;
  font-size: 0.92rem;
  font-weight: 400;
  padding: 0.65rem 0.85rem;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1rem;
}

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

.card-tab {
  padding: 0.5rem 0.85rem;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  background: #f5f7f8;
  color: #282d37;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.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: 700;
  font-size: 1.05rem;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.bingo-board {
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(0.35rem, 1.2vw, 0.5rem);
  width: 100%;
  -webkit-touch-callout: none;
  user-select: none;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: #f8f9fa;
  background-size: cover;
  background-position: center;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  padding: clamp(0.25rem, 1vw, 0.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: clamp(0.68rem, calc(6.5vw / var(--cols)), 1.02rem);
  line-height: 1.2;
  color: #282d37;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
}

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

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

.bingo-board.readonly .tile:hover {
  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;
  pointer-events: none;
}

.tile.has-image .tile-label {
  color: #ffffff;
}

.tile-label {
  position: relative;
  z-index: 2;
  word-break: break-word;
  overflow-wrap: anywhere;
  pointer-events: none;
}

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

.tile.stamped::after {
  content: "✕";
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.75rem, calc(24vw / var(--cols)), 4.5rem);
  font-weight: 700;
  color: rgba(236, 0, 22, 0.85);
  background: rgba(236, 0, 22, 0.12);
  pointer-events: none;
}

.empty-state {
  padding: 1rem 0;
}

.empty-message {
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.5;
  color: #282d37;
}

.history-section {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #d7dce1;
}

.history-section h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #646973;
  margin-bottom: 0.75rem;
}

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

.history-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  background: #f8f9fa;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

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

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

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

.history-arrow {
  font-weight: 700;
  color: #ec0016;
}

.error-msg {
  border-left: 3px solid #ec0016;
  background: #f8f9fa;
  color: #282d37;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
}

.hidden {
  display: none;
}
