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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.app {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.title { font-size: 2rem; margin-bottom: 4px; }
.subtitle { color: #999; margin-bottom: 20px; }

.tally-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.beer-btn {
  position: relative;
  padding: 20px 12px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}

.beer-btn:active {
  transform: scale(0.96);
  background: #0f3460;
}

.badge {
  display: inline-block;
  min-width: 24px;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 0.85rem;
  background: #e94560;
  border-radius: 999px;
}

.feedback {
  margin-top: 24px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffd166;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.feedback.show {
  animation: feedback-fade 2s ease forwards;
}

@keyframes feedback-fade {
  0%   { visibility: visible; opacity: 0; transform: translateY(4px); }
  15%  { visibility: visible; opacity: 1; transform: translateY(0); }
  90%  { visibility: visible; opacity: 1; transform: translateY(0); }
  100% { visibility: hidden; opacity: 0; transform: translateY(0); }
}

/* ---------- Bottom action bar (camera / gallery) ---------- */

/* Keep page content clear of the fixed action bar. */
body {
  padding-bottom: 120px;
}

.bottom-actions {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.camera-btn,
.gallery-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 80px;
  height: 80px;
  color: #fff;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, background 0.1s ease;
}

.camera-btn .btn-icon,
.gallery-btn .btn-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.camera-btn .btn-label,
.gallery-btn .btn-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ccc;
}

.camera-btn:hover,
.gallery-btn:hover {
  background: #0f3460;
}

.camera-btn:active,
.gallery-btn:active {
  transform: scale(0.96);
  background: #0f3460;
}

.camera-btn:focus-visible,
.gallery-btn:focus-visible {
  outline: 2px solid #e94560;
  outline-offset: 2px;
}

/* ---------- Gallery modal ---------- */

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
}

.gallery-modal.open {
  display: flex;
}

.gallery-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  padding: 16px;
}

.gallery-modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-right: 36px;
}

.gallery-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: #fff;
  background: #e94560;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease;
}

.gallery-modal-close:hover {
  background: #ff5570;
}

.gallery-modal-close:active {
  transform: scale(0.92);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.gallery-item {
  position: relative;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  overflow: hidden;
}

.gallery-item-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #0f3460;
}

.gallery-item-timestamp {
  display: block;
  padding: 6px 4px;
  font-size: 0.7rem;
  color: #999;
  text-align: center;
}

.gallery-item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.1s ease;
}

.gallery-item-delete:hover {
  background: #e94560;
}

.gallery-item-delete:active {
  transform: scale(0.9);
}

.gallery-empty {
  padding: 24px 8px;
  color: #999;
  font-size: 0.95rem;
}

@media (min-width: 480px) {
  .tally-grid { grid-template-columns: repeat(3, 1fr); }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
