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

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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  padding: 16px 0 12px;
  color: #1e293b;
}

h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* 基準金額 */
.base-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.base-input input {
  flex: 1;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1.2rem;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
}

.base-input input:focus {
  border-color: #2563eb;
}

.unit {
  font-size: 1rem;
  color: #64748b;
  white-space: nowrap;
}

/* 金種テーブル */
.denomination-table {
  width: 100%;
  border-collapse: collapse;
}

.denomination-table th {
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.denomination-table th:nth-child(2),
.denomination-table th:nth-child(3) {
  text-align: right;
}

.denomination-table td {
  padding: 8px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.denomination-table tbody tr:last-child td {
  border-bottom: none;
}

.denom-name {
  font-weight: 600;
  font-size: 1rem;
  min-width: 70px;
}

.denom-input-cell {
  text-align: right;
}

.denom-input {
  width: 80px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 1rem;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
}

.denom-input:focus {
  border-color: #2563eb;
}

.denom-subtotal {
  text-align: right;
  font-size: 0.95rem;
  color: #475569;
  min-width: 90px;
}

.total-row td {
  padding: 10px 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1e293b;
  border-top: 2px solid #e2e8f0;
  text-align: right;
}

.total-row td:first-child {
  text-align: left;
}

/* 結果 */
.result-section {
  text-align: center;
}

.result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0 4px;
}

#diffLabel {
  font-size: 0.9rem;
  color: #64748b;
}

.diff-amount {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
}

.diff-amount.surplus {
  color: #2563eb;
}

.diff-amount.shortage {
  color: #dc2626;
}

.diff-amount.exact {
  color: #16a34a;
}

/* クリアボタン */
.actions {
  text-align: center;
  padding: 8px 0 24px;
}

.btn-reset {
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  padding: 10px 32px;
  font-size: 0.95rem;
  color: #64748b;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reset:hover {
  background: #e2e8f0;
}

@media (max-width: 400px) {
  .denom-input {
    width: 68px;
  }
  .denom-subtotal {
    min-width: 72px;
    font-size: 0.85rem;
  }
}
