* {
  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-bottom: 40px;
}

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e65a00;
  margin-bottom: 2px;
}

.subtitle {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 16px;
}

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

h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Platform buttons */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.platform-btn {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.platform-btn span {
  font-size: 0.72rem;
  font-weight: 400;
  color: #999;
}

.platform-btn.active {
  border-color: #e65a00;
  background: #fff5f0;
  color: #e65a00;
}

.platform-btn.active span {
  color: #e65a00;
}

/* Form */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

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

.form-group input:focus {
  border-color: #e65a00;
}

.rate-display {
  font-size: 0.85rem;
  color: #666;
  background: #fafafa;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
}

.rate-display strong {
  color: #e65a00;
}

/* Result */
.result-card {
  background: linear-gradient(135deg, #e65a00 0%, #ff8c42 100%);
  color: #fff;
}

.result-card h2 {
  color: rgba(255,255,255,0.8);
}

.result-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-label {
  font-size: 1rem;
  font-weight: 600;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
}

.result-breakdown {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 12px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  color: rgba(255,255,255,0.9);
}

.breakdown-row.minus span:last-child {
  color: #ffd0b0;
}

.breakdown-row.total {
  border-top: 1px solid rgba(255,255,255,0.3);
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

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

.history-header h2 {
  margin-bottom: 0;
}

.btn-clear {
  font-size: 0.75rem;
  color: #e65a00;
  background: none;
  border: 1px solid #e65a00;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.history-list {
  list-style: none;
  margin-bottom: 12px;
  max-height: 220px;
  overflow-y: auto;
}

.history-list .empty-msg {
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
  padding: 12px 0;
}

.history-item {
  border-bottom: 1px solid #f0f0f0;
  padding: 8px 0;
  font-size: 0.82rem;
  color: #555;
}

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

.history-item .hi-platform {
  font-weight: 600;
  color: #e65a00;
  margin-right: 6px;
}

.history-item .hi-takehome {
  font-weight: 700;
  color: #333;
  float: right;
}

.history-item .hi-detail {
  color: #999;
  font-size: 0.78rem;
  display: block;
  margin-top: 2px;
}

.btn-save {
  width: 100%;
  background: #e65a00;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-save:hover {
  background: #cc5000;
}

.btn-save:disabled {
  background: #ccc;
  cursor: not-allowed;
}

@media (max-width: 360px) {
  .platform-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
