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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  min-height: 100vh;
  color: #1f1736;
  padding: 30px 16px;
}

.page {
  max-width: 460px;
  margin: 0 auto;
}

/* ===== Card ===== */
.card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

h1 {
  font-size: 1.7rem;
  text-align: center;
  margin-bottom: 4px;
}
.subtitle {
  text-align: center;
  color: #7a738f;
  font-size: 0.92rem;
  margin-bottom: 26px;
}

/* ===== Fields ===== */
.field { margin-bottom: 22px; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

input[type="number"],
input[type="range"] {
  width: 100%;
  font-family: inherit;
}

.input-wrap {
  position: relative;
}
.prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a738f;
  font-weight: 600;
}
input[type="number"] {
  padding: 12px 14px 12px 30px;
  border: 2px solid #e6e1f0;
  border-radius: 10px;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.15s;
}
input[type="number"]:focus { border-color: #6a11cb; }
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6a11cb, #2575fc);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #6a11cb;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #6a11cb;
  cursor: pointer;
}
.range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #a59dba;
  margin-top: 6px;
}

/* quick tip buttons */
.quick-tips {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}
.quick-tips button {
  flex: 1;
  padding: 9px;
  border: 2px solid #e6e1f0;
  background: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
}
.quick-tips button:hover {
  border-color: #6a11cb;
  color: #6a11cb;
}

/* people stepper */
.people-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.people-row input {
  text-align: center;
  flex: 1;
  padding: 10px;
  border: 2px solid #e6e1f0;
  border-radius: 10px;
  font-size: 1rem;
}
.people-row button {
  width: 42px; height: 42px;
  border: 2px solid #e6e1f0;
  background: #fff;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  color: #6a11cb;
  transition: border-color 0.15s;
}
.people-row button:hover { border-color: #6a11cb; }

/* ===== Result ===== */
.result {
  background: #f7f4fc;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.95rem;
  color: #5a5470;
}
.result-row strong { color: #1f1736; }
.result-row.total {
  border-top: 1px solid #e0d8ee;
  margin-top: 4px;
  padding-top: 12px;
  font-size: 1.15rem;
  font-weight: 700;
}
.result-row.total strong { font-size: 1.3rem; color: #6a11cb; }
.result-row.per-person { font-size: 0.88rem; color: #7a738f; }

.save-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.save-btn:hover { opacity: 0.92; }
.save-btn:active { transform: scale(0.98); }

/* ===== History ===== */
.history {
  margin-top: 26px;
  border-top: 1px solid #ece6f5;
  padding-top: 20px;
}
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.history-head h2 { font-size: 1.1rem; }
.clear-btn {
  background: none;
  border: none;
  color: #c0392b;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.clear-btn:hover { text-decoration: underline; }

.history-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}
.history-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid #f0ecf7;
  font-size: 0.9rem;
}
.history-list li:last-child { border-bottom: none; }
.history-empty {
  color: #a59dba;
  text-align: center;
  justify-content: center !important;
  padding: 18px !important;
}
.hist-date { color: #7a738f; font-size: 0.82rem; }
.hist-amt { font-weight: 600; }
.hist-amt small { color: #7a738f; font-weight: 400; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  margin-top: 24px;
  color: rgba(255,255,255,0.8);
  font-size: 0.84rem;
}

/* ===== Responsive ===== */
@media (max-width: 420px) {
  .card { padding: 24px 18px; }
  h1 { font-size: 1.4rem; }
}
