html, body, main, header, footer {
  padding: 0px;
  margin: 0px;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

#calculator {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  padding: 32px 24px;
}

#calculator h1 {
  text-align: center;
  font-size: 1.8rem;
  color: #1e1b4b;
  margin: 0 0 8px 0;
}

#formula-display {
  text-align: center;
  font-size: 1.1rem;
  color: #6366f1;
  margin: 0 0 28px 0;
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

#input-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

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

.input-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.input-group input {
  height: 48px;
  padding: 0 14px;
  border: 2px solid #d1d5db;
  border-radius: 10px;
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: #6366f1;
}

.input-group input.invalid {
  border-color: #ef4444;
}

.error-msg {
  font-size: 0.8rem;
  color: #ef4444;
  min-height: 1.2em;
  margin-top: 4px;
}

#action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.btn {
  padding: 10px 24px;
  font-size: 1rem;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  min-height: 44px;
}

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

.btn-primary {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

.btn-primary:hover:not(:disabled) {
  background: #4338ca;
  border-color: #4338ca;
}

.btn-outline {
  background: #ffffff;
  color: #4f46e5;
  border-color: #d1d5db;
}

.btn-outline:hover:not(:disabled) {
  background: #f5f3ff;
  border-color: #4f46e5;
}

#process-section {
  background: #f9fafb;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

#process-section h3 {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0 0 8px 0;
}

#process-text {
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  color: #374151;
  margin: 0;
  word-break: break-all;
}

#result-section {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  text-align: center;
}

#result-section h3 {
  font-size: 0.9rem;
  color: #4f46e5;
  margin: 0 0 12px 0;
}

#result-content {
  margin-bottom: 16px;
}

#result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e1b4b;
  word-break: break-all;
  font-family: 'Courier New', monospace;
}

#btn-copy {
  margin: 0 auto;
}

#history-section {
  margin-bottom: 16px;
}

#history-section h3 {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0 0 12px 0;
}

#history-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}

#history-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 24px 0;
  margin: 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}

.history-item:hover {
  background: #f3f4f6;
}

.history-expression {
  font-weight: 600;
  color: #4f46e5;
  white-space: nowrap;
}

.history-result {
  color: #6b7280;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btn-clear-history {
  display: block;
  margin: 0 auto;
}

#features, #scenarios, #FAQ {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

#features h2, #scenarios h2, #FAQ h2 {
  font-size: 1.4rem;
  color: #1e1b4b;
  margin: 0 0 12px 0;
}

#features p {
  color: #4b5563;
  line-height: 1.8;
}

#scenarios ul {
  padding-left: 20px;
}

#scenarios li {
  color: #4b5563;
  line-height: 1.8;
  margin-bottom: 8px;
}

#FAQ dl {
  margin: 0;
}

#FAQ dt {
  font-weight: 700;
  color: #1e1b4b;
  margin-bottom: 4px;
  margin-top: 16px;
}

#FAQ dd {
  color: #4b5563;
  line-height: 1.8;
  margin: 0 0 12px 0;
}

@media (max-width: 767px) {
  #input-section {
    grid-template-columns: 1fr;
  }

  #calculator {
    padding: 20px 16px;
  }

  #calculator h1 {
    font-size: 1.5rem;
  }

  #result-value {
    font-size: 1.2rem;
  }

  #action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}
