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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #fff;
  color: #333;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.caffeine-total {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.total-amount {
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
}

.total-label {
  font-size: 24px;
  font-weight: 500;
  color: #666;
}

.daily-limit {
  font-size: 14px;
  color: #999;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  background: #333;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 4px;
}

.progress-fill.warning {
  background: #ff9500;
}

.progress-fill.danger {
  background: #ff3b30;
}

.drinks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.drink-card {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  min-height: 110px;
}

.drink-card:active {
  transform: scale(0.95);
  border-color: #333;
}

.drink-icon {
  font-size: 32px;
}

.drink-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.drink-volume {
  font-size: 11px;
  color: #999;
}

.drink-caffeine {
  font-size: 12px;
  color: #666;
  font-weight: 500;
}

.history {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f8f8;
  border-radius: 8px;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.history-item-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.history-item-time {
  font-size: 13px;
  color: #999;
}

.history-item-name {
  font-size: 14px;
  font-weight: 500;
}

.history-item-caffeine {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.history-log-btn {
  width: 100%;
  padding: 16px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.history-log-btn:active {
  transform: scale(0.98);
  border-color: #333;
}

.reset-btn {
  width: 100%;
  padding: 16px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:active {
  transform: scale(0.98);
  border-color: #333;
  color: #333;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:active {
  background: #f0f0f0;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.no-history {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-size: 14px;
}

.log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8f8f8;
  border-radius: 12px;
  margin-bottom: 12px;
}

.log-date {
  font-size: 15px;
  font-weight: 500;
  color: #333;
}

.log-details {
  display: flex;
  align-items: center;
  gap: 16px;
}

.log-total {
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

.log-total.warning {
  color: #ff9500;
}

.log-total.danger {
  color: #ff3b30;
}

.log-items {
  font-size: 13px;
  color: #999;
}