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

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

.container {
  max-width: 480px;
  margin: 0 auto;
}

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

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

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: #3b82f6;
}

.result-box {
  background: #f0f7ff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
}

.result-item {
  flex: 1;
  text-align: center;
}

.result-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1d4ed8;
}

.result-value.positive {
  color: #16a34a;
}

.result-value.negative {
  color: #dc2626;
}

.button-row {
  display: flex;
  gap: 10px;
}

.btn-primary {
  flex: 1;
  padding: 11px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 11px 18px;
  background: #e5e7eb;
  color: #444;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #d1d5db;
}

.history-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
}

.btn-danger {
  padding: 6px 12px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

#history-list {
  list-style: none;
}

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

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

.history-item .hi-main {
  flex: 1;
}

.history-item .hi-label {
  color: #888;
  font-size: 0.78rem;
}

.history-item .hi-values {
  display: flex;
  gap: 12px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.history-item .hi-values span {
  font-weight: 600;
  color: #333;
}

.history-item .hi-rate {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 64px;
  text-align: right;
}

.history-item .hi-rate.positive { color: #16a34a; }
.history-item .hi-rate.negative { color: #dc2626; }

.del-btn {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.del-btn:hover {
  color: #dc2626;
}

.no-history {
  text-align: center;
  color: #aaa;
  font-size: 0.88rem;
  padding: 16px 0;
}

@media (max-width: 375px) {
  h1 { font-size: 1.2rem; }
  .result-value { font-size: 1.3rem; }
}
