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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

header {
  text-align: center;
  padding: 20px 0 12px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c2c2c;
}

/* Input section */
.input-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.input-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #555;
}

.input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-row input[type="text"] {
  flex: 2;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.input-row input[type="number"] {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.input-row input:focus {
  outline: none;
  border-color: #4a90d9;
}

.input-row button {
  padding: 10px 20px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

.input-row button:hover {
  background: #357abf;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-print {
  padding: 10px 24px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}

.btn-print:hover {
  background: #219150;
}

.btn-clear {
  padding: 10px 24px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}

.btn-clear:hover {
  background: #c0392b;
}

.empty-msg {
  margin-top: 12px;
  color: #999;
  font-size: 0.9rem;
}

/* Preview section */
.preview-section {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.preview-title {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 16px;
}

.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Price tag */
.price-tag {
  width: 120px;
  height: 75px;
  border: 2px solid #333;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: #fff;
  position: relative;
  cursor: default;
}

.price-tag .tag-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  color: #333;
  word-break: break-all;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
}

.price-tag .tag-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #c0392b;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.price-tag .delete-btn {
  position: absolute;
  top: 2px;
  right: 4px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.price-tag .delete-btn:hover {
  color: #e74c3c;
}

/* Print styles */
@media print {
  body {
    background: #fff;
  }

  #inputSection,
  .preview-title {
    display: none !important;
  }

  .app-container {
    padding: 0;
    max-width: 100%;
  }

  header {
    display: none;
  }

  .preview-section {
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  .tags-grid {
    gap: 8px;
  }

  .price-tag {
    border: 1.5px solid #000;
    page-break-inside: avoid;
  }

  .price-tag .delete-btn {
    display: none;
  }
}

@media (max-width: 480px) {
  .input-row {
    flex-direction: column;
  }

  .input-row input[type="text"],
  .input-row input[type="number"] {
    width: 100%;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn-print,
  .btn-clear {
    width: 100%;
    text-align: center;
  }
}
