/* Mobile-first: base styles target small phone screens */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f7;
  color: #1c1c1e;
  /* leave room for the fixed Done button at the bottom */
  padding-bottom: 80px;
}

.page-header {
  padding: 16px;
  background: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

.page-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

main {
  padding: 8px 0;
}

.category {
  margin: 16px 0;
}

.category-title {
  margin: 0;
  padding: 8px 16px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6e6e73;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.item-row {
  /* the entire row is the tap target */
  padding: 14px 16px;
  font-size: 1rem;
  border-bottom: 1px solid #efefef;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* stop iOS from showing the copy/share callout on long-press */
  -webkit-touch-callout: none;
  /* let vertical scrolling through, but hand taps straight to JS */
  touch-action: manipulation;
}

.item-row:last-child {
  border-bottom: none;
}

.item-row.selected {
  background-color: #dceeff;
}

.add-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.95rem;
  color: #007aff;
  cursor: pointer;
}

.add-form {
  margin: 0;
}

.add-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1c1c1e;
  background: #f5f5f7;
  border: none;
  box-sizing: border-box;
}

.add-input:focus {
  outline: none;
}

.done-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e0e0e0;
}

.done-button {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: #007aff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #1c1c1e;
  color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.toast[hidden] {
  display: none;
}

.toast-message {
  font-size: 0.9rem;
}

.toast-undo {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #6ab0ff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

/* On wider screens, keep the prototype centered like a phone */
@media (min-width: 480px) {
  body {
    max-width: 420px;
    margin: 0 auto;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
  }

  .done-bar {
    max-width: 420px;
    margin: 0 auto;
  }

  .toast {
    max-width: 420px;
    margin: 0 auto;
    left: 0;
    right: 0;
  }
}
