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

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

#calc-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a73e8;
  margin: 0 0 4px 0;
}

.eq-format {
  text-align: center;
  font-size: 1.1rem;
  font-family: Consolas, "Courier New", monospace;
  color: #888;
  margin: 0 0 20px 0;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  min-width: 52px;
  text-align: right;
}

.input-field {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1.05rem;
  font-family: Consolas, "Courier New", monospace;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: #1a73e8;
}

.input-field.error {
  border-color: #d93025;
}

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

.group-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.preset-btn {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  font-size: 0.78rem;
  font-family: Consolas, "Courier New", monospace;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  word-break: break-all;
}

.preset-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
  background: #f0f5ff;
}

.error-text {
  color: #d93025;
  font-size: 0.85rem;
  min-height: 20px;
  margin-bottom: 4px;
}

.action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.primary-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: #1a73e8;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  min-height: 44px;
}

.primary-btn:hover {
  background: #1557b0;
}

.secondary-btn {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.secondary-btn:hover {
  border-color: #d93025;
  color: #d93025;
}

.result-area {
  background: #f8faff;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.result-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.block-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  min-width: 72px;
}

.block-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a73e8;
  font-family: Consolas, "Courier New", monospace;
  word-break: break-all;
  text-align: right;
}

.block-tag {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.tag-two-real {
  background: #e6f4ea;
  color: #137333;
}

.tag-double-root {
  background: #e8f0fe;
  color: #1967d2;
}

.tag-complex {
  background: #f3e8fd;
  color: #7b1fa2;
}

.steps-area {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
}

#steps-title {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 10px 0;
}

.steps-list {
  margin: 0;
  padding-left: 20px;
}

.step-item {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.7;
  font-family: Consolas, "Courier New", monospace;
  margin-bottom: 4px;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.history-eq {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  color: #333;
  word-break: break-all;
}

.history-roots {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  color: #666;
  word-break: break-all;
}

.history-type {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-right: 4px;
}

.history-type-real {
  background: #e6f4ea;
  color: #137333;
}

.history-type-complex {
  background: #f3e8fd;
  color: #7b1fa2;
}

.history-time {
  font-size: 0.7rem;
  color: #aaa;
  align-self: flex-end;
}

.empty-hint {
  text-align: center;
  color: #bbb;
  font-size: 0.9rem;
  margin: 16px 0;
}

#history-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 12px 0;
}

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

#features h2, #scenarios h2, #FAQ h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 8px 0;
}

#features p, #scenarios li, #FAQ dd {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.7;
}

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

#scenarios li {
  margin-bottom: 8px;
}

#FAQ dl {
  margin: 0;
}

#FAQ dt {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin-top: 12px;
}

#FAQ dd {
  margin: 4px 0 0 0;
}

#__fork {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 16px;
  text-align: center;
}

@media (max-width: 768px) {
  #app {
    padding: 12px;
    gap: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 8px;
  }

  #calc-title {
    font-size: 1.3rem;
    margin-bottom: 4px;
  }

  .eq-format {
    font-size: 1rem;
    margin-bottom: 16px;
  }

  .block-value {
    font-size: 1rem;
  }

  .preset-btn {
    padding: 6px 4px;
    font-size: 0.72rem;
  }

  .btn-row {
    gap: 6px;
  }
}
