* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background-color: #fdfaf5;
  color: #3d2b1f;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  padding: 20px 14px 60px;
}
.container {
  max-width: 780px;
  margin: 0 auto;
}
header {
  text-align: center;
  padding: 40px 0 30px;
}
h1 {
  font-size: 2.6rem;
  font-weight: 500;
  color: #5d4037;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.tagline {
  font-size: 1.1rem;
  color: #8d6e63;
  font-style: italic;
  margin-bottom: 12px;
}
.updated {
  font-size: 0.95rem;
  color: #a1887f;
}
.controls {
  text-align: center;
  margin: 20px 0 30px;
  font-size: 1rem;
  color: #6d4c41;
}
.controls label {
  background: #6d4c41;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-block;
  transition: background 0.2s;
}
.controls label:hover {
  background: #8d6e63;
}
.controls input[type="file"] {
  display: none;
}
.controls button {
  background: #6d4c41;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 12px;
  transition: background 0.2s;
}
.controls button:hover {
  background: #8d6e63;
}
main {
  background: #fffef9;
  border: 1px solid #f0e4d9;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 4px 14px rgba(139, 69, 19, 0.06), 0 1px 3px rgba(139, 69, 19, 0.08);
  min-height: 200px;
}
#content {
  margin-bottom: 28px;
}
.category {
  margin-bottom: 36px;
}
.category h2 {
  font-size: 1.55rem;
  color: #6d4c41;
  padding-bottom: 10px;
  border-bottom: 2px solid #f5e8d3;
  margin-bottom: 18px;
  font-weight: 500;
}
.item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed #e6d5c0;
  gap: 16px;
}

.add-item-btn {
  position: absolute;
  bottom: -16px;
  left: calc(50% + 20px);
  transform: translateX(-50%);
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #a1887f;
  color: white;
  font-size: 13.5px;
  font-weight: bold;
  line-height: px;
  text-align: center;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
  z-index: 5;
}

.add-item-btn:hover,
.add-item-btn:focus {
  opacity: 1;
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.add-item-btn:active {
  transform: translateX(-50%) scale(0.95);
}

.remove-item-btn {
  position: absolute;
  bottom: 0px;
  left: calc(50%); /* left of + button, adjust spacing */
  transform: translateX(-50%);
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #a1887f;
  color: white;
  font-size: 13.5px;
  font-weight: bold;
  line-height: 21px;
  text-align: center;
  border: none;
  cursor: pointer;
  opacity: .7;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.item:hover .remove-item-btn {
  opacity: 0.8;
}

.remove-item-btn:hover,
.remove-item-btn:focus {
  opacity: 1;
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.remove-item-btn:active {
  transform: translateX(-50%) scale(0.95);
}

.item:last-child {
  border-bottom: none;
}

.item.dragging {
  opacity: 0.35;
  background: rgba(161, 136, 127, 0.15); /* faint brown tint */
  transform: scale(0.98);
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Placeholder during drag (faded + slightly askew) */
.drag-placeholder {
  opacity: 0.25;
  transform: rotate(-3deg) scale(0.98);
  background: rgba(161, 136, 127, 0.08);
  border: 2px dashed #a1887f;
  border-radius: 8px;
  pointer-events: none;
  transition: all 0.2s ease;
}

.item[draggable="true"] {
  cursor: grab;
}

.item[draggable="true"]:active {
  cursor: grabbing;
}

.item.drag-over {
  border-top: 3px solid #a1887f;
  margin-top: -3px; /* compensate for border thickness */
  background: rgba(161, 136, 127, 0.05);
  transition: border-top 0.2s ease;
}

.name {
  font-weight: 500;
  color: #3d2b1f;
  user-select: none;          /* prevent selection by default */
  -moz-user-select: none;
  -webkit-user-select: none;
}
.portion {
  font-size: 0.92rem;
  color: #8d6e63;
  font-style: italic;
}
.price {
  font-weight: 600;
  color: #5d4037;
  white-space: nowrap;
  font-size: 1.05rem;
  user-select: none;          /* prevent selection by default */
  -moz-user-select: none;
  -webkit-user-select: none;
}

.name[contenteditable="true"],
.price[contenteditable="true"] {
  outline: none;
  background: rgba(255, 255, 200, 0.3);
  border: 1px dashed #ccc;
  border-radius: 4px;
  padding: 2px 6px;
  min-width: 40px;
  caret-color: #0066cc;
}

.name[contenteditable="true"]:focus,
.price[contenteditable="true"]:focus {
  background: white;
  border: 1px solid #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.name:hover,
.price:hover {
  cursor: text;
  background: rgba(109, 76, 65, 0.04); /* subtle hover hint */
}

.note {
  font-size: 0.88rem;
  color: #9c7c6f;
  padding: 14px 18px;
  background: #fdf8f0;
  border-radius: 10px;
  border-left: 4px solid #d7b99f;
}
.asterisk {
  font-size: 0.77rem;
  color: #9c7c6f;
  margin-top: 14px;
  margin-bottom: 7px;
  font-style: italic;
  text-align: center;
}
footer {
  text-align: center;
  margin-top: 40px;
  color: #a1887f;
  font-size: 0.9rem;
}
.loading, .error, .info {
  text-align: center;
  padding: 40px 20px;
  color: #8d6e63;
  font-style: italic;
}
.error {
  color: #c62828;
}



@media (max-width: 520px) {
  h1 { font-size: 2.1rem; }
  .item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .price { font-size: 1.1rem; }
}
@media print {
  .controls {
    display: none !important;
  }
  .name[contenteditable="true"],
  .price[contenteditable="true"] {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    caret-color: transparent !important;
    user-select: text !important;
  }
  .add-item-btn {
    display: none !important;
  }
  .remove-item-btn {
    display: none !important;
  }
  .item.drag-over {
    display: none !important;
  }

}
