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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 16px;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.app-header a {
  font-size: 14px;
  color: #4CAF50;
  text-decoration: none;
}

.btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-grid button {
  min-height: 56px;
  min-width: 56px;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-grid button.selected {
  border-color: #4CAF50;
  background: #E8F5E9;
  font-weight: 700;
}

.btn-primary {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #4CAF50;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.input-field {
  width: 100%;
  padding: 14px;
  border: 2px solid #ddd;
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 16px;
}

.input-field:focus {
  outline: none;
  border-color: #4CAF50;
}

textarea.input-field {
  min-height: 80px;
  resize: vertical;
}

.section-label {
  font-size: 14px;
  font-weight: 700;
  color: #666;
  margin-bottom: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

.item-list {
  list-style: none;
  margin-bottom: 16px;
}

.item-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.item-list .delete-btn {
  background: none;
  border: none;
  color: #e53935;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
}

.add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.add-form input {
  flex: 1;
}

.add-form button {
  min-width: 64px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: #4CAF50;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.setup-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 60dvh;
}

.setup-container h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.setup-container p {
  color: #666;
  margin-bottom: 24px;
}

.photo-section {
  margin-bottom: 16px;
}

.photo-buttons {
  display: flex;
  gap: 8px;
}

.btn-photo {
  flex: 1;
  min-height: 56px;
  padding: 16px;
  font-size: 16px;
  border: 2px dashed #4CAF50;
  background: transparent;
  color: #4CAF50;
  border-radius: 12px;
  cursor: pointer;
}

.photo-preview {
  position: relative;
}

.photo-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 12px;
}

.btn-remove-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
}

.setup-result.success {
  background: #E8F5E9;
  color: #2E7D32;
}

.setup-result.error {
  background: #FFEBEE;
  color: #C62828;
}

.header-links {
  display: flex;
  gap: 16px;
}

.header-links a {
  font-size: 14px;
  color: #4CAF50;
  text-decoration: none;
}

.history-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.history-filter button {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 16px;
  border: 2px solid #ddd;
  border-radius: 20px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.history-filter button.selected {
  border-color: #4CAF50;
  background: #E8F5E9;
  font-weight: 700;
}

.history-card {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.history-card .date {
  font-size: 12px;
  color: #999;
  margin-bottom: 2px;
}

.history-card .title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.history-card .thumb {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}

.history-card .memo {
  font-size: 14px;
  color: #666;
  white-space: pre-wrap;
}

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

.btn-load-more {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 16px 0;
  border: 2px solid #4CAF50;
  border-radius: 12px;
  background: transparent;
  color: #4CAF50;
  font-size: 14px;
  cursor: pointer;
}

.btn-load-more:disabled {
  color: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}

.harvest-days-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.harvest-days-input .input-field {
  width: 100px;
  margin-bottom: 0;
  text-align: center;
}

.harvest-days-suffix {
  font-size: 16px;
  color: #666;
}

.harvest-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.harvest-card.urgent {
  background: #FFF3E0;
  padding: 12px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  border-bottom: none;
}

.harvest-card.soon {
  background: #FFFDE7;
  padding: 12px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  border-bottom: none;
}

.harvest-date {
  font-size: 18px;
  font-weight: 700;
  color: #4CAF50;
  min-width: 48px;
  text-align: center;
}

.harvest-info {
  flex: 1;
  min-width: 0;
}

.harvest-crop {
  font-size: 16px;
  font-weight: 700;
}

.harvest-event {
  font-size: 12px;
  color: #999;
}

.harvest-days {
  font-size: 14px;
  font-weight: 700;
  color: #FF9800;
  white-space: nowrap;
}
