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

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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: #1a1a2e;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #2c3e6e;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

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

.input-row label {
  font-size: 0.85rem;
  color: #555;
  min-width: 70px;
  flex-shrink: 0;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

input[type="text"],
input[type="number"],
select {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input:focus,
select:focus {
  border-color: #4a7fd4;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

button:active {
  opacity: 0.8;
}

.btn-full {
  width: 100%;
  margin-top: 8px;
  background: #4a7fd4;
  color: #fff;
  font-weight: 600;
  padding: 12px;
}

.btn-full:hover {
  background: #3a6bb8;
}

.btn-primary {
  background: #27ae60;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
}

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

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

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

/* 参加者タグ */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  border: 1px solid #c5d0f5;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.9rem;
  color: #2c3e6e;
}

.tag .remove-btn {
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
}

/* 支払い一覧 */
#paymentList {
  margin-top: 10px;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

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

.payment-info {
  flex: 1;
}

.payment-payer {
  font-weight: 600;
  color: #2c3e6e;
}

.payment-amount {
  color: #27ae60;
  font-weight: 700;
}

.payment-memo {
  font-size: 0.8rem;
  color: #888;
}

.payment-del {
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
}

.payment-del:hover {
  color: #e74c3c;
}

/* 精算結果 */
#result {
  margin-top: 16px;
}

.result-title {
  font-size: 1rem;
  font-weight: 700;
  color: #2c3e6e;
  margin-bottom: 10px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f0f9f4;
  border-left: 4px solid #27ae60;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.result-item .arrow {
  color: #27ae60;
  font-weight: 700;
}

.result-item .amount {
  font-weight: 700;
  color: #e74c3c;
  margin-left: auto;
}

.result-settled {
  text-align: center;
  color: #27ae60;
  font-weight: 700;
  padding: 16px;
  font-size: 1.1rem;
}

.result-error {
  color: #e74c3c;
  font-size: 0.9rem;
  padding: 8px;
}

.summary {
  background: #f8f9ff;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #555;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.reset-area {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 24px;
}

@media (max-width: 400px) {
  h1 {
    font-size: 1.2rem;
  }

  .input-row label {
    min-width: 60px;
  }
}
